ebe9346b4ba023e4c2446925a21a509ce88c79c1
[clqr.git] / Makefile
blobebe9346b4ba023e4c2446925a21a509ce88c79c1
1 # Copyright (C) 2008, 2009, 2010, 2011 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 or any later version published by the Free Software
6 # Foundation; with no Invariant Sections, no Front-Cover Texts and
7 # no Back-Cover Texts. For details see file COPYING.
9 CLQR = clqr
10 SEND-TO-LOG = | tee -a lastbuild.log
12 LATEX = latex
13 MAKEINDEX = makeindex -c
14 MPOST = TEX=latex mpost
15 DVIPS = dvips
16 PSNUP-A4 = psnup -W10.5cm -H29.7cm -pa4 -2
17 PSNUP-LETTER = psnup -W4.25in -H11in -pletter -2
18 PSBOOK-ALL = psbook
19 PSBOOK-FOUR = psbook -s4
20 PS2PDF = ps2pdf -dPDFSETTINGS=/prepress
21 CONVERT = convert
22 MONTAGE = montage
23 HEAD = head
24 TAIL = tail
25 TOUCH = touch
26 CP = cp --verbose
27 RM = rm --force --verbose
28 MV = mv --force --verbose
29 MAKE = make
30 GZIP = gzip
31 GIT_REVISION = git describe | sed 's/\(.*-.*\)-.*/\1/'
32 GIT_ARCHIVE = git archive --format=tar --prefix=$(CLQR)/ HEAD | $(GZIP)
33 GIT_LOG = git log
34 DATE = git log HEAD^..HEAD --date=short | awk '/Date:/{print $$2}' | tr -d '\n\\'
35 RSYNC = rsync -va
36 SSH = ssh
38 all: letter a4
40 letter:
41 $(MAKE) letter-booklets
42 $(MAKE) $(CLQR)-letter-consec.pdf
44 a4:
45 $(MAKE) a4-booklets
46 $(MAKE) $(CLQR)-a4-consec.pdf
48 letter-booklets: $(CLQR)-letter-booklet-all.pdf $(CLQR)-letter-booklet-four.pdf
50 a4-booklets: $(CLQR)-a4-booklet-all.pdf $(CLQR)-a4-booklet-four.pdf
52 $(CLQR)-%-consec.pdf: $(CLQR)-%-consec.ps
53 $(PS2PDF) $< $@ $(SEND-TO-LOG)
55 $(CLQR)-letter-booklet-%.pdf: $(CLQR)-letter-booklet-%.ps
56 $(PS2PDF) -sPAPERSIZE=letter $< $@ $(SEND-TO-LOG)
58 $(CLQR)-a4-booklet-%.pdf: $(CLQR)-a4-booklet-%.ps
59 $(PS2PDF) -sPAPERSIZE=a4 $< $@ $(SEND-TO-LOG)
61 $(CLQR)-letter-booklet-%.ps: $(CLQR)-letter-signature-%.ps color-black.flag
62 $(PSNUP-LETTER) $< > $@ $(SEND-TO-LOG)
64 $(CLQR)-a4-booklet-%.ps: $(CLQR)-a4-signature-%.ps color-black.flag
65 $(PSNUP-A4) $< > $@ $(SEND-TO-LOG)
67 $(CLQR)-%-signature-all.ps: $(CLQR)-%-consec.ps
68 $(PSBOOK-ALL) $< $@ $(SEND-TO-LOG)
70 $(CLQR)-%-signature-four.ps: $(CLQR)-%-consec.ps
71 $(PSBOOK-FOUR) $< $@ $(SEND-TO-LOG)
73 $(CLQR)-%-consec.ps: $(CLQR)-%.dvi color-colorful.flag
74 $(DVIPS) -o $@ $< $(SEND-TO-LOG)
76 $(CLQR)-%.dvi: $(CLQR).tex $(CLQR)-*.tex $(CLQR).*.tex $(CLQR)-types-and-classes.1 paper-%.flag revision-number
77 $(TOUCH) $(CLQR).ind $(SEND-TO-LOG)
78 $(LATEX) $(CLQR).tex $(SEND-TO-LOG)
79 $(LATEX) $(CLQR).tex $(SEND-TO-LOG)
80 $(MAKEINDEX) -s $(CLQR).ist $(CLQR).idx $(SEND-TO-LOG)
81 $(LATEX) $(CLQR).tex $(SEND-TO-LOG)
82 $(MV) $(CLQR).dvi $@ $(SEND-TO-LOG)
84 $(CLQR)-types-and-classes.1 $(CLQR)-types-and-classes.2 \
85 $(CLQR)-types-and-classes.3 $(CLQR)-types-and-classes.4 \
86 $(CLQR)-types-and-classes.5: $(CLQR)-types-and-classes.mp $(CLQR).macros.tex clqr.packages.tex
87 $(MPOST) $< $(SEND-TO-LOG)
89 paper-a4.flag:
90 $(CP) paper-a4.tex paper-current.tex $(SEND-TO-LOG)
91 $(RM) paper-letter.flag $(SEND-TO-LOG)
92 $(TOUCH) $@
94 paper-letter.flag:
95 $(CP) paper-letter.tex paper-current.tex $(SEND-TO-LOG)
96 $(RM) paper-a4.flag $(SEND-TO-LOG)
97 $(TOUCH) $@
99 color-colorful.flag:
100 $(CP) color-colorful.tex color-current.tex $(SEND-TO-LOG)
101 $(RM) color-black.flag $(SEND-TO-LOG)
102 $(TOUCH) $@
104 color-black.flag:
105 $(CP) color-black.tex color-current.tex $(SEND-TO-LOG)
106 $(RM) color-colorful.flag $(SEND-TO-LOG)
107 $(TOUCH) $@
109 revision-number:
110 $(GIT_REVISION) | tee REVISION.tex > html/release-revision.txt
111 $(DATE) | tee DATE.tex > html/release-date.txt
113 clean:
114 $(RM) *.dvi *.toc *.aux *.log *.idx *.ilg *.ind *.out *.ps *.pdf *~ html/*~ \
115 *.flag *.jpg html/*.jpg *.tar.gz REVISION.tex DATE.tex \
116 html/latest-changes.html html/release-revision.txt html/release-date.txt \
117 *.[12345] *.mpx mpxerr.tex paper-current.tex color-current.tex
118 $(RM) -r gh-pages
121 # Project hosting, Berlios
123 publish:
124 $(MAKE) html/sample-frontcover.jpg \
125 html/sample-firstpage-all.jpg html/sample-firstpage-four.jpg \
126 html/sample-firstpage-consec.jpg html/sample-source.jpg \
127 html/latest-changes.html \
128 $(CLQR).tar.gz
129 $(MAKE) letter a4
130 $(MAKE) publishclean
131 $(RSYNC) --delete ./ trebb@shell.berlios.de:/home/groups/ftp/pub/clqr/clqr/ $(SEND-TO-LOG)
132 $(RSYNC) ./html/ trebb@shell.berlios.de:/home/groups/clqr/htdocs/ $(SEND-TO-LOG)
134 html/sample-frontcover.jpg: $(CLQR)-a4-consec.pdf
135 $(CONVERT) $<'[0]' -verbose -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 html/sample-firstpage-%.jpg: $(CLQR)-a4-booklet-%.pdf
140 $(CONVERT) $<'[0]' -verbose -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 html/sample-firstpage-consec.jpg: $(CLQR)-a4-consec.pdf
145 $(CONVERT) $<'[0]' -verbose -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 html/sample-source.jpg: $(CLQR)-numbers.tex
150 $(HEAD) -n 57 $< | $(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 html/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 # Github
159 gh-publish:
160 $(RM) -r gh-pages
161 mkdir gh-pages
162 $(MAKE) gh-pages/$(CLQR)-a4-booklet-all.pdf \
163 gh-pages/$(CLQR)-a4-booklet-four.pdf \
164 gh-pages/$(CLQR)-a4-consec.pdf \
165 gh-pages/$(CLQR)-letter-booklet-all.pdf \
166 gh-pages/$(CLQR)-letter-booklet-four.pdf \
167 gh-pages/$(CLQR)-letter-consec.pdf \
168 gh-pages/sample-frontcover.jpg \
169 gh-pages/sample-firstpage-all.jpg \
170 gh-pages/sample-firstpage-four.jpg \
171 gh-pages/sample-firstpage-consec.jpg \
172 gh-pages/sample-source.jpg \
173 gh-pages/$(CLQR).tar.gz \
174 gh-pages/404.html \
175 gh-pages/CNAME \
176 gh-pages/README \
177 gh-pages/download.html \
178 gh-pages/favicon.ico \
179 gh-pages/index.html \
180 gh-pages/license.html \
181 gh-pages/new-pure.css \
182 gh-pages/printing.html \
183 gh-pages/robots.txt \
184 gh-pages/source.html
185 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
187 gh-pages/sample-%.jpg: html/sample-%.jpg
188 $(CP) $< $@
190 gh-pages/index.html: html-template/index.html html/latest-changes.html
191 sed -e "/<h3>Latest Changes<\/h3>/ r html/latest-changes.html" html-template/index.html > $@
193 gh-pages/download.html: html-template/download.html revision-number
194 sed -e "/This is revision/ r REVISION.tex" -e "/<!- date of commit \/>/ r DATE.tex" html-template/download.html > $@
196 gh-pages/%.pdf: %.pdf
197 $(CP) $< $@
199 gh-pages/%.tar.gz: %.tar.gz
200 $(CP) $< $@
202 gh-pages/%: html-template/%
203 $(CP) $< $@
205 $(CLQR).tar.gz: $(CLQR).tex $(CLQR)-*.tex
206 if $(GIT_ARCHIVE) > $(CLQR).tar.gz; then true; else true; fi $(SEND-TO-LOG)
208 publishclean:
209 $(RM) $(CLQR).{aux,idx,ilg,ind,log,out,toc} *.ps *.dvi $(CLQR)-types-and-classes.{log,mpx,1,2,3,4,5} *~ html/*~