Makefile 1.52 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
# build asciidoc books

ifdef BUILDDIR
DEST = -D "$(BUILDDIR)"
endif

ifdef DEBUG
VERBOSE = --verbose
endif

11 12 13
# avoid common DEBUG for the time being
-include $(HOME)/.mkimage/profiles.mk

Mike Radyuk's avatar
Mike Radyuk committed
14
PROJECT = mkimage-profiles
15
TOPLEVEL_DOC = $(PROJECT).asciidoc
16
RESOURCE_FILES = /etc/asciidoc
Mike Radyuk's avatar
Mike Radyuk committed
17 18

A2X = a2x
19 20 21 22 23 24 25 26 27 28 29
FXC = .fop.xconf

L = ru
DEPTH = 3

# 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)

30 31 32
# most convenient deliverables
DOCS_OUT = $(PROJECT).pdf $(PROJECT).html docbook-xsl.css

33 34 35
# intermediate files
DOCS_TMP = $(PROJECT).fo $(PROJECT).xml

36 37 38 39
.PHONY: all prep chunked xhtml pdf clean

all: chunked xhtml pdf

40 41 42 43 44 45
# NB: destination defined externally
publish: all
	@if [ -n "$(DOCS_PUBLISH)" ]; then \
		rsync -qa $(DOCS_OUT) "$(DOCS_PUBLISH)"; \
	fi

46 47 48 49 50 51 52 53 54 55 56 57 58 59
prep:
	@if [ -n "$(BUILDDIR)" ]; then mkdir -p "$(BUILDDIR)"; fi

chunked xhtml: prep
	@echo "** building $@ book"
	@$(A2X) -f $@ $(HTML_ARGS)

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)
Mike Radyuk's avatar
Mike Radyuk committed
60

61 62 63
clean:
	@echo "** cleaning up"
	@if [ -d "$(BUILDDIR)" ]; then cd "$(BUILDDIR)"; fi; \
64
	rm -rf $(DOCS_OUT) $(DOCS_TMP) $(PROJECT).chunked/ .fop.xconf