# HG changeset patch # User Stefano Rivera # Date 1378656764 -7200 # Node ID 09c76e7ce675b1abef440c644874af397eb848d7 # Parent 87c6ede3b10b2bec726908d3168b65121f192222 Icon generation in Makefile diff -r 87c6ede3b10b -r 09c76e7ce675 source/Makefile --- a/source/Makefile Sun Sep 08 17:53:46 2013 +0200 +++ b/source/Makefile Sun Sep 08 18:12:44 2013 +0200 @@ -1,11 +1,13 @@ -SOURCES = $(shell find images -name '*.svg') -TARGETS = $(patsubst %.svg,../data/%.png,$(SOURCES)) +IMG_SOURCES = $(shell find images -name '*.svg') +IMG_TARGETS = $(patsubst %.svg,../data/%.png,$(IMG_SOURCES)) +ICONS = _16.png _32.png _64.png _128.png .xpm .icns .ico +ICO_TARGETS = $(patsubst %,../data/icons/werewolf-sonata%,$(ICONS)) OPTIMIZE = 1 -all: $(TARGETS) +all: $(IMG_TARGETS) $(ICO_TARGETS) clean: - rm -f $(TARGETS) + rm -f $(IMG_TARGETS) ../data/%.png: %.svg mkdir -p $(dir $@) @@ -14,3 +16,56 @@ optipng -o4 -preserve $@ advpng -z4 $@ endif + +../data/icons/%_1024.png: icons/%.svg + inkscape --export-png $@ --export-width 1024 --export-height 1024 $< + +../data/icons/%_512.png: icons/%.svg + inkscape --export-png $@ --export-width 512 --export-height 512 $< + +../data/icons/%_256.png: icons/%.svg + inkscape --export-png $@ --export-width 256 --export-height 256 $< +ifeq ($(OPTIMIZE),1) + optipng -o4 -preserve $@ + advpng -z4 $@ +endif + +../data/icons/%_128.png: icons/%.svg + inkscape --export-png $@ --export-width 128 --export-height 128 $< +ifeq ($(OPTIMIZE),1) + optipng -o4 -preserve $@ + advpng -z4 $@ +endif + +../data/icons/%_64.png: icons/%.svg + inkscape --export-png $@ --export-width 64 --export-height 64 $< +ifeq ($(OPTIMIZE),1) + optipng -o4 -preserve $@ + advpng -z4 $@ +endif + +../data/icons/%_48.png: icons/%.svg + inkscape --export-png $@ --export-width 48 --export-height 48 $< + +../data/icons/%_32.png: icons/%.svg + inkscape --export-png $@ --export-width 32 --export-height 32 $< +ifeq ($(OPTIMIZE),1) + optipng -o4 -preserve $@ + advpng -z4 $@ +endif + +../data/icons/%_16.png: icons/%.svg + inkscape --export-png $@ --export-width 16 --export-height 16 $< +ifeq ($(OPTIMIZE),1) + optipng -o4 -preserve $@ + advpng -z4 $@ +endif + +%.xpm: %_32.png + convert $< $@ + +%.icns: %_16.png %_32.png %_48.png %_128.png %_256.png %_512.png %_1024.png + png2icns $@ $^ + +%.ico: %_16.png %_32.png %_64.png %_48.png %_128.png %_256.png + icotool -c -o $@ $(filter-out %_256.png,$^) --raw=$(filter %_256.png,$^) diff -r 87c6ede3b10b -r 09c76e7ce675 source/icons/werewolf-sonata.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/icons/werewolf-sonata.svg Sun Sep 08 18:12:44 2013 +0200 @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff -r 87c6ede3b10b -r 09c76e7ce675 source/icons/werewolf_sonata.svg --- a/source/icons/werewolf_sonata.svg Sun Sep 08 17:53:46 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,422 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - -