#############################################################################
#!
#! This is a tmake template for creating a makefile that invokes make in
#! sub directories - for Unix.
#!
#${
    StdInit();
    Project('MAKEFILE') || Project('MAKEFILE = Makefile');
    Project('TMAKE') || Project('TMAKE = tmake');
#$}
#!
# Makefile for building targets in sub directories.
# Generated by tmake at #$ Now();
#     Project: #$ Expand("PROJECT");
#    Template: #$ Expand("TEMPLATE");
#############################################################################

MAKEFILE =	#$ Expand("MAKEFILE");
TMAKE    =	#$ Expand("TMAKE");
REMOVE   =	#$ Expand("TMAKE_REMOVE");

SUBDIRS  =	#$ ExpandList("SUBDIRS");

all: $(SUBDIRS)

$(SUBDIRS): FORCE
	cd $@; $(MAKE)

tmake_all:
#${
	$text = "\t" . 'for i in $(SUBDIRS); do ( if [ -d $$i ]; then cd $$i ; pro=`basename $$i`.pro ; $(TMAKE) $$pro -o $(MAKEFILE); grep "TEMPLATE.*subdirs" $$pro 2>/dev/null >/dev/null && $(MAKE) -f $(MAKEFILE) tmake_all || true; fi; ) ; done';
#$}

clean release debug:
	for i in $(SUBDIRS); do ( if [ -d $$i ]; then cd $$i ; $(MAKE) $@; fi; ) ; done

dist:
	for i in $(SUBDIRS); do ( if [ -d $$i ]; then cd $$i ; $(MAKE) $@; fi; ) ; done
	$(REMOVE) Makefile #$ Expand('TMAKE_DIST_FILES');

FORCE:
