# Top level Makefile for entire TAMU.99p12 source tree
#
# To make the full source tree:
#	- edit the BINROOTDIR and CONFIGDIR definitions 
#	- in this directory, "make root"
#	- then "make"   (does make, make install, make clean)
# Additional targets include
#       - "make compile" compile everything
#	- "make install" install everything
#	- "make clean"   clean everything
# 	- "make binfloppy" make a set of binary floppies
#	- "make srcfloppy" make a set of source floppies
#	- "make bootfloppy.3" make a 3 inch install floppy
#	- "make bootfloppy.5" make a 5 inch install floppy
#
# This make system defines three types of directories:
#	- SUBDIRS  (cd into them and run "make -f Makefile.tamu")
#	- PACKAGES (leaf nodes, run either ../<package>.mk or Makefile)
#	- PATCHES (these sources are already applied to the 
#                 respective package, and are ignored by make)

# configuration section -- set directory locations
# BINROOTDIR can be "/", to install over the current root, or another
#            directory, such as "/root" to make a new binary set.
BINROOTDIR=/root2
CONFIGDIR=/usr/src/.mk
export BINROOTDIR CONFIGDIR
# end of configuration section

all:	default post_process

SUBDIRS = usr.man usr.dict usr.X386 bin sbin usr.bin lib usr.sbin
PACKAGES = linux 

include $(CONFIGDIR)/Subdir.mk

.PHONY: post_process
post_process:
	strip $(BINROOTDIR)/bin/* $(BINROOTDIR)/usr/bin/* 
	strip $(BINROOTDIR)/sbin/* $(BINROOTDIR)/usr/sbin/* 
	strip $(BINROOTDIR)/usr/X386/bin/compress
	chmod 444 $(BINROOTDIR)/usr/man/man*/*
	chmod 444 $(BINROOTDIR)/usr/man/cat*/*
	chmod 444 $(BINROOTDIR)/usr/X386/man/man*/*
	$(BINROOTDIR)/usr/lib/makewhatis $(BINROOTDIR)/usr/man
	$(BINROOTDIR)/usr/lib/makewhatis $(BINROOTDIR)/usr/X386/man

.PHONY: root
root:
	zcat root.tar.gz | (cd $(BINROOTDIR); tar xpf -)
	(cd $(BINROOTDIR)/dev; ./MAKEDEV generic >& /dev/null)
	(cd $(BINROOTDIR)/dev; ./MAKEDEV net >& /dev/null)

binfloppy:
	(cd $(BINROOTDIR); tar cf - .) | gzip | mw /dev/fd0H1440 1440 "TAMU.99p12+ Binary `date`"

srcfloppy:
	tar cf - . | gzip | mw /dev/fd0H1440 1440 "TAMU.99p12+ Set `date`"

bootfloppy.3:
	(cd boot; $(MAKE) 3inch)

bootfloppy.5:
	(cd boot; $(MAKE) 5inch)
