chiark / gitweb /
publish README
[quacks.git] / Makefile
1
2 PUBLISH_MD += pumpkin-books house-rules
3 PUBLISH += pumpkin-books.pdf README.html
4 PUBLISH += $(addsuffix .md.txt,  $(PUBLISH_MD))
5 PUBLISH += $(addsuffix .md.html, $(PUBLISH_MD))
6 PUBLISH += $(addsuffix .md.pdf,  $(PUBLISH_MD))
7
8 SHELL=bash
9
10 all:    $(PUBLISH)
11
12 # Don't print the ps, printers (eg ours!) don't always have the fonts
13
14 o=>$@.new && mv -f $@.new $@
15 use_rsvg=rsvg-convert -f png -o $@.tmp.png $<
16 shell_pipe=set -o pipefail; set -e;
17 make_pnm = pnmdepth 255 | pnmnoraw $o
18
19 pumpkin-books.ps: pumpkin-books.ps.pl bag.pgm pot.pgm droplet.ppm
20         ./$< $o
21
22 pumpkin-books.pdf: pumpkin-books.ps
23         gs -q -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress \
24                 -sDEVICE=pdfwrite -sOutputFile=$@ $<
25
26 bag.pgm: Sack_-_Sac_-_Zak_brown.svg Makefile
27         $(use_rsvg)
28         $(shell_pipe)                                   \
29         pngtopnm <$@.tmp.png -mix -background 'white'   \
30         | ppmtopgm                                      \
31         | $(make_pnm)
32
33 pot.pgm: 146_Kaldrono.svg Makefile
34         $(use_rsvg)
35         $(shell_pipe)                                   \
36         pngtopnm <$@.tmp.png                            \
37         | ppmtopgm                                      \
38         | pnminvert                                     \
39         | $(make_pnm)
40
41 droplet.ppm: droplet.svg Makefile
42         $(use_rsvg)
43         $(shell_pipe)                                   \
44         pngtopnm <$@.tmp.png -mix -background 'white'   \
45         | pnmdepth 255                                  \
46         | $(make_pnm)
47
48 PUBLISH_FILES= \
49         $(patsubst %.md,%.md.txt, $(PUBLISH)) \
50         $(patsubst %.md,%.md.html, $(filter $(PUBLISH)) \
51
52 %.md.txt: %.md
53         cat $< $o
54
55 %.md.html: %.md Makefile
56         pandoc -s $< $o
57
58 %.md.pdf: %.md Makefile
59         pandoc --pdf-engine=wkhtmltopdf -o $@ $<
60
61 pubssh=c
62 pubpath=games-rules/quacks
63 puburl=https://www.chiark.greenend.org.uk/~ijackson/
64
65 publish: $(PUBLISH)
66         git push origin
67         rsync $^ $(pubssh):public-html/$(pubpath)/.
68         @echo $(puburl)$(pubpath)/