#
# $Revision: 1.1.1.1 $
#
# Top level Makefile for SysInfo
#

#
# Copyright (c) 1992-2000 MagniComp 
# This software may only be used in accordance with the license which is 
# available as http://www.magnicomp.com/sysinfo/4.0/sysinfo-eu-license.shtml
#

topsrcdir 	= @top_srcdir@
srcdir		= @srcdir@
VPATH 		= @srcdir@

@VarsMF@

MYMCD_FILES	= $(srcdir)/COPYRIGHT $(srcdir)/README \
			$(srcdir)/INSTALL.html $(srcdir)/INSTALL.txt \
			$(srcdir)/LICENSE.html $(srcdir)/LICENSE.txt
TARGETS		= lib sysinfo config doc include
AC_H		= include/autoconfig.h
AC_CLEAN_FILES	= stamp-h $(AC_H) confdefs.h Makefile \
			config.cache config.log config.status

PRE		= >>>>
POST		= <<<<

all: $(AC_H)
	@for t in $(TARGETS); do \
		echo '$(PRE)' Making \"$@\" in \"$$t\" '$(POST)'; \
		(cd $$t; ${MAKE} $@); \
	done

install: $(AC_H)
	@for t in $(TARGETS); do \
		echo '$(PRE)' Making \"$@\" in \"$$t\" '$(POST)'; \
		(cd $$t; ${MAKE} $@); \
	done

install.man: $(AC_H)
	@for t in $(TARGETS); do \
		echo '$(PRE)' Making \"$@\" in \"$$t\" '$(POST)'; \
		(cd $$t; ${MAKE} $@); \
	done

mcdall: mymcdadd
	@for t in $(TARGETS) mcd; do \
		echo '$(PRE)' Making \"$@\" in \"$$t\" '$(POST)'; \
		(cd $$t; ${MAKE} $@); \
	done

mcdbuild:
	@for t in mcd; do \
		echo '$(PRE)' Making \"$@\" in \"$$t\" '$(POST)'; \
		(cd $$t; ${MAKE} $@); \
	done

#
# Make a distribution
#
dist: all mcdall mcdbuild
	cd sysinfo && ${MAKE} output

clean:
	rm -f *~ a.out core \#*
	@for t in $(TARGETS); do \
		echo '$(PRE)' Making \"$@\" in \"$$t\" '$(POST)'; \
		(cd $$t; ${MAKE} $@); \
	done

fullclean:
	rm -f *~ a.out core \#* configvars.sh
	@for t in $(TARGETS); do \
		echo '$(PRE)' Making \"$@\" in \"$$t\" '$(POST)'; \
		(cd $$t; ${MAKE} $@); \
	done

distclean:
	rm -f *~ a.out core \#* configvars.sh
	@for t in $(TARGETS); do \
		echo '$(PRE)' Making \"$@\" in \"$$t\" '$(POST)'; \
		(cd $$t; ${MAKE} $@); \
	done
	rm -f $(AC_CLEAN_FILES)

objdir:
	@Dir=OBJ/`$(BUILDINFO) -platform`; \
	cmd="build/mkdirhier $$Dir"; \
	echo $$cmd; $$cmd

FRC:

#
# Short cut for building configure
#
autoconf: configure.in
	cd ${srcdir} && autoheader && autoconf

#
# Build a source distribution
#
srcdist:
	@echo $(SRCDIST_FILES) | $(srcdir)/build/buildsrcdist \
		--srcdir $(srcdir) \
		--program ./sysinfo/sysinfo \
		--distdir $(DistDir)

copyright: $(SRCDIST_FILES)
	@$(srcdir)/build/fixcopyright $(SRCDIST_FILES)

#
# Top level mcd
#
mymcdadd: $(MYMCD_FILES)
	@for f in $(MYMCD_FILES) ; do \
		b=`echo $$f | sed -e 's;.*/;;'`; \
		cmd="$(MCDADD) -R $(PROTOROOT) \
			-t $$b -m 444 $(INSTALLOWN) $$f"; \
		echo $$cmd; \
		$$cmd; \
	done
