New puzzle! 'Unruly', contributed by Lennard Sprong, is an
[sgt/puzzles] / icons / Makefile
CommitLineData
afc306fc 1# Makefile for Puzzles icons.
2
301cd8c4 3PUZZLES = 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 \
4871e605 7 unequal unruly untangle
afc306fc 8
fbd2dc51 9BASE = $(patsubst %,%-base.png,$(PUZZLES))
10WEB = $(patsubst %,%-web.png,$(PUZZLES))
11
e0433c68 12IBASE = $(patsubst %,%-ibase.png,$(PUZZLES))
13IBASE4 = $(patsubst %,%-ibase4.png,$(PUZZLES))
fbd2dc51 14P48D24 = $(patsubst %,%-48d24.png,$(PUZZLES))
15P48D8 = $(patsubst %,%-48d8.png,$(PUZZLES))
16P48D4 = $(patsubst %,%-48d4.png,$(PUZZLES))
17P32D24 = $(patsubst %,%-32d24.png,$(PUZZLES))
18P32D8 = $(patsubst %,%-32d8.png,$(PUZZLES))
19P32D4 = $(patsubst %,%-32d4.png,$(PUZZLES))
20P16D24 = $(patsubst %,%-16d24.png,$(PUZZLES))
21P16D8 = $(patsubst %,%-16d8.png,$(PUZZLES))
22P16D4 = $(patsubst %,%-16d4.png,$(PUZZLES))
23ICONS = $(patsubst %,%.ico,$(PUZZLES))
f12cdd72 24CICONS = $(patsubst %,%-icon.c,$(PUZZLES))
fa2cb13d 25RC = $(patsubst %,%.rc,$(PUZZLES))
afc306fc 26
27BIN = ../
28PIC = ./
29
fbd2dc51 30base: $(BASE)
31web: $(WEB)
e0433c68 32pngicons: $(P48D24) $(P32D24) $(P16D24)
fa2cb13d 33winicons: $(ICONS) $(RC)
f12cdd72 34gtkicons: $(CICONS)
3e224760 35all: base web pngicons winicons gtkicons
afc306fc 36
e0433c68 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.
fbd2dc51 40fifteen-base.png : override REDO=0.3
41flip-base.png : override REDO=0.3
42netslide-base.png : override REDO=0.3
43sixteen-base.png : override REDO=0.3
44twiddle-base.png : override REDO=0.3
fbd2dc51 45$(BASE): %-base.png: $(BIN)% $(PIC)%.sav
afc306fc 46 $(PIC)screenshot.sh $(BIN)$* $(PIC)$*.sav $@ $(REDO)
47
e0433c68 48# Build the screenshots for the web, by scaling the original base
49# images to a uniform size.
fbd2dc51 50$(WEB): %-web.png: %-base.png
afc306fc 51 $(PIC)square.pl 150 5 $^ $@
52
e0433c68 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.
56blackbox-ibase.png : override CROP=352x352 144x144+0+208
57bridges-ibase.png : override CROP=264x264 107x107+157+157
58dominosa-ibase.png : override CROP=304x272 152x152+152+0
59fifteen-ibase.png : override CROP=240x240 120x120+0+120
7b5c79f8 60filling-ibase.png : override CROP=256x256 133x133+14+78
e0433c68 61flip-ibase.png : override CROP=288x288 145x145+120+72
ab3a1e43 62galaxies-ibase.png : override CROP=288x288 165x165+0+0
e0433c68 63guess-ibase.png : override CROP=263x420 178x178+75+17
64inertia-ibase.png : override CROP=321x321 128x128+193+0
c8c23a7f 65keen-ibase.png : override CROP=288x288 96x96+24+120
e0433c68 66lightup-ibase.png : override CROP=256x256 112x112+144+0
67loopy-ibase.png : override CROP=257x257 113x113+0+0
72c00e19 68magnets-ibase.png : override CROP=264x232 96x96+36+100
e0433c68 69mines-ibase.png : override CROP=240x240 110x110+130+130
70net-ibase.png : override CROP=193x193 113x113+0+80
71netslide-ibase.png : override CROP=289x289 144x144+0+0
72pattern-ibase.png : override CROP=384x384 223x223+0+0
b760b8bd 73pearl-ibase.png : override CROP=216x216 94x94+108+15
e0433c68 74pegs-ibase.png : override CROP=263x263 147x147+116+0
e7414d31 75range-ibase.png : override CROP=256x256 98x98+111+15
e0433c68 76rect-ibase.png : override CROP=205x205 115x115+90+0
4cbcbfca 77signpost-ibase.png : override CROP=240x240 98x98+23+23
b5ba72bc 78singles-ibase.png : override CROP=224x224 98x98+15+15
e0433c68 79sixteen-ibase.png : override CROP=288x288 144x144+144+144
80slant-ibase.png : override CROP=321x321 160x160+160+160
0b119fd7 81solo-ibase.png : override CROP=481x481 145x145+24+24
e0433c68 82tents-ibase.png : override CROP=320x320 165x165+142+0
6361649b 83towers-ibase.png : override CROP=300x300 102x102+151+6
e0433c68 84twiddle-ibase.png : override CROP=192x192 102x102+69+21
301cd8c4 85undead-ibase.png : override CROP=448x512 192x192+32+96
0d926fd4 86unequal-ibase.png : override CROP=208x208 104x104+104+104
e0433c68 87untangle-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
fbd2dc51 99 $(PIC)square.pl 48 4 $^ $@
e0433c68 100$(P32D24): %-32d24.png: %-ibase.png
fbd2dc51 101 $(PIC)square.pl 32 2 $^ $@
e0433c68 102$(P16D24): %-16d24.png: %-ibase.png
fbd2dc51 103 $(PIC)square.pl 16 1 $^ $@
104
e0433c68 105# The 8-bit icon PNGs are just custom-paletted quantisations of the
106# 24-bit ones.
fbd2dc51 107$(P48D8) $(P32D8) $(P16D8): %d8.png: %d24.png
108 convert -colors 256 $^ $@
109
e0433c68 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
7fa3b75c 116 $(PIC)square.pl 48 1 $^ $@-tmp2.png
117 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
118 rm -f $@-tmp2.png
e0433c68 119$(P32D4): %-32d4.png: %-ibase.png
7fa3b75c 120 $(PIC)square.pl 32 1 $^ $@-tmp2.png
121 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
122 rm -f $@-tmp2.png
e0433c68 123$(P16D4): %-16d4.png: %-ibase.png
7fa3b75c 124 $(PIC)square.pl 16 1 $^ $@-tmp2.png
125 convert -colors 16 -map $(PIC)win16pal.xpm $@-tmp2.png $@
126 rm -f $@-tmp2.png
fbd2dc51 127
fa2cb13d 128# Build the actual Windows icons themselves, by feeding all those
129# PNGs to my icon builder script.
fbd2dc51 130$(ICONS): %.ico: %-48d24.png %-48d8.png %-48d4.png \
131 %-32d24.png %-32d8.png %-32d4.png \
132 %-16d24.png %-16d8.png %-16d4.png
7f7476c2 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 > $@
fbd2dc51 136
fa2cb13d 137# Build the .RC files which bind the icons into the applications.
138$(RC): %.rc:
cb0c7d4a 139 echo '#include "puzzles.rc2"' > $@
140 echo '200 ICON "$*.ico"' >> $@
fa2cb13d 141
f12cdd72 142# Build the GTK icon source files.
143$(CICONS): %-icon.c: %-16d24.png %-32d24.png %-48d24.png
144 $(PIC)cicon.pl $^ > $@
145
afc306fc 146clean:
f12cdd72 147 rm -f *.png *.ico *.rc *-icon.c