# # Rules.make for WML # DEPEND = $(PAGES:%.webml=.%.d) HTML_DE = $(PAGES:%.webml=%.de.html) HTML_EN = $(PAGES:%.webml=%.en.html) HTML_NA = $(PAGES:%.webml=%.html) all: html tidy clean: rm -f $(HTML_DE) $(HTML_EN) $(HTML_NA) $(DEPEND) -@subdirs='$(SUBDIRS)';\ for i in $$subdirs; do\ $(MAKE) --no-print-directory -C $$i clean;\ done tidy: $(HTML_DE) $(HTML_EN) -@files='$(HTML_DE) $(HTML_EN)';\ for i in $$files; do\ grep -sq "HTML Tidy" $$i || (\ echo "Tidying file: $(shell pwd)/$$i";\ tidy -m -q -i -wrap 80 -asxhtml --doctype strict $$i;\ )\ done -@subdirs='$(SUBDIRS)';\ for i in $$subdirs; do\ $(MAKE) --no-print-directory -C $$i tidy;\ done html: $(HTML_DE) $(HTML_EN) $(HTML_NA) $(DEPEND) -@subdirs='$(SUBDIRS)';\ for i in $$subdirs; do\ $(MAKE) -C $$i html;\ done .SUFFIXES: .PHONY: all clean tidy html # It's faster to output both language with one wml invocation: # We rely on the fact that this rules executes for %.de.html files first. # Since we are also updating the %.en.html file in this execution, it never # gets executed for the en version) %.de.html %.en.html %.html: %.webml wml -o\(ALL-LANG_*\)+LANG_DE:$@ -o\(ALL-LANG_*\)+LANG_EN:$(subst .de.html,.en.html,$@) $< @ln -sf $(subst .de.html,.en.html,$@) $(subst .de.html,.html,$@) @-chmod g+w $@ .%.d: %.webml wml -o$*.de.html -M $< -I/usr/share/wml/include > .$*.d wml -o$*.en.html -M $< -I/usr/share/wml/include >> .$*.d @-chmod g+w .$*.d ifneq ($(strip $(DEPEND)),) ifneq ($(MAKECMDGOALS),clean) # don't create .d files only to delete them again ifneq ($(MAKECMDGOALS),distclean) -include $(DEPEND) endif endif endif