DIRS=externals Utils Engine Lua Loader Database all: $(DIRS) doc: clean: clean-dirs rm -rf doc doc: doxygen.conf make -p doc doxygen doxygen.conf clean-dirs: for i in $(DIRS) ; do $(MAKE) -C $$i clean ; done .PHONY: $(DIRS) doc clean define DIR_template $(1): $$(MAKE) -C $$@ endef $(foreach dir, $(DIRS), $(eval $(call DIR_template, $(dir))))