minor edit in ru/branch.txt
[gitmagic/gitmagic.git] / Makefile
blob3fade508774c5c67115fb9c64132b4b189790968
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 make preface sections work for languages besides English
20 # for older AsciiDoc versions.
21 if [[ `asciidoc --version | cut -f 2 -d ' '` < "8.4.5" ]]; then \
22 echo '[specialsections]' > conf ; \
23 sed -n '/^== .* ==$$/p' $(LANG)/preface.txt | sed 's/^== \(.*\) ==$$/^\1$$=sect-preface/' >> conf ; \
24 else echo "" > conf ; fi; \
25 ( for FILE in $^ ; do if [ -f $$FILE ]; then cat $$FILE; else \
26 cat en/$$(basename $$FILE); fi; echo ; done ) | \
27 asciidoc -a lang=$(LANG) -d book -b docbook -f conf - > $@
29 # This rule allows unfinished translations to build.
30 # Report an error if the English version of the text file is missing.
31 $(addprefix $(LANG)/,$(TXTFILES)) :
32 ifeq ($(LANG),en)
33 @if [ ! -f $@ ]; then echo English file missing: $@; exit 123; fi
34 else
35 @if [ ! -f $@ ]; then echo $@ missing: using English version; fi
36 endif
38 # Ignore tidy's exit code because Asciidoc generates section IDs beginning with
39 # "_", which xmlto converts to "id" attributes of <a> tags. The standard
40 # insists that "id" attributes begin with a letter, which causes tidy to
41 # print a warning and return a nonzero code.
43 # When Asciidoc 8.3.0+ is widespread, I'll use its idprefix attribute instead
44 # of ignoring return codes.
46 book: book.xml
47 xmlto -m custom-html.xsl -o book html book.xml
48 sed -i 's/xmlns:fo[^ ]*//g' book/*.html
49 -ls book/*.html | xargs -n 1 tidy -utf8 -m -i -q
50 ./makeover
52 book/default.css: book.css
53 -mkdir book
54 rsync book.css book/default.css
56 book.html: book.xml
57 xmlto -m custom-nochunks.xsl html-nochunks $^
58 -tidy -utf8 -imq $@
60 # Set SP_ENCODING to avoid "non SGML character" errors.
61 # Can also do SP_ENCODING="UTF-8".
62 book.pdf: book.xml
63 SP_ENCODING="XML" docbook2pdf book.xml
65 clean:
66 -rm -rf book.xml book.html book
68 sync: target
69 rsync -r book.html book.pdf book/* blynn@xenon.stanford.edu:www/gitmagic/intl/$(LANG)/
71 public:
72 git push blynn@git.or.cz:srv/git/gitmagic.git
73 git push git@github.com:blynn/gitmagic.git
74 git push git@gitorious.org:gitmagic/mainline.git