Makefile 1.87 KB
Newer Older
1 2 3 4 5
# Генератор документации 

SRC=src
DOCBOOK-XSL = /usr/share/xml/docbook/stylesheet/docbook-xsl
DOCBOOKOPTS=--template=conf/pandoc/book.docbook --smart -t docbook -V lang=ru
6 7 8 9 10 11 12 13 14 15 16 17 18
ODTOPTS=-t odt --standalone
PANDOC_PDF_OPTIONS=--latex-engine=xelatex \
					   --template=conf/pandoc/template.latex \
					   -V lang=$(LANGUAGE) \
					   -V papersize:"a4paper" \
					   -V geometry:margin=2cm \
					   -V mainfont="Liberation Serif" \
					   -V sansfont="Liberation Sans" \
					   -V classoption=11pt \
					   --smart \
					   --no-tex-ligatures
#					   --highlight-style=kate \
#					   -V classoption=12pt \
19 20 21 22 23 24 25

spec.md: 
	gpp -H -I$(SRC) $(SRC)/index.md > spec.md

spec.xml: spec.md
	@echo Creating full XML image
ifdef VCSREV
Kristina Markova's avatar
Kristina Markova committed
26
	pandoc $(DOCBOOKOPTS) spec.md \
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
	| xsltproc --encoding utf8 \
		--stringparam vcs.revision $(VCSREV) \
		--stringparam vcs.changedby "$(VCSCHANGEDBY)" \
		--xinclude conf/vcs/insert-revision-and-build-date.xsl - > spec.xml
else
	pandoc $(DOCBOOKOPTS) spec.md -o spec.xml
	#SP_ENCODING="UTF-8" xmllint --encode utf8 --xinclude src/index.xml > spec.xml
endif
	sed -i 's/xml:base=".*"//g' spec.xml

html: spec.xml 
	@echo Creating html document
	rm -rf bin/html
	mkdir bin/html
	LC_ALL=en_US.UTF-8 xmlto xhtml -m conf/html/settings.xsl -o bin/html spec.xml
	tar --exclude-vcs -c resources | tar x -C bin/html
	# Working around images used in stylesheets
	mkdir bin/html/resources/docbook
	cp -a $(DOCBOOK-XSL)/images bin/html/resources/docbook

47
pdf: spec.md
48
	@echo Creating pdf document
49
	mkdir -p bin/pdf
50
#	SP_ENCODING="UTF-8" docbook2pdf -o bin spec.xml
51
	pandoc $(PANDOC_PDF_OPTIONS) -o bin/pdf/spec.pdf spec.md
52

53 54 55 56 57 58 59 60 61 62 63
odt-ru: spec.md
	[ -d bin/odt ] || mkdir bin/odt
	pandoc $(ODTOPTS) -o bin/odt/spec.odt spec.md

odt: odt-ru
	rm -f spec.md

docx: spec.md
	mkdir -p bin/docx
	pandoc -s -S -o bin/docx/spec.docx spec.md

64 65 66
clean:
	@echo Remove all
	rm -rf *.xml *.md bin/*