source: source/Makefile@ 672:b9c29fd56b1e

Last change on this file since 672:b9c29fd56b1e was 671:09c76e7ce675, checked in by Stefano Rivera <stefano@…>, 9 years ago

Icon generation in Makefile

File size: 1.9 KB
Line 
1IMG_SOURCES = $(shell find images -name '*.svg')
2IMG_TARGETS = $(patsubst %.svg,../data/%.png,$(IMG_SOURCES))
3ICONS = _16.png _32.png _64.png _128.png .xpm .icns .ico
4ICO_TARGETS = $(patsubst %,../data/icons/werewolf-sonata%,$(ICONS))
5OPTIMIZE = 1
6
7all: $(IMG_TARGETS) $(ICO_TARGETS)
8
9clean:
10 rm -f $(IMG_TARGETS)
11
12../data/%.png: %.svg
13 mkdir -p $(dir $@)
14 inkscape --export-png $@ --export-dpi 9 $<
15ifeq ($(OPTIMIZE),1)
16 optipng -o4 -preserve $@
17 advpng -z4 $@
18endif
19
20../data/icons/%_1024.png: icons/%.svg
21 inkscape --export-png $@ --export-width 1024 --export-height 1024 $<
22
23../data/icons/%_512.png: icons/%.svg
24 inkscape --export-png $@ --export-width 512 --export-height 512 $<
25
26../data/icons/%_256.png: icons/%.svg
27 inkscape --export-png $@ --export-width 256 --export-height 256 $<
28ifeq ($(OPTIMIZE),1)
29 optipng -o4 -preserve $@
30 advpng -z4 $@
31endif
32
33../data/icons/%_128.png: icons/%.svg
34 inkscape --export-png $@ --export-width 128 --export-height 128 $<
35ifeq ($(OPTIMIZE),1)
36 optipng -o4 -preserve $@
37 advpng -z4 $@
38endif
39
40../data/icons/%_64.png: icons/%.svg
41 inkscape --export-png $@ --export-width 64 --export-height 64 $<
42ifeq ($(OPTIMIZE),1)
43 optipng -o4 -preserve $@
44 advpng -z4 $@
45endif
46
47../data/icons/%_48.png: icons/%.svg
48 inkscape --export-png $@ --export-width 48 --export-height 48 $<
49
50../data/icons/%_32.png: icons/%.svg
51 inkscape --export-png $@ --export-width 32 --export-height 32 $<
52ifeq ($(OPTIMIZE),1)
53 optipng -o4 -preserve $@
54 advpng -z4 $@
55endif
56
57../data/icons/%_16.png: icons/%.svg
58 inkscape --export-png $@ --export-width 16 --export-height 16 $<
59ifeq ($(OPTIMIZE),1)
60 optipng -o4 -preserve $@
61 advpng -z4 $@
62endif
63
64%.xpm: %_32.png
65 convert $< $@
66
67%.icns: %_16.png %_32.png %_48.png %_128.png %_256.png %_512.png %_1024.png
68 png2icns $@ $^
69
70%.ico: %_16.png %_32.png %_64.png %_48.png %_128.png %_256.png
71 icotool -c -o $@ $(filter-out %_256.png,$^) --raw=$(filter %_256.png,$^)
Note: See TracBrowser for help on using the repository browser.