#ident	"@(#)Makefile	25.1	11/27/91	Copyright (c) 1991 by Arix Corp."
#
# Rules:
#
# By default the standard kernel and utils are built
#
# To have this makefile not require setting of IROOT all rules which pass
# IROOT MUST have an indirect rule which first sets the current path.
#
# standard: (default) build the system and util trees. Including
#           standard and debug versions of the system tree, a secure 
#           version of the kernel, and standard and secure versions 
#           of the utilities.
#
#     tape: make a tape of the base OS.
#
#  sectape: make a tape of the security overlay.
#
#  sgstape: make a tape containing the 020 and 040 sgs', the libraries and
#  the include files.
#
#  sgs: make an 020 and an 040 sgs.
#
#  sys: make a system build. (kernel, iopm, spm, diag, etc.).
#
#  utilities: make a utilities build.
#
#  checkout: walk the SCCS tree and check-out the latest release
#            (or a user specified relese level).
#            It ensures we do a build only with those changes
#            that have been checked in.


all standard:
	( date ;							\
	echo "Building bootsgs first" ;					\
	$(MAKE) ind_sgs BUILD=`pwd`;				\
	echo "Kicking off system make" ;				\
	cd system ;							\
	nohup sh MAKEALL clobber all > standard.out 2>&1 & WAIT_IDU=$$!;\
	echo "Starting util build" ;					\
	cd .. ;								\
	$(MAKE) ind_utilities BUILD=`pwd` > nohup.util 2>&1 &	\
		WAIT_IDS=$$! ;						\
	echo "waiting for the builds to finish before continuing..." ;	\
	wait $$WAIT_IDS ;						\
	wait $$WAIT_IDU ;						\
	$(MAKE) ind_diskrel BUILD=`pwd`;				\
	echo "All done" ;						\
	date ; )

sgs:
	date
	$(MAKE) ind_sgs BUILD=`pwd`
	echo "Done"
	date

sys:
	date
	cd system; \
	nohup sh MAKEALL clobber all > standard.out 2>&1
	echo "Done"
	date

utilities:
	date
	$(MAKE) ind_utilities BUILD=`pwd`
	echo "Done"
	date

diskrel:
	date
	$(MAKE) ind_diskrel BUILD=`pwd`
	echo "Done"
	date

checkout:
	date
	chmod +x `pwd`/tools/getall
	`pwd`/tools/getall
	echo "Done"
	date


tape020:
	$(MAKE) ind_tape MACHINE=020 BUILD=`pwd`

tape040:
	$(MAKE) ind_tape MACHINE=040 BUILD=`pwd`

sectape020:
	$(MAKE) ind_sectape MACHINE=020 BUILD=`pwd`

sectape040:
	$(MAKE) ind_sectape MACHINE=040 BUILD=`pwd`

domtape:
	$(MAKE) ind_domtape BUILD=`pwd`

sgstape:
	$(MAKE) ind_sgstape BUILD=`pwd`

srctape:
	find Makefile README.SCCS install_files system util -print | \
	cpio -ovB > /dev/rmt1

clobber:
	$(MAKE) ind_clobber BUILD=`pwd`

#
# Indirect rules.  BUILD should be set in Direct rules above!!
# IROOT will be set based on BUILD
#

ind_sgs:
	cd $(BUILD)/util/src ;						\
	nohup $(MAKE) -ief src.mk sgs IROOT=$(BUILD)/tools \
	> nohup.bootsgs 2>&1

ind_utilities:
	cd $(BUILD)/util/src ;						\
	nohup $(MAKE) -ief src.mk utilities IROOT=$(BUILD)/tools

ind_diskrel:
	cd $(BUILD)/util/src ;						\
	nohup $(MAKE) -ief src.mk diskrel IROOT=$(BUILD)/tools

ind_tape:
	cd $(BUILD)/util/src ;\
	$(MAKE) -f src.mk tape$(MACHINE) IROOT=$(BUILD)/tools

ind_sectape:
	cd $(BUILD)/util/src ;\
	$(MAKE) -f src.mk sectape$(MACHINE) IROOT=$(BUILD)/tools

ind_sgstape:
	cd $(BUILD)/util/src ;\
	$(MAKE) -f src.mk sgstape IROOT=$(BUILD)/tools

ind_domtape:
	cd $(BUILD)/util/src ;\
	$(MAKE) -f src.mk domtape IROOT=$(BUILD)/tools

ind_clobber:
	rm -f *spec*
	cd $(BUILD)/util/src ;						\
	$(MAKE) -ief src.mk clobberall IROOT=$(BUILD)/tools
	cd system ;							\
	sh MAKEALL clobber
