Mercurial > nagslang
comparison source/Makefile @ 671:09c76e7ce675
Icon generation in Makefile
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sun, 08 Sep 2013 18:12:44 +0200 |
parents | eba98879f47f |
children | 62b9eac8e236 |
comparison
equal
deleted
inserted
replaced
670:87c6ede3b10b | 671:09c76e7ce675 |
---|---|
1 SOURCES = $(shell find images -name '*.svg') | 1 IMG_SOURCES = $(shell find images -name '*.svg') |
2 TARGETS = $(patsubst %.svg,../data/%.png,$(SOURCES)) | 2 IMG_TARGETS = $(patsubst %.svg,../data/%.png,$(IMG_SOURCES)) |
3 ICONS = _16.png _32.png _64.png _128.png .xpm .icns .ico | |
4 ICO_TARGETS = $(patsubst %,../data/icons/werewolf-sonata%,$(ICONS)) | |
3 OPTIMIZE = 1 | 5 OPTIMIZE = 1 |
4 | 6 |
5 all: $(TARGETS) | 7 all: $(IMG_TARGETS) $(ICO_TARGETS) |
6 | 8 |
7 clean: | 9 clean: |
8 rm -f $(TARGETS) | 10 rm -f $(IMG_TARGETS) |
9 | 11 |
10 ../data/%.png: %.svg | 12 ../data/%.png: %.svg |
11 mkdir -p $(dir $@) | 13 mkdir -p $(dir $@) |
12 inkscape --export-png $@ --export-dpi 9 $< | 14 inkscape --export-png $@ --export-dpi 9 $< |
13 ifeq ($(OPTIMIZE),1) | 15 ifeq ($(OPTIMIZE),1) |
14 optipng -o4 -preserve $@ | 16 optipng -o4 -preserve $@ |
15 advpng -z4 $@ | 17 advpng -z4 $@ |
16 endif | 18 endif |
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 $< | |
28 ifeq ($(OPTIMIZE),1) | |
29 optipng -o4 -preserve $@ | |
30 advpng -z4 $@ | |
31 endif | |
32 | |
33 ../data/icons/%_128.png: icons/%.svg | |
34 inkscape --export-png $@ --export-width 128 --export-height 128 $< | |
35 ifeq ($(OPTIMIZE),1) | |
36 optipng -o4 -preserve $@ | |
37 advpng -z4 $@ | |
38 endif | |
39 | |
40 ../data/icons/%_64.png: icons/%.svg | |
41 inkscape --export-png $@ --export-width 64 --export-height 64 $< | |
42 ifeq ($(OPTIMIZE),1) | |
43 optipng -o4 -preserve $@ | |
44 advpng -z4 $@ | |
45 endif | |
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 $< | |
52 ifeq ($(OPTIMIZE),1) | |
53 optipng -o4 -preserve $@ | |
54 advpng -z4 $@ | |
55 endif | |
56 | |
57 ../data/icons/%_16.png: icons/%.svg | |
58 inkscape --export-png $@ --export-width 16 --export-height 16 $< | |
59 ifeq ($(OPTIMIZE),1) | |
60 optipng -o4 -preserve $@ | |
61 advpng -z4 $@ | |
62 endif | |
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,$^) |