Makefile 1.49 KB
Newer Older
1 2
# build asciidoc books

3
ifneq (,$(BUILDDIR))
4 5 6
DEST = -D "$(BUILDDIR)"
endif

7
ifneq (,$(DEBUG))
8 9 10
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
Mike Radyuk's avatar
Mike Radyuk committed
16 17

A2X = a2x
18 19 20 21 22 23 24 25
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)
26
HTML_ARGS = -a data-uri --icons -r . \
27 28
	    --xsltproc-opts='$(XSLT_ARGS)' $(COMMON_ARGS)

29
# most convenient deliverables
30
DOCS_OUT = mkimage-profiles.7 $(PROJECT).pdf $(PROJECT).html docbook-xsl.css
31

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

35 36
.PHONY: all prep chunked xhtml pdf clean

37
all: chunked xhtml pdf
38

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

45 46 47 48 49 50 51 52 53 54 55 56 57 58
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
59

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