summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-05 23:18:30 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-05 23:50:07 -0400
commit8b795e605aa2ebfd385ee83b0f1b698435737b47 (patch)
tree33df2747642063494322a5a72fcd7d20d9aca2da /Makefile
parent046e2f38a417b27376f73f0becec3caf99d84420 (diff)
Clean up icons
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2d24a2f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+# SVG2PNG: Each is buggy in their own way
+# ImageMagick: doesn't support transparency
+#SVG2PNG = convert $1 -format png $(if $3,-resize $3x)$(if $4,$4) $(if $5,-bacground $5) $2
+# librsvg: doesn't support <style> element
+#SVG2PNG = rsvg-convert $1 -o $2 $(if $3,-w $3) $(if $4,-h $4) $(if $5,--background-color=$5)
+# Inkscape: messes up gradients
+_SVG2PNG = inkscape $1 --export-png $2 $(if $3,-w $3) $(if $4,-h $4) $(if $5,-b '$5')
+
+# Hacky thing to also run it through pngcrush
+SVG2PNG = { $(call _SVG2PNG,$1,$2.tmp.png,$3) && pngcrush $2.tmp.png $2 && rm $2.tmp.png; } || { rm $2.tmp.png; false; }
+
+icons = minak
+densities = mdpi hdpi xhdpi xxhdpi xxxhdpi
+all: $(addsuffix $(addsuffix .png,$(icons)),$(addprefix res/drawable-,$(addsuffix /,$(densities))))
+
+res/drawable-mdpi/%.png: res/drawable/%.svg
+ mkdir -p $(@D)
+ $(call SVG2PNG,$<,$@,48)
+res/drawable-hdpi/%.png: res/drawable/%.svg
+ mkdir -p $(@D)
+ $(call SVG2PNG,$<,$@,72)
+res/drawable-xhdpi/%.png: res/drawable/%.svg
+ mkdir -p $(@D)
+ $(call SVG2PNG,$<,$@,96)
+res/drawable-xxhdpi/%.png: res/drawable/%.svg
+ mkdir -p $(@D)
+ $(call SVG2PNG,$<,$@,144)
+res/drawable-xxxhdpi/%.png: res/drawable/%.svg
+ mkdir -p $(@D)
+ $(call SVG2PNG,$<,$@,192)
+
+.DELETE_ON_ERROR: