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 ( for FILE in
$^
; do cat
$$FILE ; echo
; done
) | \
18 asciidoc
-a lang
=$(LANG
) -d book
-b docbook
-f conf
- > $@
20 # Allow unfinished translations to build with this dummy rule.
21 # Report an error if we reach this rule for the English version.
22 $(addprefix $(LANG
)/,$(TXTFILES
)) :
24 echo English file missing
: $@
; exit
123
27 # Ignore tidy's exit code because Asciidoc generates section IDs beginning with
28 # "_", which xmlto converts to "id" attributes of <a> tags. The standard
29 # insists that "id" attributes begin with a letter, which causes tidy to
30 # print a warning and return a nonzero code.
32 # When Asciidoc 8.3.0+ is widespread, I'll use its idprefix attribute instead
33 # of ignoring return codes.
36 xmlto
-m custom-html.xsl
-o book html book.xml
37 sed
-i
's/xmlns:fo[^ ]*//g' book
/*.html
38 -ls book
/*.html | xargs
-n
1 tidy
-utf8
-m
-i
-q
41 book
/default.css
: book.css
43 rsync book.css book
/default.css
46 xmlto
-m custom-nochunks.xsl html-nochunks
$^
49 # Set SP_ENCODING to avoid "non SGML character" errors.
50 # Can also do SP_ENCODING="UTF-8".
52 SP_ENCODING
="XML" docbook2pdf book.xml
55 -rm -rf book.xml book.html book
58 rsync
-r book.html book.pdf book
/* blynn@tl1.stanford.edu
:www
/gitmagic
/intl
/$(LANG
)/
61 git push blynn@git.or.cz
:srv
/git
/gitmagic.git
62 git push git@github.com
:blynn
/gitmagic.git