es/ markup fixes.
[gitmagic/gitmagic.git] / Makefile
blobf6e44b3dc6091b1b674984e0f850804ac075e94c
1 # The language we are building.
2 # For example, Run "make LANG=es" to build the Spanish edition.
3 LANG := en
4 SHELL := /bin/bash
6 .PHONY: target clean sync push
8 target: book book/default.css book.html book.pdf
10 # The book consists of these text files in the following order:
12 TXTFILES := preface.txt intro.txt basic.txt clone.txt branch.txt history.txt \
13 multiplayer.txt grandmaster.txt secrets.txt drawbacks.txt translate.txt
15 book.xml: $(addprefix $(LANG)/,$(TXTFILES))
16 # Concatenate the text files and feed to AsciiDoc.
17 # If a file has not yet been translated for the target language,
18 # then substitute the English version.
19 # Kludge to support any translation of "Preface".
20 echo '[specialsections]' > conf ; \
21 sed -n '/^== .* ==$$/p' $(LANG)/preface.txt | sed 's/^== \(.*\) ==$$/^\1$$=preface/' >> conf ; \
22 ( for FILE in $^ ; do if [ -f $$FILE ]; then cat $$FILE; else \
23 cat en/$$(basename $$FILE); fi; echo ; done ) | \
24 asciidoc -a lang=$(LANG) -d book -b docbook -f conf - > $@
26 # This rule allows unfinished translations to build.
27 # Report an error if the English version of the text file is missing.
28 $(addprefix $(LANG)/,$(TXTFILES)) :
29 ifeq ($(LANG),en)
30 @if [ ! -f $@ ]; then echo English file missing: $@; exit 123; fi
31 else
32 @if [ ! -f $@ ]; then echo $@ missing: using English version; fi
33 endif
35 # Ignore tidy's exit code because Asciidoc generates section IDs beginning with
36 # "_", which xmlto converts to "id" attributes of <a> tags. The standard
37 # insists that "id" attributes begin with a letter, which causes tidy to
38 # print a warning and return a nonzero code.
40 # When Asciidoc 8.3.0+ is widespread, I'll use its idprefix attribute instead
41 # of ignoring return codes.
43 book: book.xml
44 xmlto -m custom-html.xsl -o book html book.xml
45 sed -i 's/xmlns:fo[^ ]*//g' book/*.html
46 -ls book/*.html | xargs -n 1 tidy -utf8 -m -i -q
47 ./makeover
49 book/default.css: book.css
50 -mkdir book
51 rsync book.css book/default.css
53 book.html: book.xml
54 xmlto -m custom-nochunks.xsl html-nochunks $^
55 -tidy -utf8 -imq $@
57 # Set SP_ENCODING to avoid "non SGML character" errors.
58 # Can also do SP_ENCODING="UTF-8".
59 book.pdf: book.xml
60 SP_ENCODING="XML" docbook2pdf book.xml
62 clean:
63 -rm -rf book.xml book.html book
65 sync: target
66 rsync -r book.html book.pdf book/* blynn@xenon.stanford.edu:www/gitmagic/intl/$(LANG)/
68 public:
69 git push blynn@git.or.cz:srv/git/gitmagic.git
70 git push git@github.com:blynn/gitmagic.git
71 git push git@gitorious.org:gitmagic/mainline.git