include ../Makefile.inc

all: anagram genealogy  hash  library  shapes  spellcheck  wordcount  wordfreq

clean: anagram.clean genealogy.clean  hash.clean  library.clean  shapes.clean  spellcheck.clean  wordcount.clean  wordfreq.clean

hash  library  shapes:
	$(PREFIX)gnatmake -P $@/$@.gpr
ifeq ($(RUN),true)
	(cd $@ && ./$@$(EXE))
endif

# We have special execution for these ones
anagram:
	$(PREFIX)gnatmake -P $@/$@.gpr
ifeq ($(RUN),true)
	(cd $@ && ./$@2$(EXE) short_dico)
endif
genealogy:
	$(PREFIX)gnatmake -P $@/$@.gpr
ifeq ($(RUN),true)
	(cd $@ && ./$@$(EXE) TCS-genealogy.txt)
endif
wordcount:
	$(PREFIX)gnatmake -P $@/$@.gpr
ifeq ($(RUN),true)
	(cd $@ && ./$@$(EXE) $@.xml)
endif

wordfreq:
	$(PREFIX)gnatmake -P $@/$@.gpr
ifeq ($(RUN),true)
	(cd $@ && ./$@$(EXE) < wordfreq-input.txt)
endif

# We have special execution for this one
# We don't want to execute those ones because they are interactive
spellcheck:
	$(PREFIX)gnatmake -P $@/$@.gpr

anagram.clean genealogy.clean  hash.clean  library.clean  shapes.clean  spellcheck.clean  wordcount.clean  wordfreq.clean:
	$(PREFIX)gnatclean -P $(@:%.clean=%)/$(@:%.clean=%).gpr

.PHONY: anagram genealogy  hash  library  shapes  spellcheck  wordcount  wordfreq anagram.clean genealogy.clean  hash.clean  library.clean  shapes.clean  spellcheck.clean  wordcount.clean  wordfreq.clean clean all

