3 .PHONY
: target
clean sync push
5 target
: book book
/default.css book.html book.pdf
7 # The book consists of these text files in the following order:
9 TXTFILES
:= preface.txt intro.txt basic.txt clone.txt branch.txt history.txt \
10 grandmaster.txt secrets.txt drawbacks.txt
12 book.xml
: $(addprefix $(LANG
)/,$(TXTFILES
))
13 # Kludge to make preface sections work for languages besides English.
14 echo
'[specialsections]' > conf
15 sed
-n
'/^== .* ==$$/p' $(LANG
)/preface.txt | sed
's/^== \(.*\) ==$$/^\1$$=sect-preface/' >> conf
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 ( for FILE in
$^
; do if
[ -f
$$FILE ]; then cat
$$FILE; else \
20 cat en
/$$(basename $$FILE); fi
; echo
; done
) | \
21 asciidoc
-a lang
=$(LANG
) -d book
-b docbook
-f conf
- > $@
23 # This rule allows unfinished translations to build.
24 # Report an error if the English version of the text file is missing.
25 $(addprefix $(LANG
)/,$(TXTFILES
)) :
27 @if
[ ! -f
$@
]; then echo English file missing
: $@
; exit
123; fi
29 @if
[ ! -f
$@
]; then echo
$@ missing
: using English version
; fi
32 # Ignore tidy's exit code because Asciidoc generates section IDs beginning with
33 # "_", which xmlto converts to "id" attributes of <a> tags. The standard
34 # insists that "id" attributes begin with a letter, which causes tidy to
35 # print a warning and return a nonzero code.
37 # When Asciidoc 8.3.0+ is widespread, I'll use its idprefix attribute instead
38 # of ignoring return codes.
41 xmlto
-m custom-html.xsl
-o book html book.xml
42 sed
-i
's/xmlns:fo[^ ]*//g' book
/*.html
43 -ls book
/*.html | xargs
-n
1 tidy
-utf8
-m
-i
-q
46 book
/default.css
: book.css
48 rsync book.css book
/default.css
51 xmlto
-m custom-nochunks.xsl html-nochunks
$^
54 # Set SP_ENCODING to avoid "non SGML character" errors.
55 # Can also do SP_ENCODING="UTF-8".
57 SP_ENCODING
="XML" docbook2pdf book.xml
60 -rm -rf book.xml book.html book
63 rsync
-r book.html book.pdf book
/* blynn@tl1.stanford.edu
:www
/gitmagic
/intl
/$(LANG
)/
66 git push blynn@git.or.cz
:srv
/git
/gitmagic.git
67 git push git@github.com
:blynn
/gitmagic.git