SUBDIRS=`find . -maxdepth 1 -type d -regex '\./.*'`
PRJFILE=./ta-project.rtg
CRPRJSCRIPT=./create.ta-project.rtg.sh

all: projectfile
	for i in $(SUBDIRS); do \
	cd $$i; make all; cd ..; done

clean:
	for i in $(SUBDIRS); do \
	cd $$i; make clean; cd ..; done
	rm -f ${PRJFILE}

preexport: clean
	cd sclib; make clean; \
	rm -f scstatechart.c scstate.c sctransition.c scsignal.c \
		scguard.c scaction.c test.c; \
	touch scstatechart.c scstate.c sctransition.c scsignal.c \
		scguard.c scaction.c test.c; \
	echo 'int main (int argc, char** argv) {}' >> test.c; \
	cd ..
	for i in $(SUBDIRS); do \
	cd $$i; make preexport; cd ..; done

projectfile:
	${CRPRJSCRIPT} > ${PRJFILE}
