Can build partially translated Spanish version.
[gitmagic/gitmagic.git] / Makefile
blob76b40a5b82905593557c5b686b0539b7f91ce6f0
1 LANG := en
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 # Ignore tidy's exit code because Asciidoc generates section IDs beginning with
21 # "_", which xmlto converts to "id" attributes of <a> tags. The standard
22 # insists that "id" attributes begin with a letter, which causes tidy to
23 # print a warning and return a nonzero code.
25 # When Asciidoc 8.3.0+ is widespread, I'll use its idprefix attribute instead
26 # of ignoring return codes.
28 book: book.xml
29 xmlto -m custom-html.xsl -o book html book.xml
30 sed -i 's/xmlns:fo[^ ]*//g' book/*.html
31 -ls book/*.html | xargs -n 1 tidy -utf8 -m -i -q
32 ./makeover
34 book/default.css: book.css
35 -mkdir book
36 rsync book.css book/default.css
38 book.html: book.xml
39 xmlto -m custom-nochunks.xsl html-nochunks $^
40 -tidy -utf8 -imq $@
42 # Set SP_ENCODING to avoid "non SGML character" errors.
43 # Can also do SP_ENCODING="UTF-8".
44 book.pdf: book.xml
45 SP_ENCODING="XML" docbook2pdf book.xml
47 clean:
48 -rm -rf book.xml book.html book
50 sync: target
51 rsync -r book.html book.pdf book/* blynn@tl1.stanford.edu:www/gitmagic/intl/$(LANG)/
53 public:
54 git push blynn@git.or.cz:srv/git/gitmagic.git
55 git push git@github.com:blynn/gitmagic.git