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 CONF
=lang-
$(LANG
).conf
; [ -f
$$CONF ] || CONF
=lang-en.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
)) :
30 @if
[ ! -f
$@
]; then echo English file missing
: $@
; exit
123; fi
32 @if
[ ! -f
$@
]; then echo
$@ missing
: using English version
; fi
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.
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
49 book
/default.css
: book.css
51 rsync book.css book
/default.css
54 xmlto
-m custom-nochunks.xsl html-nochunks
$^
57 # Set SP_ENCODING to avoid "non SGML character" errors.
58 # Can also do SP_ENCODING="UTF-8".
60 SP_ENCODING
="XML" docbook2pdf book.xml
63 -rm -rf book.xml book.html book
66 rsync
-r book.html book.pdf book
/* blynn@xenon.stanford.edu
:www
/gitmagic
/intl
/$(LANG
)/
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