New puzzle! 'Unruly', contributed by Lennard Sprong, is an
[sgt/puzzles] / icons / Makefile
1 # Makefile for Puzzles icons.
2
3 PUZZLES = blackbox bridges cube dominosa fifteen filling flip galaxies \
4 guess inertia keen lightup loopy magnets map mines net \
5 netslide pattern pearl pegs range rect samegame signpost \
6 singles sixteen slant solo tents towers twiddle undead \
7 unequal unruly untangle
8
9 BASE = $(patsubst %,%-base.png,$(PUZZLES))
10 WEB = $(patsubst %,%-web.png,$(PUZZLES))
11
12 IBASE = $(patsubst %,%-ibase.png,$(PUZZLES))
13 IBASE4 = $(patsubst %,%-ibase4.png,$(PUZZLES))
14 P48D24 = $(patsubst %,%-48d24.png,$(PUZZLES))
15 P48D8 = $(patsubst %,%-48d8.png,$(PUZZLES))
16 P48D4 = $(patsubst %,%-48d4.png,$(PUZZLES))
17 P32D24 = $(patsubst %,%-32d24.png,$(PUZZLES))
18 P32D8 = $(patsubst %,%-32d8.png,$(PUZZLES))
19 P32D4 = $(patsubst %,%-32d4.png,$(PUZZLES))
20 P16D24 = $(patsubst %,%-16d24.png,$(PUZZLES))
21 P16D8 = $(patsubst %,%-16d8.png,$(PUZZLES))
22 P16D4 = $(patsubst %,%-16d4.png,$(PUZZLES))
23 ICONS = $(patsubst %,%.ico,$(PUZZLES))
24 CICONS = $(patsubst %,%-icon.c,$(PUZZLES))
25 RC = $(patsubst %,%.rc,$(PUZZLES))
26
27 BIN = ../
28 PIC = ./
29
30 base: $(BASE)
31 web: $(WEB)
32 pngicons: $(P48D24) $(P32D24) $(P16D24)
33 winicons: $(ICONS) $(RC)
34 gtkicons: $(CICONS)
35 all: base web pngicons winicons gtkicons
36
37 # Build the base puzzle screenshots from which all the other images
38 # are derived. Some of them involve showing a move animation
39 # part-way through.
40 fifteen-base.png : override REDO=0.3
41 flip-base.png : override REDO=0.3
42 netslide-base.png : override REDO=0.3
43 sixteen-base.png : override REDO=0.3
44 twiddle-base.png : override REDO=0.3
45 $(BASE): %-base.png: $(BIN)% $(PIC)%.sav
46 $(PIC)screenshot.sh $(BIN)$* $(PIC)$*.sav $@ $(REDO)
47
48 # Build the screenshots for the web, by scaling the original base
49 # images to a uniform size.
50 $(WEB): %-web.png: %-base.png
51 $(PIC)square.pl 150 5 $^ $@
52
53 # Build the base _icon_ images, by careful cropping of the base
54 # images: icons are very small so it's often necessary to zoom in
55 # on a smaller portion of the screenshot.
56 blackbox-ibase.png : override CROP=352x352 144x144+0+208
57 bridges-ibase.png : override CROP=264x264 107x107+157+157
58 dominosa-ibase.png : override CROP=304x272 152x152+152+0
59 fifteen-ibase.png : override CROP=240x240 120x120+0+120
60 filling-ibase.png : override CROP=256x256 133x133+14+78
61 flip-ibase.png : override CROP=288x288 145x145+120+72
62 galaxies-ibase.png : override CROP=288x288 165x165+0+0
63 guess-ibase.png : override CROP=263x420 178x178+75+17
64 inertia-ibase.png : override CROP=321x321 128x128+193+0
65 keen-ibase.png : override CROP=288x288 96x96+24+120
66 lightup-ibase.png : override CROP=256x256 112x112+144+0
67 loopy-ibase.png : override CROP=257x257 113x113+0+0
68 magnets-ibase.png : override CROP=264x232 96x96+36+100
69 mines-ibase.png : override CROP=240x240 110x110+130+130
70 net-ibase.png : override CROP=193x193 113x113+0+80
71 netslide-ibase.png : override CROP=289x289 144x144+0+0
72 pattern-ibase.png : override CROP=384x384 223x223+0+0
73 pearl-ibase.png : override CROP=216x216 94x94+108+15
74 pegs-ibase.png : override CROP=263x263 147x147+116+0
75 range-ibase.png : override CROP=256x256 98x98+111+15
76 rect-ibase.png : override CROP=205x205 115x115+90+0
77 signpost-ibase.png : override CROP=240x240 98x98+23+23
78 singles-ibase.png : override CROP=224x224 98x98+15+15
79 sixteen-ibase.png : override CROP=288x288 144x144+144+144
80 slant-ibase.png : override CROP=321x321 160x160+160+160
81 solo-ibase.png : override CROP=481x481 145x145+24+24
82 tents-ibase.png : override CROP=320x320 165x165+142+0
83 towers-ibase.png : override CROP=300x300 102x102+151+6
84 twiddle-ibase.png : override CROP=192x192 102x102+69+21
85 undead-ibase.png : override CROP=448x512 192x192+32+96
86 unequal-ibase.png : override CROP=208x208 104x104+104+104
87 untangle-ibase.png : override CROP=320x320 164x164+3+116
88 $(IBASE): %-ibase.png: %-base.png
89 $(PIC)crop.sh $^ $@ $(CROP)
90
91 # Convert the full-size icon images to 4-bit colour, because that
92 # seems to work better than reducing it in 24 bits and then
93 # dithering.
94 $(IBASE4): %-ibase4.png: %-ibase.png
95 convert -colors 16 +dither -map $(PIC)win16pal.xpm $^ $@
96
97 # Build the 24-bit PNGs for the icons, at three sizes.
98 $(P48D24): %-48d24.png: %-ibase.png
99 $(PIC)square.pl 48 4 $^ $@
100 $(P32D24): %-32d24.png: %-ibase.png
101 $(PIC)square.pl 32 2 $^ $@
102 $(P16D24): %-16d24.png: %-ibase.png
103 $(PIC)square.pl 16 1 $^ $@
104
105 # The 8-bit icon PNGs are just custom-paletted quantisations of the
106 # 24-bit ones.
107 $(P48D8) $(P32D8) $(P16D8): %d8.png: %d24.png
108 convert -colors 256 $^ $@
109
110 # But the depth-4 images work better if we re-shrink from the
111 # ibase4 versions of the images, and then normalise the colours
112 # again afterwards. (They're still not very good, but my hope is
113 # that on most modern Windows machines this won't matter too
114 # much...)
115 $(P48D4): %-48d4.png: %-ibase4.png
116 $(PIC)square.pl 48 1 $^ $@-tmp2.png
117 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
118 rm -f $@-tmp2.png
119 $(P32D4): %-32d4.png: %-ibase.png
120 $(PIC)square.pl 32 1 $^ $@-tmp2.png
121 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
122 rm -f $@-tmp2.png
123 $(P16D4): %-16d4.png: %-ibase.png
124 $(PIC)square.pl 16 1 $^ $@-tmp2.png
125 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
126 rm -f $@-tmp2.png
127
128 # Build the actual Windows icons themselves, by feeding all those
129 # PNGs to my icon builder script.
130 $(ICONS): %.ico: %-48d24.png %-48d8.png %-48d4.png \
131 %-32d24.png %-32d8.png %-32d4.png \
132 %-16d24.png %-16d8.png %-16d4.png
133 $(PIC)icon.pl -24 $*-48d24.png $*-32d24.png $*-16d24.png \
134 -8 $*-48d8.png $*-32d8.png $*-16d8.png \
135 -4 $*-48d4.png $*-32d4.png $*-16d4.png > $@
136
137 # Build the .RC files which bind the icons into the applications.
138 $(RC): %.rc:
139 echo '#include "puzzles.rc2"' > $@
140 echo '200 ICON "$*.ico"' >> $@
141
142 # Build the GTK icon source files.
143 $(CICONS): %-icon.c: %-16d24.png %-32d24.png %-48d24.png
144 $(PIC)cicon.pl $^ > $@
145
146 clean:
147 rm -f *.png *.ico *.rc *-icon.c