diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-11-29 15:25:38 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-11-29 15:25:38 -0500 |
commit | 2ea1da41e818da39339360ca6ea67cc47839b22f (patch) | |
tree | 04d7779c73cd7523e8f624fa60363e359617174c /Makefile | |
parent | b62a23efaff3332caf5b2fa51f63d256ee154a94 (diff) |
Use a Makefile to generate '.png's
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ce74c24 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +# 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') + +# pngcrush is available from [pcr] +#PNGCRUSH = cp $1 $2 +PNGCRUSH = pngcrush $1 $2 + +default: PHONY all + +dir.png = /usr/share/icons/oxygen/16x16/mimetypes/inode-directory.png +file.png = /usr/share/icons/oxygen/16x16/mimetypes/unknown.png +iso.png = /usr/share/icons/oxygen/16x16/devices/media-optical.png +parent.png = /usr/share/icons/oxygen/16x16/actions/go-up.png +pkg.png = pkg.svg.png +repo.png = /usr/share/icons/oxygen/16x16/places/folder-tar.png +tar.png = tar.svg.png +torrent.png = /usr/share/icons/oxygen/16x16/actions/download.png +txt.png = /usr/share/icons/oxygen/16x16/mimetypes/text-plain.png + +pngs := $(shell sed -n 's/\.png\s*=.*/.png/p' $(MAKEFILE_LIST)) +$(foreach png,$(pngs),$(eval $(png): $($(png)); $$(call PNGCRUSH,$$<,$$@))) + +all: PHONY $(pngs) .gitignore + +clean: PHONY + rm -f -- $(pngs) *.svg.png +.gitignore: $(MAKEFILE_LIST) + printf '%s\n' '*~' '*.svg.png' $(pngs) | LC_COLLATE=C sort > .gitignore + +%.svg.png: %.svg + $(call SVG2PNG,$<,$@,16) + +.PHONY: PHONY +.DELETE_ON_ERROR: |