Fix typo.
[featherfall2.git] / rules / icons.mk
1 # This is free and unencumbered software released into the public
2 # domain. To the extent possible under law, the author of this file
3 # waives all copyright and related or neighboring rights to it.
4
5 .DELETE_ON_ERROR:
6
7 XCF2PNG ?= xcf2png
8
9 %.png: %.xcf
10 $(XCF2PNG) $< > $@
11
12 # First: xcf2png by default calls zcat rather than gzcat. This is
13 # totally always broken; zcat forces a .Z extension on its input
14 # filename. So we can't rely on xcf2png's default behavior. But it
15 # offers -Z for a custom decompression program.
16 #
17 # BUT: Gimp produces gz files with some padding zeros because, I don't
18 # know, someone might want to save their compressed xcfs to DECtape.
19 # gzip has a -q option to not *print* the warning associated with this
20 # harmless thing, but then goes ahead and exits non-zero anyway, which
21 # makes xcf2png barf and die before writing anything even though it
22 # got perfectly good data.
23 #
24 # So: 1) use gunzip, 2) manually feed it to xcf2png, 3) hope nothing is
25 # set to die based on pipe status, 4) hope that if the xcf data is
26 # actually busted xcf2png will do something helpful.
27 %.png: %.xcf.gz
28 gunzip -c $< | $(XCF2PNG) - > $@
29
30 .SECONDEXPANSION:
31
32 ICONUTIL ?= $(firstword $(shell command -v iconutil icnsutil) iconutil)
33
34 %.icns: %.iconset $$(wildcard $$(@D)/$$*.iconset/icon_*.png)
35 $(ICONUTIL) -c icns -o $@ $<
36
37 %.ico: %.iconset $$(wildcard $$(@D)/$$*.iconset/icon_*[0-9].png)
38 convert -background transparent -colors 256 $(filter-out $<,$^) $@
39