Fix bugs reported by Fengjing Xiao
[clqr.git] / Makefile
blobc5bec0971f47271654a208cb7d664fff5a0bb6b3
1 # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014 Bert Burgemeister
3 # Permission is granted to copy, distribute and/or modify this
4 # document under the terms of the GNU Free Documentation License,
5 # Version 1.2; with no Invariant Sections, no Front-Cover Texts and
6 # no Back-Cover Texts. For details see file COPYING.
8 SEND-TO-LOG = | tee -a lastbuild.log
10 LATEX = latex
11 MAKEINDEX = makeindex -c
12 MPOST = TEX=latex mpost
13 DVIPS = dvips
14 PSNUP-A4 = psnup -W10.5cm -H29.7cm -pa4 -2
15 PSNUP-LETTER = psnup -W4.25in -H11in -pletter -2
16 PSBOOK-ALL = psbook
17 PSBOOK-FOUR = psbook -s4
18 PS2PDF = ps2pdf -dPDFSETTINGS=/prepress
19 CONVERT = convert
20 MONTAGE = montage
21 HEAD = head
22 TAIL = tail
23 TOUCH = touch
24 CP = cp -v
25 RM = rm -f -v
26 MV = mv -f -v
27 # trying to find GNU Make
28 MAKE = `which gmake || which make`
29 GZIP = gzip
30 GIT_REVISION = git describe | sed 's/\(.*-.*\)-.*/\1/'
31 GIT_ARCHIVE = git archive --format=tar --prefix=clqr/ HEAD | $(GZIP)
32 GIT_LOG = git log
33 DATE = git log HEAD^..HEAD --date=short | awk '/Date:/{print $$2}' | tr -d '\n\\'
35 all: letter a4
37 letter:
38 $(MAKE) letter-booklets
39 $(MAKE) clqr-letter-consec.pdf
41 a4:
42 $(MAKE) a4-booklets
43 $(MAKE) clqr-a4-consec.pdf
45 letter-booklets: clqr-letter-booklet-all.pdf clqr-letter-booklet-four.pdf
47 a4-booklets: clqr-a4-booklet-all.pdf clqr-a4-booklet-four.pdf
49 clqr-letter-consec.pdf: clqr-letter-consec.ps
50 $(PS2PDF) $< $@ $(SEND-TO-LOG)
52 clqr-a4-consec.pdf: clqr-a4-consec.ps
53 $(PS2PDF) $< $@ $(SEND-TO-LOG)
55 clqr-letter-booklet-%.pdf: clqr-letter-booklet-%.ps paper-letter.flag
56 $(PS2PDF) -sPAPERSIZE=letter $< $@ $(SEND-TO-LOG)
58 clqr-a4-booklet-%.pdf: clqr-a4-booklet-%.ps paper-a4.flag
59 $(PS2PDF) -sPAPERSIZE=a4 $< $@ $(SEND-TO-LOG)
61 clqr-letter-booklet-%.ps: clqr-letter-signature-%.ps
62 $(PSNUP-LETTER) $< > $@ $(SEND-TO-LOG)
64 clqr-a4-booklet-%.ps: clqr-a4-signature-%.ps
65 $(PSNUP-A4) $< > $@ $(SEND-TO-LOG)
67 clqr-%-signature-all.ps: clqr-%-consec-black.ps
68 $(PSBOOK-ALL) $< $@ $(SEND-TO-LOG)
70 clqr-%-signature-four.ps: clqr-%-consec-black.ps
71 $(PSBOOK-FOUR) $< $@ $(SEND-TO-LOG)
73 clqr-%-consec.ps: clqr-%-colorful.dvi
74 $(DVIPS) -o $@ $< $(SEND-TO-LOG)
76 clqr-%-consec-black.ps: clqr-%-black.dvi
77 $(DVIPS) -o $@ $< $(SEND-TO-LOG)
79 clqr-%-colorful.dvi: clqr.tex clqr-*.tex clqr.*.tex clqr-types-and-classes.1 paper-%.flag revision-number color-colorful.flag
80 $(TOUCH) clqr.ind $(SEND-TO-LOG)
81 $(LATEX) clqr.tex $(SEND-TO-LOG)
82 $(LATEX) clqr.tex $(SEND-TO-LOG)
83 $(MAKEINDEX) -s clqr.ist clqr.idx $(SEND-TO-LOG)
84 $(LATEX) clqr.tex $(SEND-TO-LOG)
85 $(MV) clqr.dvi $@ $(SEND-TO-LOG)
87 clqr-%-black.dvi: clqr.tex clqr-*.tex clqr.*.tex clqr-types-and-classes.1 paper-%.flag revision-number color-black.flag
88 $(TOUCH) clqr.ind $(SEND-TO-LOG)
89 $(LATEX) clqr.tex $(SEND-TO-LOG)
90 $(LATEX) clqr.tex $(SEND-TO-LOG)
91 $(MAKEINDEX) -s clqr.ist clqr.idx $(SEND-TO-LOG)
92 $(LATEX) clqr.tex $(SEND-TO-LOG)
93 $(MV) clqr.dvi $@ $(SEND-TO-LOG)
95 clqr-types-and-classes.1 clqr-types-and-classes.2 \
96 clqr-types-and-classes.3 clqr-types-and-classes.4 \
97 clqr-types-and-classes.5: clqr-types-and-classes.mp clqr.macros.tex clqr.packages.tex
98 $(MPOST) $< $(SEND-TO-LOG)
100 paper-a4.flag:
101 $(CP) paper-a4.tex paper-current.tex $(SEND-TO-LOG)
102 $(RM) paper-letter.flag $(SEND-TO-LOG)
103 $(TOUCH) $@
105 paper-letter.flag:
106 $(CP) paper-letter.tex paper-current.tex $(SEND-TO-LOG)
107 $(RM) paper-a4.flag $(SEND-TO-LOG)
108 $(TOUCH) $@
110 color-colorful.flag:
111 $(CP) color-colorful.tex color-current.tex $(SEND-TO-LOG)
112 $(RM) color-black.flag $(SEND-TO-LOG)
113 $(TOUCH) $@
115 color-black.flag:
116 $(CP) color-black.tex color-current.tex $(SEND-TO-LOG)
117 $(RM) color-colorful.flag $(SEND-TO-LOG)
118 $(TOUCH) $@
120 revision-number:
121 $(GIT_REVISION) | tee REVISION.tex > release-revision.txt
122 $(DATE) | tee DATE.tex > release-date.txt
124 clean:
125 $(RM) *.dvi *.toc *.aux *.log *.idx *.ilg *.ind *.out *.ps *.pdf *~ \
126 *.flag *.jpg *.jpg *.tar.gz REVISION.tex DATE.tex \
127 latest-changes.html release-revision.txt release-date.txt \
128 *.[12345] *.mpx mpxerr.tex paper-current.tex color-current.tex
129 $(RM) -r gh-pages
132 # Project hosting, Github
134 sample-frontcover.jpg: clqr-a4-consec.pdf
135 $(CONVERT) $<'[0]' -verbose -background white -alpha remove -alpha off -resize 40% temp.jpg $(SEND-TO-LOG)
136 $(MONTAGE) temp.jpg -tile 1x1 -geometry +1+1 -background gray $@ $(SEND-TO-LOG)
137 $(RM) temp.jpg
139 sample-firstpage-%.jpg: clqr-a4-booklet-%.pdf
140 $(CONVERT) $<'[0]' -verbose -background white -alpha remove -alpha off -resize 15% temp.jpg $(SEND-TO-LOG)
141 $(MONTAGE) temp.jpg -tile 1x1 -geometry +1+1 -background gray $@ $(SEND-TO-LOG)
142 $(RM) temp.jpg
144 sample-firstpage-consec.jpg: clqr-a4-consec.pdf
145 $(CONVERT) $<'[0]' -verbose -background white -alpha remove -alpha off -resize 15% temp.jpg $(SEND-TO-LOG)
146 $(MONTAGE) temp.jpg -tile 1x1 -geometry +1+1 -background gray $@ $(SEND-TO-LOG)
147 $(RM) temp.jpg
149 sample-source.jpg: clqr-numbers.tex
150 $(HEAD) -n 59 $< | $(TAIL) -n 40 | $(CONVERT) -font Courier -crop 120x80+30+2 +repage label:@- temp.jpg $(SEND-TO-LOG)
151 $(MONTAGE) temp.jpg -tile 1x1 -geometry +1+1 -background gray $@ $(SEND-TO-LOG)
152 $(RM) temp.jpg
154 latest-changes.html: clqr.tex clqr-*.tex
155 if $(GIT_LOG) -5 --pretty=format:"<p><i>%ci</i>%n<br />%s%n<br />%b</p>" > $@; then true; else true; fi $(SEND-TO-LOG)
157 gh-publish:
158 $(RM) -r gh-pages
159 mkdir gh-pages
160 $(MAKE) all
161 $(CP) clqr-a4-consec.pdf gh-pages/
162 $(CP) clqr-letter-consec.pdf gh-pages/
163 $(CP) clqr-a4-booklet-all.pdf gh-pages/
164 $(CP) clqr-a4-booklet-four.pdf gh-pages/
165 $(CP) clqr-letter-booklet-all.pdf gh-pages/
166 $(CP) clqr-letter-booklet-four.pdf gh-pages/
167 $(MAKE) gh-pages/sample-frontcover.jpg \
168 gh-pages/sample-firstpage-all.jpg \
169 gh-pages/sample-firstpage-four.jpg \
170 gh-pages/sample-firstpage-consec.jpg \
171 gh-pages/sample-source.jpg \
172 gh-pages/clqr.tar.gz \
173 gh-pages/404.html \
174 gh-pages/CNAME \
175 gh-pages/README \
176 gh-pages/download.html \
177 gh-pages/favicon.ico \
178 gh-pages/index.html \
179 gh-pages/license.html \
180 gh-pages/new-pure.css \
181 gh-pages/printing.html \
182 gh-pages/robots.txt \
183 gh-pages/source.html
184 cd gh-pages; git init; git add ./; git commit -a -m "gh-pages pseudo commit"; git push git@github.com:trebb/clqr.git +master:gh-pages
186 gh-pages/sample-%.jpg: sample-%.jpg
187 $(CP) $< $@
189 gh-pages/index.html: html-template/index.html latest-changes.html
190 sed -e "/<h3>Latest Changes<\/h3>/ r latest-changes.html" html-template/index.html > $@
192 gh-pages/download.html: html-template/download.html revision-number
193 sed -e "/This is revision/ r REVISION.tex" -e "/<!- date of commit \/>/ r DATE.tex" html-template/download.html > $@
195 gh-pages/%.tar.gz: %.tar.gz
196 $(CP) $< $@
198 gh-pages/%: html-template/%
199 $(CP) $< $@
201 clqr.tar.gz: clqr.tex clqr-*.tex
202 if $(GIT_ARCHIVE) > clqr.tar.gz; then true; else true; fi $(SEND-TO-LOG)