1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 05:22:27 +01:00
Files
pentadactyl-pm/common/Makefile.doc
2009-08-07 01:15:23 +10:00

67 lines
1.8 KiB
Makefile

# 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" }')
SRC_FILES = $(wildcard *.txt)
FILES = $(SRC_FILES:%.txt=%.html)
DEPS = $(wildcard asciidoc.conf lang-$(DOCLANG).conf)
DOC_FILES = $(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\.4\./ }' || \
echo >&2 "Warning: asciidoc versions other than 8.4.x are unsupported"
version.html: ../../NEWS $(BASE)/Makefile.doc $(DEPS)
@echo "DOC locale/$(LOCALE)/$@"
# NOTE: asciidoc doesn't source the conf file implicitly when processing stdin
sed -e '1i\
heading:Version{nbsp}information[version-information]' \
-e '/^[0-9]/d' \
-e '/^ \+\* version /s/.*version \+\([0-9.]\+\).*/section:Version{nbsp}\1[version-\1]\
/' ../../NEWS | \
${ASCIIDOC} -f $(BASE)/asciidoc.conf -a doctitle=version.html -o version.html -
$(FILES): %.html: %.txt $(BASE)/Makefile.doc $(DEPS)
@echo "DOC locale/$(LOCALE)/$@"
$(ASCIIDOC) -f $(BASE)/asciidoc.conf -a configname=$(NAME) --unsafe -a linkcss -a quirks! -a lang=$(DOCLANG) -a doctitle="$$(basename $@)" -o $@ $<