rev: tip ews/Hauptdokument/ews30/Makefile.am -rw-r--r-- 36.0 KiB View raw Log this file
fb7136a1ffb2Arne Babenhauserheide Brocken -> Planeten: vermeidet Schwerkraftfragen 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
ews =
# the data directory. Users can set this via --prefix: @datarootdir@ = PREFIX/share. See ./ewsigure --help
ewsdir = @datarootdir@/ews
# the data I need
tables = tabelle-kernantriebe.org tabelle-fragen.org tabelle-namen.org tabelle-zwei-worte.org tabelle-darstellung.org tabelle-aussehen.org table-sexualitaet.org table-stichwort.org tabelle-kleidung.org tabelle-wahrscheinlichkeiten-1.org tabelle-wahrscheinlichkeiten-2.org
english_tables = english-tabelle-kernantriebe.org english-tabelle-fragen.org english-tabelle-namen.org english-tabelle-zwei-worte.org english-tabelle-darstellung.org english-tabelle-aussehen.org english-table-sexualitaet.org english-table-stichwort.org english-tabelle-kleidung.org english-tabelle-wahrscheinlichkeiten-1.org english-tabelle-wahrscheinlichkeiten-2.org
ews_DATA = edit.sh ewstitle.tex variables.tex chargentitle.tex english-chargentitle.tex basesetup.tex ews30setup.tex ews30setup.el uniinput.sty ews.gst apalike-refs-de.bst charheft.sla $(wildcard *.png) $(wildcard *.JPG) $(wildcard *.jpg) $(wildcard *.svg) $(wildcard .emacs.d/*) $(wildcard .emacs.d/*/*)
# $(wildcard .emacs.d/elpa/*/*) $(wildcard .emacs.d/elpa/*/*/*)
ews_SOURCES = ews.org $(tables) liste-berufe.org liste-fertigkeiten.org liste-staerken.org liste-schwaechen.org liste-ausruestung.org  liste-vorteile.org liste-nachteile.org ARTISTS.org konvertierung-voodoo.org chargen.org english-chargen.org template.org charzettel-technophob.org
# all the tables as a booklet
ewstables = 
ewstablesdir = @datarootdir@/ews
ewstables_DATA = tabellentitle.tex english-tabellentitle.tex
ewstables_SOURCES = tabellen.org english-tabellen.org $(tables) $(english_tables)
# generic data for all kinds of projects
# include the data in the distribution tarball
EXTRA_DIST = $(ews_DATA) $(ews_SOURCES) $(ewstables_DATA) $(ewstables_SOURCES) ews.pdf ews-screen.pdf charheft.pdf charheft-nina.pdf charheft-screen.pdf charheft-drucken.pdf ews.html ews.epub autogen.sh chargen.pdf english-chargen.pdf ewstitle-taschenbuch.pdf ewstitle-taschenbuch-back.pdf ews-taschenbuch.pdf ews-thumb.png ews-thumb-104x158.png .release-$(VERSION) $(IMAGES_MIRRORED)
CLEANFILES = ./ews30setup.aux ./ews.aux ./ews.glo ./ews.gls ./ews.idx ./ews.ilg ./ews.ind ./ews.log ./ews.out ./ews.tex  ./ews.bbl ./ews.blg ./ews.toc ./ews.lot  ./template.aux ./template.glo ./template.gls ./template.idx ./template.ilg ./template.ind ./template.log ./template.out ./template.tex  ./template.bbl ./template.blg ./template.toc ./template.lot ./ewstitle.aux ./ewstitle.log ./ewstitle.out ./ewstitle.pdf  build.log ./tabellen.aux ./tabellen.aux ./tabellen.log ./tabellen.glo ./tabellen.idx ./tabellen.out ./tabellen.tex ./tabellen.toc ./tabellentitle.log ./tabellentitle.out ./chargentitle.out $(wildcard *~) ./chargen.glo ./chargen.log ./chargen.out ./chargen.idx ./chargen.toc ./chargen.lot ./chargentitle.pdf ./chargen-screen.pdf ./chargentitle.log ./chargen.tex ./english-chargentitle.out $(wildcard *~) ./english-chargen.glo ./english-chargen.log ./english-chargen.out ./english-chargen.idx ./english-chargen.toc ./english-chargen.lot ./english-chargentitle.pdf ./english-chargen-screen.pdf ./english-chargentitle.log ./english-chargen.tex ./template.pdf
DISTCLEANFILES = ews.pdf ews-screen.pdf ews.html template.pdf tabellen.pdf english-tabellen.pdf ./ews.epub ./charheft.pdf ./charheft-nina.pdf $(wildcard ./ews.html*) ./charheft-screen.pdf ./charheft-drucken.pdf ./tabellen-drucken.pdf ./tabellentitle.pdf ./tabellen-nup.pdf ./ews-drucken.pdf chargen.pdf ./english-tabellen.out ./english-tabellen.toc ./english-tabellen.tex ./english-tabellen-drucken.pdf ./english-tabellen.log ./english-tabellentitle.log ./english-chargen-drucker.pdf ./english-tabellen.idx ./english-tabellen.glo ./english-tabellentitle.out ./english-chargen.pdf ./english-tabellen-nup.pdf ./english-tabellentitle.pdf  kein\ Terminal ./ewstitle-taschenbuch.pdf ./ews-taschenbuch.pdf ./ews-thumb.png ./ews-thumb-104x158.png ./ewstitle-taschenbuch-back.pdf ./chargen-drucker.pdf ./chargen-taschenformat.pdf ./english-chargen-taschenformat.pdf ./ews30-raE-taschenbuch.pdf .release-$(VERSION) ews$$(echo $(VERSION) | sed s/\\.//)-thumb-104x158.png ews$$(echo $(VERSION) | sed s/\\.//)-thumb.png ews$$(echo $(VERSION) | sed s/\\.//)-taschenbuch.pdf ews$$(echo $(VERSION) | sed s/\\.//)-tabellen-nup.pdf ews$$(echo $(VERSION) | sed s/\\.//)-screen.pdf ews$$(echo $(VERSION) | sed s/\\.//)-chargen-taschenformat.pdf ews$$(echo $(VERSION) | sed s/\\.//)-charheft-drucken.pdf $(IMAGES_MIRRORED)


# images matched via wildcard are included via configure.ac!
IMAGES = $(IMAGES_MIRRORED) seitenzahl-balken-2020-trudy.pdf $(wildcard *jpg) $(wildcard *.png) $(wildcard *.JPG)

all: ews.html ews-screen.pdf ews-taschenbuch.pdf ews-drucken.pdf ews.epub charheft-drucken.pdf tabellen.pdf tabellen-drucken.pdf tabellen-nup.pdf english-tabellen-nup.pdf chargen-taschenformat.pdf english-chargen-taschenformat.pdf ChangeLog AUTHORS ews-thumb.png ews-thumb-104x158.png

.release-$(VERSION): ews-thumb-104x158.png ews-thumb.png ews-taschenbuch.pdf tabellen-nup.pdf ews-screen.pdf chargen-taschenformat.pdf charheft-drucken.pdf
	cp ews-thumb-104x158.png ews$$(echo $(VERSION) | sed s/\\.//)-thumb-104x158.png
	cp ews-thumb.png ews$$(echo $(VERSION) | sed s/\\.//)-thumb.png
	cp ews-taschenbuch.pdf ews$$(echo $(VERSION) | sed s/\\.//)-taschenbuch.pdf
	cp tabellen-nup.pdf ews$$(echo $(VERSION) | sed s/\\.//)-tabellen-nup.pdf
	cp ews-screen.pdf ews$$(echo $(VERSION) | sed s/\\.//)-screen.pdf
	cp chargen-taschenformat.pdf ews$$(echo $(VERSION) | sed s/\\.//)-chargen-taschenformat.pdf
	cp charheft-drucken.pdf ews$$(echo $(VERSION) | sed s/\\.//)-charheft-drucken.pdf
	touch $@

ews.html: ews.org ews30setup.el $(IMAGES) ## create the html version
	echo yes > $$(tty) ; Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 HOME=@abs_top_srcdir@ @EMACS@ -q --load "@abs_top_srcdir@/.emacs.d/init.el" -l @abs_top_srcdir@/ews30setup.el --eval '(setq vc-follow-symlinks nil)' "$<" -e org-html-export-to-html -e kill-emacs < $$(tty) >> build.log && (test -e $@ && touch $@ || mv -f ews.html $@ || true)

ews.epub : ews.html ## create epub for ebook readers
	@ebookconvert@ $< $@   --title "Ein-Würfel-System \\ konkret und direkt \\ einfach saubere Regeln"  --no-default-epub-cover  --pretty-print --language english --output-profile=generic_eink

ews-screen.pdf: ews.pdf pdfmeta ## create the screen-optimized PDF
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -r600 -g2949x4484 -dPDFFitPage -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress  -dColorImageResolution=150 -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

ews-drucken.pdf: ews.pdf pdfmeta ## create the PDF with fonts as outlines
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dColorImageResolution=600 -dNoOutputFonts -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

# TODO: set geometry in ews.org and ews30setup.tex
ews-taschenbuch.pdf: ews.pdf Makefile.am pdfmeta ## create the epubli-cheap-printing PDF
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -r600 -g2949x4484 -dPDFFitPage -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/printer -dColorImageResolution=600 -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta

ews-cheat-sheet-taschenformat.pdf: ews.pdf Makefile.am ## short rules for the home printer
	PAGE=$$(pdfgrep -n "Kurz und Knapp:" "$<" | cut -d : -f 1); pdfjam --nup 2x2 --no-landscape --outfile "$@" "$<" $${PAGE}-$$((($${PAGE} + 6))),1 && sed -i 's,/CreationDate (D.*),/CreationDate (D:19700101000000+01'"'00'"'),;s,/ModDate (D.*),/ModDate (D:19700101000000+01'"'00'"'),;s,/ID \[.*\],/ID [<0123456789ABCDEF0123456789ABCDEF> <0123456789ABCDEF0123456789ABCDEF>],;/PTEX\.FileName (/ s,., ,g' "$@"




ews.pdf: ews.tex basesetup.tex ews30setup.tex ewstitle.pdf ews.gst charheft.pdf charheft-nina.pdf $(IMAGES) ## create the printable PDF
	rm -f *.aux && echo "get rid of potential leftover files from broken compilations, this slows down the compilation, but avoids problems" && \
	timeout 30 pdflatex  -interaction=nonstopmode "$<" ; echo "workaround for pdflatex stall on first run which I could not solve yet" && \
	bibtex "$(basename $<)" && \
	makeindex "$(basename $<)" && \
	makeindex -s "$(basename $<).gst" -o "$(basename $<).gls" "$(basename $<).glo" && \
	timeout 360 pdflatex  -interaction=nonstopmode "$<" ; echo "workaround for pdflatex stall on first run which I could not solve yet" && \
	timeout 360 pdflatex  -interaction=nonstopmode "$<" ; echo "multiple times because it works. TODO: why? I assume that's some caching, but still I don't really know why."; \
	rm ews.aux ; \
	makeindex "$(basename $<)" && \
	makeindex -s "$(basename $<).gst" -o "$(basename $<).gls" "$(basename $<).glo" && \
	timeout 360 pdflatex  -interaction=nonstopmode "$<" ; \
	timeout 360 bibtex "$(basename $<)" && \
	while grep -q "LaTeX Warning: Label(s) may have changed" "$(basename $<).log" || grep -q "There were undefined citations" "$(basename $<).log"; do makeindex "$(basename $<)"; makeindex -s "$(basename $<).gst" -o "$(basename $<).gls" "$(basename $<).glo"; pdflatex  -halt-on-error "$<"; pdflatex  -halt-on-error "$<"; pdflatex  -halt-on-error "$<"; done && \
    (test -e $@ && touch $@ || mv -f "ews.pdf" $@ || true)


ewstitle-taschenbuch-back.pdf: ewstitle-taschenbuch.pdf Makefile.am ## create the screen-optimized PDF
	pdfjam -o "$@" "$<" 2

ews-thumb-104x158.png: ews-thumb.png
	convert "$<" +set date:create +set date:modify -resize 104x158 "$@"
ews-thumb.png: ewstitle-taschenbuch.pdf pdfmeta
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=png16m -r300 -dDownScaleFactor=4 -dFirstPage=1 -dLastPage=1 -sOutputFile="$@" "$<" pdfmeta

ewstitle-taschenbuch.pdf: ewstitle.pdf Makefile.am pdfmeta ## create the screen-optimized PDF
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -r600 -g2949x4484 -dPDFFitPage -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/printer -dColorImageResolution=600 -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta

ewstitle.pdf: ewstitle.tex variables.tex logo-cover.png
	pdflatex  $<

chargentitle.pdf: chargentitle.tex variables.tex logo-cover.png
	pdflatex  $<


chars-2021-title.pdf: chars-2021-title.tex variables.tex logo-cover.png
	pdflatex  -shell-escape $<

english-chargentitle.pdf: english-chargentitle.tex variables.tex logo-cover.png
	pdflatex  -shell-escape   $<

tabellentitle.pdf: tabellentitle.tex variables.tex logo-cover.png
	pdflatex  -shell-escape   $< 

english-tabellentitle.pdf: english-tabellentitle.tex variables.tex logo-cover.png
	pdflatex  -shell-escape   $< 

ews.tex: $(ews_SOURCES) charheft.pdf charheft-nina.pdf ews30setup.el
	echo yes > $$(tty); Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 HOME=@abs_top_srcdir@ @EMACS@ -q --load "@abs_top_srcdir@/.emacs.d/init.el" -l "@abs_top_srcdir@/ews30setup.el" --eval '(setq vc-follow-symlinks nil)' "$<" -e org-latex-export-to-latex -e kill-emacs  < $$(tty) >> build.log

template.pdf: template.tex basesetup.tex ews30setup.tex ewstitle.pdf ## create the printable PDF
	rm -f *.aux && echo "get rid of potential leftover files from broken compilations, this slows down the compilation, but avoids problems" && \
	timeout 30 pdflatex  -interaction=nonstopmode "$<" ; echo "workaround for pdflatex stall on first run which I could not solve yet" && \
	bibtex "$(basename $<)" && \
	makeindex "$(basename $<)" && \
	timeout 360 pdflatex  -interaction=nonstopmode "$<" ; echo "workaround for pdflatex stall on first run which I could not solve yet" && \
	timeout 360 pdflatex  -interaction=nonstopmode "$<" ; echo "multiple times because it works. TODO: why? I assume that's some caching, but still I don't really know why."; \
	rm template.aux ; \
	makeindex "$(basename $<)" && \
	timeout 360 pdflatex  -interaction=nonstopmode "$<" ; \
	timeout 360 bibtex "$(basename $<)" && \
	while grep -q "LaTeX Warning: Label(s) may have changed" "$(basename $<).log" || grep -q "There were undefined citations" "$(basename $<).log"; do makeindex "$(basename $<)"; bibtex "$(basename $<)"; pdflatex  -halt-on-error "$<"; pdflatex  -halt-on-error "$<"; pdflatex  -halt-on-error "$<"; done && \
    (test -e $@ && touch $@ || mv -f "template.pdf" $@ || true)

template.tex: template.org $(ews_SOURCES) ews30setup.el
	echo yes > $$(tty); Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 HOME=@abs_top_srcdir@ timeout 360 @EMACS@ -q --load "@abs_top_srcdir@/.emacs.d/init.el" -l "@abs_top_srcdir@/ews30setup.el" --eval '(setq vc-follow-symlinks nil)' "$<" -e org-latex-export-to-latex -e kill-emacs  < $$(tty) >> build.log


tabellen-drucken.pdf: tabellen.pdf pdfmeta ## create the tabellen PDF with fonts as outlines
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dColorImageResolution=600 -dNoOutputFonts -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

# for reproducibility, replace pdf metadata by equal-length constructs, either fixed strings (like EPOCH as date) or by replacing every char by a space.
tabellen-nup.pdf: tabellen-drucken.pdf ## create the reduced PDF for the home printer
	pdfjam --landscape --nup 2x1 --outfile "$@" "$<" 1,2,3,5,6-9,12,13,16,18,20,21,24,25,26,27,30-37,39-40 && sed -i 's,/CreationDate (D.*),/CreationDate (D:19700101000000+01'"'00'"'),;s,/ModDate (D.*),/ModDate (D:19700101000000+01'"'00'"'),;s,/ID \[.*\],/ID [<0123456789ABCDEF0123456789ABCDEF> <0123456789ABCDEF0123456789ABCDEF>],;/PTEX\.FileName (/ s,., ,g' "$@"

tabellen-jetzt-nup.pdf: tabellen-drucken.pdf ## create the reduced PDF for the home printer
	pdfjam --landscape --nup 2x1 --outfile "$@" "$<" 3,26,20,21,32,33,18,24 && sed -i 's,/CreationDate (D.*),/CreationDate (D:19700101000000+01'"'00'"'),;s,/ModDate (D.*),/ModDate (D:19700101000000+01'"'00'"'),;s,/ID \[.*\],/ID [<0123456789ABCDEF0123456789ABCDEF> <0123456789ABCDEF0123456789ABCDEF>],;/PTEX\.FileName (/ s,., ,g' "$@"

tabellen.pdf: tabellen.tex basesetup.tex ews30setup.tex tabellentitle.pdf ews.gst $(IMAGES) ## create the booklet with all tables as PDF
	rm -f *.aux && \
	timeout 30 pdflatex  -halt-on-error "$<" ; \
	timeout 30 pdflatex  -halt-on-error "$<" ; \
	timeout 30 pdflatex  -halt-on-error "$<" && \
	while grep "LaTeX Warning: Label(s) may have changed" tabellen.log || grep "There were undefined citations" tabellen.log; do pdflatex  -halt-on-error "$<"; done && (test -e $@ && touch $@ || mv -f "tabellen.pdf" $@ || true)

tabellen.tex: tabellen.org $(ewstables_SOURCES) ews30setup.el
	echo yes > $$(tty); Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 HOME=@abs_top_srcdir@ @EMACS@ -q --load "@abs_top_srcdir@/.emacs.d/init.el" -l "@abs_top_srcdir@/ews30setup.el" --eval '(setq vc-follow-symlinks nil)' "$<" -e org-latex-export-to-latex -e kill-emacs  < $$(tty) >> build.log

english-tabellen-drucken.pdf: english-tabellen.pdf pdfmeta ## create the english-tabellen PDF with fonts as outlines
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dColorImageResolution=600 -dNoOutputFonts -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

# for reproducibility, replace pdf metadata by equal-length constructs, either fixed strings (like EPOCH as date) or by replacing every char by a space.
english-tabellen-nup.pdf: english-tabellen-drucken.pdf ## create the reduced PDF for the home printer
	pdfjam --landscape --nup 2x1 --outfile "$@" "$<" 1,2,3,5,6-9,12,13,16,18,20,21,24,25,26,27,30-37,39-40 && sed -i 's,/CreationDate (D.*),/CreationDate (D:19700101000000+01'"'00'"'),;s,/ModDate (D.*),/ModDate (D:19700101000000+01'"'00'"'),;s,/ID \[.*\],/ID [<0123456789ABCDEF0123456789ABCDEF> <0123456789ABCDEF0123456789ABCDEF>],;/PTEX\.FileName (/ s,., ,g' "$@"

english-tabellen-nup-thumb-208x147.png: english-tabellen-nup-thumb.png
	convert "$<" +set date:create +set date:modify -resize 208x147 "$@"
english-tabellen-nup-thumb.png: english-tabellen-nup.pdf pdfmeta
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=png16m -r300 -dDownScaleFactor=4 -dFirstPage=1 -dLastPage=1 -sOutputFile="$@" "$<" pdfmeta

english-tabellen.pdf: english-tabellen.tex basesetup.tex ews30setup.tex english-tabellentitle.pdf ews.gst $(IMAGES) ## create the booklet with all tables as PDF
	rm -f *.aux && \
	timeout 30 pdflatex  -halt-on-error "$<" ; \
	timeout 30 pdflatex  -halt-on-error "$<" ; \
	timeout 30 pdflatex  -halt-on-error "$<" && \
	while grep "LaTeX Warning: Label(s) may have changed" english-tabellen.log || grep "There were undefined citations" english-tabellen.log; do pdflatex  -halt-on-error "$<"; done && (test -e $@ && touch $@ || mv -f "english-tabellen.pdf" $@ || true)

english-tabellen.tex: english-tabellen.org $(ewstables_SOURCES) ews30setup.el
	echo yes > $$(tty); Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 HOME=@abs_top_srcdir@ @EMACS@ -q --load "@abs_top_srcdir@/.emacs.d/init.el" -l "@abs_top_srcdir@/ews30setup.el" --eval '(setq vc-follow-symlinks nil)' "$<" -e org-latex-export-to-latex -e kill-emacs  < $$(tty) >> build.log


# -r600: 600dpi, -g2619x3642: w 2619 to h 3642 dots, about 4.125+0.12*2 5.83+0.12*2 inch, about 154x111mm (3mm space for the printer).
chargen-a6-print.pdf: chargen.pdf Makefile.am pdfmeta ## create the screen-optimized PDF
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -r600 -g2619x3642 -dPDFFitPage -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/printer -dColorImageResolution=600 -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

chargen-taschenformat.pdf: chargen-drucker.pdf Makefile.am
	pdfjam --nup 2x2 --no-landscape --outfile "$@" "$<" 2-17,1,18,20,19 && sed -i 's,/CreationDate (D.*),/CreationDate (D:19700101000000+01'"'00'"'),;s,/ModDate (D.*),/ModDate (D:19700101000000+01'"'00'"'),;s,/ID \[.*\],/ID [<0123456789ABCDEF0123456789ABCDEF> <0123456789ABCDEF0123456789ABCDEF>],;/PTEX\.FileName (/ s,., ,g' "$@"

chargen-a6.pdf: chargen.pdf pdfmeta ## create the screen-optimized PDF
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sPAPERSIZE=a6 -dPDFFitPage -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress  -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

chargen-screen.pdf: chargen.pdf pdfmeta ## create the screen-optimized PDF
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress  -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

chargen-drucker.pdf: chargen.pdf pdfmeta
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dColorImageResolution=600  -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

chargen.pdf: chargen.tex chargentitle.pdf basesetup.tex ews30setup.tex ## create a random group of characters
	rm -f *.aux && \
	timeout 30 pdflatex  -halt-on-error "$<" ; \
	timeout 30 pdflatex  -halt-on-error "$<" ; \
	timeout 30 pdflatex  -halt-on-error "$<" && \
	while grep "LaTeX Warning: Label(s) may have changed" chargen.log; do pdflatex  -halt-on-error "$<"; done && (test -e $@ && touch $@ || mv -f "chargen.pdf" $@ || true)

chargen.tex: chargen.org $(ewstables_SOURCES) kasten-alter-groesse-gewicht.org ews30setup.el
	rm -f "$@" ; while ! test -f "$@" || grep -q 'Geiser Interpreter produced no output' "$@" || grep -q 'While executing meta-command' "$@"; do echo yes > $$(tty); Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 HOME=@abs_top_srcdir@ @EMACS@ -q --load "@abs_top_srcdir@/.emacs.d/init.el" -l "@abs_top_srcdir@/ews30setup.el" --eval '(setq vc-follow-symlinks nil)' --eval '(setq org-id-locations-file "@abs_top_builddir@/.org-id-locations")' "$<" -e org-latex-export-to-latex -e kill-emacs  < $$(tty) >> build.log && rm -f "@abs_top_builddir@/.org-id-locations"; done


chars-2021-taschenformat-thumb-104x147.png: chars-2021-taschenformat-thumb.png
	convert "$<" +set date:create +set date:modify -resize 104x158 "$@"
chars-2021-taschenformat-thumb.png: chars-2021-taschenformat.pdf pdfmeta
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=png16m -r300 -dDownScaleFactor=4 -dFirstPage=1 -dLastPage=1 -sOutputFile="$@" "$<" pdfmeta


# -r600: 600dpi, -g2949x4493: 12.5cm 19cm
chars-2022-wir-machen-druck-2-bruch-kreuzfalz.pdf: chars-2021-taschenformat.pdf
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -r600 -g5095x7150 -dPDFFitPage -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/printer -dColorImageResolution=600 -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta

# .chars-2021-taschenformat-tmp.pdf 1,2
chars-2021-taschenformat.pdf: chars-2021-drucker.pdf Makefile.am
	pdfjam --no-landscape --a6paper --outfile .chars-2021-taschenformat-tmp.pdf --angle 180 "$<" 2-3 && \
	pdfjam --nup 2x2 --no-landscape --outfile "$@" .chars-2021-taschenformat-tmp.pdf 1,2 "$<" 8,1,4-7 && sed -i 's,/CreationDate (D.*),/CreationDate (D:19700101000000+01'"'00'"'),;s,/ModDate (D.*),/ModDate (D:19700101000000+01'"'00'"'),;s,/ID \[.*\],/ID [<0123456789ABCDEF0123456789ABCDEF> <0123456789ABCDEF0123456789ABCDEF>],;/PTEX\.FileName (/ s,., ,g' "$@" && \
	rm .chars-2021-taschenformat-tmp.pdf

chars-2021-drucker.pdf : chars-2021.pdf pdfmeta
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dColorImageResolution=600  -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

SUFFIXES=jpg .png
.jpg.png:
	convert $< $@

chars-2021.pdf: chars-2021.tex chars-2021-title.pdf basesetup.tex ews30setup.tex heimat-br-ba-fy-hu-2000-09-20.png leuchten-rd-fl-ma-hu-2000-12-14-1.png drei-ms-pa-oo-th-2002-6-18-0.png deep-ms-pa-tr-th-2001-7-17.png schreiter-rd-fa-oo-th-2004-3-26-0.png flieger-rd-fa-oo-th-2004-3-26-4.png blume-rd-fl-fy-th-2000-12-15-3.png ozean-rd-fl-tr-th-2001-8-22.png leben-rd-fl-tr-th-2003-6-19.png laeufer-rd-fa-oo-pa-2004-4-6-0.png wachsen-re-pa-oo-pa-2000-05-29-1.png schilf-rd-fl-tr-ge-2001-8-22-0.png ## create a random group of characters
	rm -f *.aux && \
	timeout 30 pdflatex   -shell-escape   -halt-on-error "$<" ; \
	timeout 30 pdflatex   -shell-escape   -halt-on-error "$<" ; \
	timeout 30 pdflatex   -shell-escape   -halt-on-error "$<" && \
	while grep "LaTeX Warning: Label(s) may have changed" chars-2021.log; do pdflatex   -shell-escape   -halt-on-error "$<"; done && (test -e $@ && touch $@ || mv -f "chars-2021.pdf" $@ || true)

chars-2021.tex: chars-2021.org $(ewstables_SOURCES) kasten-alter-groesse-gewicht.org ews30setup.el
	rm -f "$@" ; echo yes > $$(tty); Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 HOME=@abs_top_srcdir@ @EMACS@ -q --load "@abs_top_srcdir@/.emacs.d/init.el" -l "@abs_top_srcdir@/ews30setup.el" --eval '(setq vc-follow-symlinks nil)' --eval '(setq org-id-locations-file "@abs_top_builddir@/.org-id-locations")' "$<" -e org-latex-export-to-latex -e kill-emacs  < $$(tty) >> build.log && rm -f "@abs_top_builddir@/.org-id-locations"

english-chargen-taschenformat-thumb-104x147.png: english-chargen-taschenformat-thumb.png
	convert "$<" +set date:create +set date:modify -resize 104x158 "$@"
english-chargen-taschenformat-thumb.png: english-chargen-taschenformat.pdf pdfmeta
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=png16m -r300 -dDownScaleFactor=4 -dFirstPage=1 -dLastPage=1 -sOutputFile="$@" "$<" pdfmeta

english-chargen-taschenformat.pdf: english-chargen-drucker.pdf Makefile.am
	pdfjam --nup 2x2 --no-landscape --outfile "$@" "$<" 2-17,1,18,20,19 && sed -i 's,/CreationDate (D.*),/CreationDate (D:19700101000000+01'"'00'"'),;s,/ModDate (D.*),/ModDate (D:19700101000000+01'"'00'"'),;s,/ID \[.*\],/ID [<0123456789ABCDEF0123456789ABCDEF> <0123456789ABCDEF0123456789ABCDEF>],;/PTEX\.FileName (/ s,., ,g' "$@"

english-chargen-drucker.pdf : english-chargen.pdf pdfmeta
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dColorImageResolution=600  -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

english-chargen.pdf: english-chargen.tex english-chargentitle.pdf basesetup.tex ews30setup.tex ## create a random group of characters
	rm -f *.aux && \
	timeout 30 pdflatex  -halt-on-error "$<" ; \
	timeout 30 pdflatex  -halt-on-error "$<" ; \
	timeout 30 pdflatex  -halt-on-error "$<" && \
	while grep "LaTeX Warning: Label(s) may have changed" chargen.log; do pdflatex  -halt-on-error "$<"; done && (test -e $@ && touch $@ || mv -f "english-chargen.pdf" $@ || true)

english-chargen.tex: english-chargen.org $(ewstables_SOURCES) english-kasten-alter-groesse-gewicht.org ews30setup.el
	rm -f "$@" ; while ! test -f "$@" || grep -q 'Geiser Interpreter produced no output' "$@" || grep -q 'While executing meta-command' "$@"; do echo yes > $$(tty); Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 HOME=@abs_top_srcdir@ @EMACS@ -q --load "@abs_top_srcdir@/.emacs.d/init.el" -l "@abs_top_srcdir@/ews30setup.el" --eval '(setq vc-follow-symlinks nil)' --eval '(setq org-id-locations-file "@abs_top_builddir@/.org-id-locations")' "$<" -e org-latex-export-to-latex -e kill-emacs  < $$(tty) >> build.log && rm -f "@abs_top_builddir@/.org-id-locations"; done

ews30.pdf : ews30.tex basesetup.tex ews30setup.tex logo-cover.png charheft.pdf
	pdflatex  ews30

logo-cover.png:
	cp ../../Quelldateien/Gertrud_Wenzel/Dragons_original_EWS_Logo.png $@
1w6-seitenleistenoberkante.png:
	cp ../../Quelldateien/Bildentwuerfe/1w6-seitenleistenoberkante.png $@
S_Death02.png:
	cp ../../Quelldateien/sonstiges/icons34x34byailsenglish/S_Death02.png $@
würfel.png:
	cp ../../Quelldateien/Gertrud_Wenzel/würfel.png $@

IMAGES_MIRRORED = gaia-mirrored.png raven-mirrored.png mal-keshar-mirrored.png argan-mirrored.png ISS059-E-119250-mirrored.JPG delfador-mad-mirrored.png jessica-mirrored.png druid-mirrored.png technophob-trudy-wenzel-kass-vordergrund-mirrored.png whirlwind-mirrored.png shapeshift-mirrored.png sand-sculpture-mirrored.png small-potion-mirrored.png ar-an-imeall-mirrored.png bad-neighborhood-mirrored.png dark-mana-breather-mirrored.png elven-forest-mirrored.png goblin-against-the-wind-mirrored.png kolibri-mirrored.png swanport-mirrored.png hydra-hatchling-mirrored.png guardians-fall-mirrored.png wight-mirrored.png elyssa-mirrored.png deadly-shock-mirrored.png sun-singer-mirrored.png magic-portal-mirrored.png unity-blue-mirrored.png ruffian-mirrored.png lomarfel-mirrored.png archer-fg-mirrored.png ice-castle-mirrored.png hidden-realm-mirrored.png synachukriegerin-mirrored.jpg 2012-10-02--Lecture-by-David-Revoy--cc-by--mirrored.jpg Tryker-Patrice-Garcia-Ryzom-cc-by-sa-14539965110-mirrored.png Flower-Humbert-Chabuel-cc-by-sa-rotated-mirrored.png brawler-mirrored.png assassin-female-mirrored.png a-gnu-head-redrawn-mirrored.png thief-female-mirrored.png dryade-garcia-ryzom-mirrored.png dryade-mirrored.png SneakingElvenScout-Santiago-Iborra-mirrored.png d6-metmuseum-DP121100-public-domain-mirrored.jpg

# always recreate mirrored images so they are available in distcheck. Keep them around so export from Emacs works.
# use +set date:create +set date:modify to make the images byte-by-byte reproducible.
.PHONY: $(IMAGES_MIRRORED)
.images-created: $(IMAGES) ## create all images
gaia-mirrored.png: gaia.png
	convert $^ +set date:create +set date:modify -flop $@
raven-mirrored.png: raven.png
	convert $^ +set date:create +set date:modify -flop $@
mal-keshar-mirrored.png: mal-keshar.png
	convert $^ +set date:create +set date:modify -flop $@
argan-mirrored.png: argan.png
	convert $^ +set date:create +set date:modify -flop $@
ISS059-E-119250-mirrored.JPG: ISS059-E-119250.JPG
	convert $^ +set date:create +set date:modify -flop $@
delfador-mad-mirrored.png: delfador-mad.png
	convert $^ +set date:create +set date:modify -flop $@
jessica-mirrored.png: jessica.png
	convert $^ +set date:create +set date:modify -flop $@
druid-mirrored.png: druid.png
	convert $^ +set date:create +set date:modify -flop $@
technophob-trudy-wenzel-kass-vordergrund-mirrored.png: technophob-trudy-wenzel-kass-vordergrund.png
	convert $^ +set date:create +set date:modify -flop $@
whirlwind-mirrored.png: whirlwind.png
	convert $^ +set date:create +set date:modify -flop $@
shapeshift-mirrored.png: shapeshift.png
	convert $^ +set date:create +set date:modify -flop $@
sand-sculpture-mirrored.png: sand-sculpture.png
	convert $^ +set date:create +set date:modify -flop $@
small-potion-mirrored.png: small-potion.png
	convert $^ +set date:create +set date:modify -flop $@
ar-an-imeall-mirrored.png: ar-an-imeall.png
	convert $^ +set date:create +set date:modify -flop $@
bad-neighborhood-mirrored.png: bad-neighborhood.png
	convert $^ +set date:create +set date:modify -flop $@
dark-mana-breather-mirrored.png: dark-mana-breather.png
	convert $^ +set date:create +set date:modify -flop $@
elven-forest-mirrored.png: elven-forest.png
	convert $^ +set date:create +set date:modify -flop $@
goblin-against-the-wind-mirrored.png: goblin-against-the-wind.png
	convert $^ +set date:create +set date:modify -flop $@
kolibri-mirrored.png: kolibri.png
	convert $^ +set date:create +set date:modify -flop $@
swanport-mirrored.png: swanport.png
	convert $^ +set date:create +set date:modify -flop $@
hydra-hatchling-mirrored.png: hydra-hatchling.png
	convert $^ +set date:create +set date:modify -flop $@
guardians-fall-mirrored.png: guardians-fall.png
	convert $^ +set date:create +set date:modify -flop $@
wight-mirrored.png: wight.png
	convert $^ +set date:create +set date:modify -flop $@
elyssa-mirrored.png: elyssa.png
	convert $^ +set date:create +set date:modify -flop $@
deadly-shock-mirrored.png: deadly-shock.png
	convert $^ +set date:create +set date:modify -flop $@
sun-singer-mirrored.png: sun-singer.png 
	convert $^ +set date:create +set date:modify -flop $@
magic-portal-mirrored.png: magic-portal.png
	convert $^ +set date:create +set date:modify -flop $@
unity-blue-mirrored.png: unity-blue.png
	convert $^ +set date:create +set date:modify -flop $@
ruffian-mirrored.png: ruffian.png
	convert $^ +set date:create +set date:modify -flop $@
lomarfel-mirrored.png: lomarfel.png
	convert $^ +set date:create +set date:modify -flop $@
archer-fg-mirrored.png: archer-fg.png
	convert $^ +set date:create +set date:modify -flop $@
ice-castle-mirrored.png: ice-castle.png
	convert $^ +set date:create +set date:modify -flop $@
hidden-realm-mirrored.png: hidden-realm.png
	convert $^ +set date:create +set date:modify -flop $@
synachukriegerin-mirrored.jpg: synachukriegerin.jpg
	convert $^ +set date:create +set date:modify -flop $@
2012-10-02--Lecture-by-David-Revoy--cc-by--mirrored.jpg: 2012-10-02--Lecture-by-David-Revoy--cc-by.jpg
	convert $^ +set date:create +set date:modify -flop $@
Tryker-Patrice-Garcia-Ryzom-cc-by-sa-14539965110-mirrored.png: Tryker-Patrice-Garcia-Ryzom-cc-by-sa-14539965110.png
	convert $^ +set date:create +set date:modify -flop $@
Flower-Humbert-Chabuel-cc-by-sa-rotated-mirrored.png: Flower-Humbert-Chabuel-cc-by-sa-rotated.png
	convert $^ +set date:create +set date:modify -flop $@
brawler-mirrored.png: brawler.png
	convert $^ +set date:create +set date:modify -flop $@
assassin-female-mirrored.png: assassin-female.png
	convert $^ +set date:create +set date:modify -flop $@
a-gnu-head-redrawn-mirrored.png: a-gnu-head-redrawn.png
	convert $^ +set date:create +set date:modify -flop $@
thief-female-mirrored.png: thief-female.png
	convert $^ +set date:create +set date:modify -flop $@
dryade-garcia-ryzom-mirrored.png: dryade-garcia-ryzom.png
	convert $^ +set date:create +set date:modify -flop $@
dryade-mirrored.png: dryade.png
	convert $^ +set date:create +set date:modify -flop $@
SneakingElvenScout-Santiago-Iborra-mirrored.png: SneakingElvenScout-Santiago-Iborra.png
	convert $^ +set date:create +set date:modify -flop $@
d6-metmuseum-DP121100-public-domain-mirrored.jpg: d6-metmuseum-DP121100-public-domain.jpg
	convert $^ +set date:create +set date:modify -flop $@

.INTERMEDIATE: charheft-drucken-tmp.pdf
charheft-drucken-tmp.pdf: charheft.pdf ## create the A4 charheft for printing
	pdfjam --landscape --nup 2x1 $^ -o $@

.INTERMEDIATE: pdfmeta
pdfmeta: ## create empty metadata file for reproducible ghostscript, note that umlauts are escapes for iso-latin-1!
	echo -e "[ /Title (Ein-W\\374rfel-System)\n  /Author (1w6 Team)\n  /Subject (Ein W\\374rfel System)\n  /Keywords (RPG)\n  /ModDate (0)\n  /CreationDate (0)\n  /Creator (none)\n  /Producer (none)\n  /DOCINFO pdfmark" > '$@'

charheft-drucken.pdf: charheft-drucken-tmp.pdf pdfmeta ## create the A4 charheft for printing
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dColorImageResolution=600 -dNoOutputFonts -sOutputFile="$@" "$<" pdfmeta && sed -i 's,/CreationDate (D.*),/CreationDate (D:19700101000000+01'"'00'"'),;s,/ModDate (D.*),/ModDate (D:19700101000000+01'"'00'"'),;s,/ID \[.*\],/ID [<0123456789ABCDEF0123456789ABCDEF> <0123456789ABCDEF0123456789ABCDEF>],;/PTEX\.FileName (/ s,., ,g' "$@" # see ../../sonstiges/Skripte/shrink-pdf.sh for more options

charheft-screen.pdf: charheft.pdf pdfmeta ## create the gs-optimized PDF
	gs -sDocumentUUID="ews" -sInstanceUUID="ews" -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/prepress -dEmbedAllFonts=true -sOutputFile="$@" "$<" pdfmeta # see ../../sonstiges/Skripte/shrink-pdf.sh for more options


# always create the charheft to ensure that it is available in distcheck
# the sed-call removes the settings that prevent reproducibility.
# for source-date-epoch docs, see https://reproducible-builds.org/docs/source-date-epoch/
.PHONY: charheft.pdf
charheft.pdf: charheft.sla charheft-export.py würfel.png S_Death02.png
	Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 SOURCE_DATE_EPOCH=1 @SCRIBUS@ $< -g -py charheft-export.py -pa -o $@ && sed -i 's,/CreationDate (D.*),/CreationDate (),;s,/ModDate (D.*),/ModDate (),;s,/ID \[.*\],/ID [<0123456789abcdef0123456789abcdef><0123456789abcdef0123456789abcdef>],' $@

.PHONY: charheft-nina.pdf
charheft-nina.pdf: charheft-nina.sla charheft-export.py würfel.png S_Death02.png
	Xvfb :3 -screen 0 1024x768x16 & time DISPLAYY=:3 SOURCE_DATE_EPOCH=1 @SCRIBUS@ $< -g -py charheft-export.py -pa -o $@ && sed -i 's,/CreationDate (D.*),/CreationDate (),;s,/ModDate (D.*),/ModDate (),;s,/ID \[.*\],/ID [<0123456789abcdef0123456789abcdef><0123456789abcdef0123456789abcdef>],' $@

# avoid shipping auto-compiled files
dist-hook:
	rm -f "$(top_distdir)/.emacs.d/eln-cache/*/*"

# version-suffix for release-files to avoid double versioning (30-3.0)
VERSION_SUFFIX:=$$(echo "$(VERSION)" | sed s,3.0,30,g)

.PHONY: release
release: ews-taschenbuch.pdf ews-screen.pdf chargen-screen.pdf chargen-drucker.pdf chargen-taschenformat.pdf tabellen-nup.pdf ews-thumb.png ews-thumb-104x158.png .release-$(VERSION)  ## Release a new version by copying the correct files to ../../releases. Needs a subsequent push for the upload.
	make distcheck && for file in $^; do cp $$file "$$(realpath .)/../../releases/$$(echo $$file | sed s/ews-*// | sed s/^/ews$(VERSION_SUFFIX)-/)" ; done && cp "ews-$(VERSION).tar.gz" "$$(realpath .)/../../releases/ews$(VERSION_SUFFIX).tar.gz"

.PHONY: help
help: ## Show this help message.
	@echo 'Usage:'
	@echo ':make [target] ...' | sed "s/\(target\)/\\x1b[36m\1\\x1b[m/" | column -c2 -t -s :
	@echo
	@echo 'Targets:'
	@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/:\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
	@echo
	@echo '(see ./configure --help for setup options)'

# install: install-am ## install to locations defined by ./configure
# uninstall: uninstall-am ## remove the installed files

# create basic files for the tarballl
.SECONDARY: ChangeLog AUTHORS
ChangeLog: ## create the ChangeLog from the history
	echo "For user-visible changes, see the NEWS file" > "$@"
	echo >> "$@"
	(cd "@abs_top_srcdir@"; hg log -r "reverse(0::tip)" --style changelog) >> "$@"
AUTHORS: AUTHORS.in ARTISTS.org ## create the AUTHORS file from the history and AUTHORS.in
	cat $^ > "$@"
	(cd "@abs_top_srcdir@"; hg --config extensions.churn= churn -t "{author}") >> "$@"