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