Skip to content

Instantly share code, notes, and snippets.

@mariocesar

mariocesar/Makefile

Last active Nov 25, 2020
Embed
What would you like to do?
Build all icons and favicon needed for a webpage, using a svg input file
INKSCAPE_BIN ?= flatpak run org.inkscape.Inkscape
iconsizes = 16 32 48 57 60 72 76 96 120 144 152 180 192 256 300
iconnames = $(addsuffix .png, $(addprefix icons/icon-, $(iconsizes)))
all: icons icons/favicon.ico $(iconnames)
@echo = Done =
icons:
mkdir -p icons
icons/icon.svg:
scour svg/logo_icon.svg --remove-metadata icons/icon.svg
$(iconnames): icons/icon-%.png: icons/icon.svg
$(INKSCAPE_BIN) \
icons/icon.svg \
-w $* -h $* \
-o $@
optipng $@
icons/favicon.ico: icons/icon-16.png icons/icon-32.png icons/icon-48.png
convert \
-background transparent \
icons/icon-16.png \
icons/icon-32.png \
icons/icon-48.png \
icons/favicon.ico
clean:
rm -f $(iconnames)
rm -f icons/favicon.ico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment