#
# Copyright 1987 Apple Computer, Inc.
# $Header: makefile,v 1.19 87/10/09 11:48:51 rpd Exp $
#
# $Log:	makefile,v $
# Revision 1.19  87/10/09  11:48:51  rpd
# Now, make install creates toolbox.version
# 
# Revision 1.18  87/09/03  20:53:26  rpd
# Now, make install only creates one cpio archive.
# 
# Revision 1.17  87/06/27  03:00:27  rpd
# Removed /usr/bin from list of directories to create in make install.
# This was only needed for screenrestore which died long ago.
# 
# Revision 1.16  87/06/18  00:32:04  rpd
# Added text directory
# 
# Revision 1.15  87/06/13  12:55:44  rpd
# Added some useful comments
# 
# Revision 1.14  87/06/13  01:08:25  rpd
# Added launch directory
# Added kludge to rm tl after everything get dones.  This leaves two links
# of tl; one for rez and one for derez.  Eventually, these will actually be
# links to launch and tl will be out of business.
# 
# Revision 1.13  87/06/11  01:51:00  rpd
# Added /usr/lib/mac/examples/term to list of directories to install
# 
# Revision 1.12  87/05/27  01:13:11  rpd
# in make install, moved *.h into tb2.cpio so both will fit on floppies
# 
# Revision 1.11  87/05/22  14:07:57  rpd
# Added /usr/lib/mac/examples
# 
# Revision 1.10  87/04/11  19:03:40  rpd
# Beefed up make install.  Now it creates seperate cpio files to be placed
# on different floppies.
# 
# Revision 1.9  87/04/02  17:50:42  rpd
# Killed install of /usr/local and /usr/local/bin
# Added /usr/bin and /usr/toolboxbin
# 
# Revision 1.8  87/04/02  13:40:20  rpd
# Added nasty hack to builing or libmac.a so that we can circumven some
# of the bugs in ar and ld.
# 
# Revision 1.7  87/04/01  15:03:19  rpd
# Added etc to make install
# 
# Revision 1.6  87/03/31  22:10:48  rpd
# Added /usr/local/bin to make install
# 
# Revision 1.5  87/03/13  16:05:06  rpd
# Fixed permissions on created directories
# 
# Revision 1.4  87/03/13  01:46:33  rpd
# Added data directory
# Moved installation of uinter0 into data
# Pulled low.o out of list of files to stuff into libmac.a
# Moved libmac.a from /usr/lib/mac into /usr/lib
# 
# Revision 1.3  87/03/12  18:03:19  rpd
# Added inc to list of directories
# Removed make cpio
# Added make install
# 
# Revision 1.2  87/01/19  21:26:41  rpd
# added MAIN_DIR
# 
# Revision 1.1  87/01/15  23:01:23  rpd
# Initial revision
# 

# This is the top level makefile for the UNIX toolbox software.

# To clean out all object code, etc., use "make clean"
# To rebuild everything, use "make all" or just "make"
# To run some simple tests, use "make test"
# To do an installation, use "make install".  This will leave a cpio archive
#	in /tmp with a name begining with "toolbox."

# ***NOTE:***
# This package is one of those annoying software packages that must be
# installed before it can be recompiled.  Someday this may change, but
# don't count on it.

MAIN_DIR =	.
include make.global

DIRS =	tools wrappers lib launch tests misc inc text data
INS_DIR =	/tmp

all:
	for i in ${DIRS}; do \
	    cd $$i; \
	    make all; \
	    cd ..; \
	done

clean:
	for i in ${DIRS}; do \
	    cd $$i; \
	    make clean; \
	    cd ..; \
	done

test:
	for i in ${DIRS}; do \
	    cd $$i; \
	    make test; \
	    cd ..; \
	done

install:
	mkdir ${INS_DIR}/tb
	${INSTALL} -t d -p 0755 etc usr usr/toolboxbin usr/lib \
		usr/lib/mac usr/lib/mac/examples usr/lib/mac/examples/term \
		/usr/lib/mac/rincludes usr/include usr/include/mac dev \
		${INS_DIR}/tb
	for i in ${DIRS}; do \
	    cd $$i; \
	    make install DESTPATH=${INS_DIR}/tb; \
	    cd ..; \
	done
	rm ${INS_DIR}/tb/usr/toolboxbin/tl
	mkdir tmp
	cd tmp; \
	ar x ../lib/shared.a; \
	ar x ../wrappers/wrappers.a; \
	ar cr libmac.a *; \
	ar d libmac.a mpwlib.o; \
	ar r libmac.a mpwlib.o; \
	mv libmac.a ..
	${INSTALL} libmac.a ${INS_DIR}/tb/usr/lib;
	rm -rf libmac.a tmp
	cd ${INS_DIR}/tb; \
	find . ! -type d -print | cpio -o > ${INS_DIR}/toolbox.${VERSION}; \
	cd ${INS_DIR}; \
	rm -rf tb

