# Datenspuren Makefile for c3d2-web # Source-Dirs V = tpl # English Templates HE = header-en.tpl NE = nav-en.tpl FE = footer-en.tpl # join all English sites E := $(foreach dir,$(V),$(subst $(dir)/,,$(wildcard $(dir)/*-en.html))) # German Templates HD = header.tpl ND = nav.tpl FD = footer.tpl # join all sites and remove foreign langs D := $(foreach e,$(E),$(subst $(e),,$(subst tpl/,,$(wildcard tpl/*.html)))) # list of files to build including foreign langs L = $(D) $(E) # function for counting chars countchars := $() .PHONY: all all: $(L) @echo "built all html targets \t\t\t[DONE]" install: all @echo "Nothing to install, built the site with 'make all' \ instead" #deu: $(D) #eng: $(E) $(D): %:tpl/% tpl/$(HD) tpl/$(ND) tpl/$(FD) @echo -n "Target: $(subst tpl/,,$<) \t\t\t" @cat tpl/$(HD) tpl/$(ND) $< tpl/$(FD) > $@ @echo "[DONE]" $(E): %:tpl/% tpl/$(HE) tpl/$(NE) tpl/$(FE) @echo -n "Target: $(subst tpl/,,$<) \t\t\t" @cat tpl/$(HE) tpl/$(NE) $< tpl/$(FE) > $@ @echo "[DONE]" print: $(L) @echo "Target 'all' checks for: $?" # paths for deleting tmp files P = $(V) . # clean target #.PHONY: clean clean: $(foreach i,$(wildcard *.html),$(shell rm $(i) )) $(foreach i,$(foreach dir,$(P),$(wildcard $(dir)/.*.un~)),$(shell rm $(i) )) help: @echo Makefile for Datenspuren 2014 in c3d2-web @echo for c3d2,de and datenspuren.de @echo @echo make [OPTION] @echo @echo [OPTION] one out of the following @echo @echo all builts all targets defined in the sites \ macro \$\(S\) @#echo @#echo [lang] building single langs: @#echo deu German @#echo eng English @echo @echo clean deletes tmp files as of vim @echo @echo print informs about main targets @echo @echo help print this text @echo