# Symlink me to (or include me from) locale/*/Makefile #### configuration ASCIIDOC = asciidoc AWK = awk LOCALE = $(shell basename `pwd`) DOCLANG = $(shell basename `pwd` | $(AWK) -F- '{ print ($$1 ~ /^[a-z][a-z]$$/) ? $$1 : "en" }') ADC_SRC_FILES = $(wildcard *.txt) ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html) ADC_DEPS = $(wildcard asciidoc.conf lang-$(DOCLANG).conf) DOC_FILES = $(ADC_FILES) version.html .SILENT: #### rules .PHONY: all help doc asciidoc check-asciidoc clean distclean all: doc doc: asciidoc help: @echo "$(NAME) $(VERSION) build" @echo @echo " make help - display this help" @echo " make doc - build doc files" @echo " make clean - clean up" @echo " make distclean - clean up more" clean: @echo "Cleanup of $(LOCALE) documentation..." distclean: clean @echo "More cleanup of $(LOCALE) documentation..." rm -f $(DOC_FILES) #### Makes single-file makes easier to type %: %.html %.txt ; #### asciidoc asciidoc: check-asciidoc $(DOC_FILES) check-asciidoc: @$(ASCIIDOC) --version | $(AWK) '{ exit $$2 !~ /^8\.2\./ }' || \ echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported" $(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS) @echo "DOC locale/$(LOCALE)/$@" $(ASCIIDOC) --unsafe -a linkcss -a quirks! -a lang=$(DOCLANG) -a doctitle="$(shell basename $@)" -o $@ $< version.html: ../../NEWS $(BASE)/Makefile.doc $(ADC_DEPS) @echo "DOC locale/$(LOCALE)/$@" # NOTE: asciidoc doesn't source the conf file implicitly when processing stdin sed -e '1i\ HEADER' -e '/^[0-9]/d' -e '/^ \+\* version /s/.*version \+\([0-9.]\+\).*/section:Version{nbsp}\1[version-\1]\ /' ../../NEWS | ${ASCIIDOC} -f asciidoc.conf -a doctitle=version.html -o version.html -