doc/Makefile: refactoring

The initial sketch did work but was somewhat redundant
while lacking the knob conveniently change output directory
as well as means to get it cleaned up.
This commit is contained in:
Michael Shigorin 2012-11-05 13:17:00 +02:00
parent 12de346ddd
commit 6694882715

View File

@ -1,31 +1,50 @@
# build asciidoc books
ifdef BUILDDIR
DEST = -D "$(BUILDDIR)"
endif
ifdef DEBUG
VERBOSE = --verbose
endif
PROJECT = mkimage-profiles PROJECT = mkimage-profiles
TOPLEVEL_DOC = mkimage-profiles.asciidoc TOPLEVEL_DOC = $(PROJECT).asciidoc
HTMLPAGE = $(TOPLEVEL_DOC:.asciidoc=.html)
RESOURCE_FILES = /etc/asciidoc RESOURCE_FILES = /etc/asciidoc
A2X = a2x A2X = a2x
FXC = .fop.xconf
.PHONY: all clean L = ru
DEPTH = 3
all: $(HTMLPAGE) # common args (and the source file to process) come last
XSLT_ARGS = --stringparam toc.max.depth $(DEPTH)
COMMON_ARGS = -d book -a lang="$L" $(DEST) $(VERBOSE) $(TOPLEVEL_DOC)
HTML_ARGS = -a data-uri --icons -r $(RESOURCE_FILES) -r . \
--xsltproc-opts='$(XSLT_ARGS)' $(COMMON_ARGS)
%.html: %.asciidoc .PHONY: all prep chunked xhtml pdf clean
$(A2X) -d book -f xhtml -a lang=ru \
--icons -r $(RESOURCE_FILES) -r . \
--xsltproc-opts='--stringparam toc.max.depth 3' \
$<
chunked: $(TOPLEVEL_DOC) all: chunked xhtml pdf
$(A2X) -d book -f chunked -a lang=ru \
--icons -r $(RESOURCE_FILES) -r . \
--xsltproc-opts='--stringparam toc.max.depth 3' \
$<
pdf: $(TOPLEVEL_DOC) prep:
$(A2X) --verbose --fop --fop-opts='-c .fop.xconf' -d book -f pdf -a lang=ru \ @if [ -n "$(BUILDDIR)" ]; then mkdir -p "$(BUILDDIR)"; fi
--xsltproc-opts=' \
--stringparam toc.max.depth 3 \ chunked xhtml: prep
--stringparam title.font.family "DejaVu Sans" \ @echo "** building $@ book"
--stringparam body.font.family "DejaVu Serif" \ @$(A2X) -f $@ $(HTML_ARGS)
--stringparam monospace.font.family "DejaVu Sans Mono"' \
$< pdf: prep
@echo "** building $@ book"
@$(A2X) --xsltproc-opts='$(XSLT_ARGS) \
--stringparam title.font.family "DejaVu Sans" \
--stringparam body.font.family "DejaVu Serif" \
--stringparam monospace.font.family "DejaVu Sans Mono"' \
--fop --fop-opts='-c $(FXC)' -f pdf $(COMMON_ARGS)
clean:
@echo "** cleaning up"
@if [ -d "$(BUILDDIR)" ]; then cd "$(BUILDDIR)"; fi; \
rm -f $(PROJECT).pdf $(PROJECT).html docbook-xsl.css; \
rm -rf $(PROJECT).chunked/