include Makefile.defs

all :
	make sources
	make applications
	make install
	make install-applications

test :
	make sources
	make install
	make TD
	make install-TD

# Sources, do a make in source subdir
# can also be built from Makefile in this subdir.
sources : 
#	( cd ProTcl ; make )
#	( cd Static ; make )
	( cd Tex ; make )
	( cd Tcl ; make )
	( cd Prolog ; make )

# Applications can also be built / installed / cleaned from their
# own directory, as long as they include Makefile.defs
applications : TD TC TT TG TL TX TA

TD :
	( cd Applications/Dcg ; make $(STATE_OR_SCRIPT))

TC :
	( cd Applications/CBCG ; make $(STATE_OR_SCRIPT))

TT :
	( cd Applications/Tag ; make $(STATE_OR_SCRIPT))

TG :
	( cd Applications/GenBook ; make $(STATE_OR_SCRIPT))

TL :
	( cd Applications/LexRules ; make $(STATE_OR_SCRIPT))

TX :
	( cd Applications/Extraposition ; make $(STATE_OR_SCRIPT))

TA :
	( cd Applications/Ale ; make $(STATE_OR_SCRIPT))

# Installing
install :
	rm -f $(APPDEFS)/Hdrug
	ln -s $(CWD)/Hdrug.ad.$(AD_SUFFIX) $(APPDEFS)/Hdrug

install-applications : install-TD install-TC install-TT\
        install-TG install-TL install-TX install-TA

install-TD :
	( cd Applications/Dcg ; make install)

install-TC :
	( cd Applications/CBCG ; make install)

install-TT :
	( cd Applications/Tag ; make install)

install-TG :
	( cd Applications/GenBook ; make install)

install-TL :
	( cd Applications/LexRules ; make install)

install-TX :
	( cd Applications/Extraposition ; make install)

install-TA :
	( cd Applications/Ale ; make install )

# Cleaning
clean :
	rm $(RM_PATTERN)

all-clean : clean clean-sources clean-applications

clean-sources :
#	( cd ProTcl ; make clean )
#	( cd Static ; make clean )
	( cd Prolog ; make clean )
	( cd Tex ; make clean )
	( cd Tcl : make clean )

clean-applications : clean-TD clean-TC clean-TT\
        clean-TG clean-TL clean-TX clean-TA

clean-TD :
	( cd Applications/Dcg ; make clean)

clean-TC :
	( cd Applications/CBCG ; make clean)

clean-TT :
	( cd Applications/Tag ; make clean)

clean-TG :
	( cd Applications/GenBook ; make clean)

clean-TL :
	( cd Applications/LexRules ; make clean)

clean-TX :
	( cd Applications/Extraposition ; make clean)

clean-TA :
	( cd Applications/Ale ; make clean )


