1 # The language we are building.
2 # For example, Run "make LANG=es" to build the Spanish edition.
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
)) :
33 @if
[ ! -f
$@
]; then echo English file missing
: $@
; exit
123; fi
35 @if
[ ! -f
$@
]; then echo
$@ missing
: using English version
; fi
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.
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
52 book
/default.css
: book.css
54 rsync book.css book
/default.css
57 xmlto
-m custom-nochunks.xsl html-nochunks
$^
60 # Set SP_ENCODING to avoid "non SGML character" errors.
61 # Can also do SP_ENCODING="UTF-8".
63 SP_ENCODING
="XML" docbook2pdf book.xml
66 -rm -rf book.xml book.html book
69 rsync
-r book.html book.pdf book
/* blynn@xenon.stanford.edu
:www
/gitmagic
/intl
/$(LANG
)/
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