SHELL=/bin/sh
# An example Makefile for a multi-directory system.

OBJ=	../dir1/program1.o ../dir1/program2.o  \
	../dir2/X/program3.o ../dir2/X/program4.o  \
	../includer/includer.o \
	master.o program1.o program2.o

all:     
	cd ../dir1; make "CC=$(CC)"
	cd ../dir2/X; make "CC=$(CC)"
	cd ../includer; make "CC=$(CC)"
	$(CC) -c master.c program1.c program2.c
	$(CC) -o system $(OBJ)

# Instead of using an absolute pathname and recursive make, call
# gct with relative pathnames to the master directory.
gct:
	gct-init $(GCTLIB);
	cd ../dir1; make "CC=gct -test-dir ../config -B$(GCTLIB)"
	cd ../dir2/X; make "CC=gct -test-dir ../../config -B$(GCTLIB)"
	cd ../includer; make "CC=gct -test-dir ../config -B$(GCTLIB)"
	gct -test-dir . -B$(GCTLIB) -c master.c program1.c program2.c
	$(CC) -c gct-ps-defs.c gct-write.c
	$(MAKE) all "OBJ=$(OBJ) gct-ps-defs.o gct-write.o"
	grestore 

clean:
	@-../../do-clean
	@-cd ../dir1; ../../do-clean
	@-cd ../includer; ../../do-clean
	@-cd ../dir2/X; ../../../do-clean
	@-/bin/rm -f system
