# # All-in-one website favicon generator # Copyright (C) 2019 Illya Marchenko # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . CC = magick FILE ?= source.png # Files & forlders DIST = dist override DIST := $(DIST)/ override dist_public = $(DIST)public/ override dist_icons = $(DIST)public/icons/ ICON_PATH = /icons override ICON_PATH := $(ICON_PATH)/ override define file_manifest @echo '{' > $(dist_public)manifest.json @echo ' "name": "",' >> $(dist_public)manifest.json @echo ' "short_name": "",' >> $(dist_public)manifest.json @echo ' "icons": [' >> $(dist_public)manifest.json @echo ' {' >> $(dist_public)manifest.json @echo ' "src": "'$(ICON_PATH)'android-chrome-192x192.png",' >> $(dist_public)manifest.json @echo ' "sizes": "192x192",' >> $(dist_public)manifest.json @echo ' "type": "image/png"' >> $(dist_public)manifest.json @echo ' },' >> $(dist_public)manifest.json @echo ' {' >> $(dist_public)manifest.json @echo ' "src": "'$(ICON_PATH)'android-chrome-512x512.png",' >> $(dist_public)manifest.json @echo ' "sizes": "512x512",' >> $(dist_public)manifest.json @echo ' "type": "image/png"' >> $(dist_public)manifest.json @echo ' }' >> $(dist_public)manifest.json @echo ' ],' >> $(dist_public)manifest.json @echo ' "theme_color": "",' >> $(dist_public)manifest.json @echo ' "background_color": "",' >> $(dist_public)manifest.json @echo ' "display": "standalone"' >> $(dist_public)manifest.json @echo '}' >> $(dist_public)manifest.json endef override define file_ieconfig @echo '' > $(dist_icons)ieconfig.xml @echo '' >> $(dist_icons)ieconfig.xml @echo ' ' >> $(dist_icons)ieconfig.xml @echo ' ' >> $(dist_icons)ieconfig.xml @echo ' ' >> $(dist_icons)ieconfig.xml @echo ' ' >> $(dist_icons)ieconfig.xml @echo ' ' >> $(dist_icons)ieconfig.xml @echo ' ' >> $(dist_icons)ieconfig.xml @echo ' #ffffff' >> $(dist_icons)ieconfig.xml @echo ' ' >> $(dist_icons)ieconfig.xml @echo ' ' >> $(dist_icons)ieconfig.xml @echo '' >> $(dist_icons)ieconfig.xml endef override define file_source @echo '' > $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html @echo '' >> $(DIST)source.html endef all: $(FILE) -mkdir $(DIST) $(dist_public) -mkdir $(DIST) $(dist_icons) @echo "Generating.. Regular icons" $(CC) $(FILE) -resize 16x16! $(dist_icons)favicon-16x16.png $(CC) $(FILE) -resize 32x32! $(dist_icons)favicon-32x32.png $(CC) $(FILE) -resize 48x48! $(dist_icons)favicon-48x48.png $(CC) $(FILE) -resize 57x57! $(dist_icons)favicon-57x57.png $(CC) $(FILE) -resize 76x76! $(dist_icons)favicon-76x76.png $(CC) $(FILE) -resize 96x96! $(dist_icons)favicon-96x96.png $(CC) $(FILE) -resize 128x128! $(dist_icons)favicon-128x128.png $(CC) $(FILE) -resize 192x192! $(dist_icons)favicon-192x192.png $(CC) $(FILE) -resize 192x192! $(dist_icons)favicon-196x196.png $(CC) $(FILE) -resize 228x228! $(dist_icons)favicon-228x228.png @echo "Packing.. triple-sized favicon.ico" $(CC) $(dist_icons)favicon-16x16.png $(dist_icons)favicon-32x32.png $(dist_icons)favicon-48x48.png $(dist_public)favicon.ico @echo "Generating.. Android icons" $(CC) $(FILE) -resize 196x196! $(dist_icons)favicon-196x196.png $(CC) $(FILE) -resize 192x192! $(dist_icons)android-chrome-192x192.png $(CC) $(FILE) -resize 196x196! $(dist_icons)android-chrome-512x512.png @echo "Generating.. Apple icons" $(CC) $(FILE) -resize 57x57! $(dist_icons)apple-touch-icon-57x57.png $(CC) $(FILE) -resize 114x114! $(dist_icons)apple-touch-icon-114x114.png $(CC) $(FILE) -resize 72x72! $(dist_icons)apple-touch-icon-72x72.png $(CC) $(FILE) -resize 144x144! $(dist_icons)apple-touch-icon-144x144.png $(CC) $(FILE) -resize 60x60! $(dist_icons)apple-touch-icon-60x60.png $(CC) $(FILE) -resize 120x120! $(dist_icons)apple-touch-icon-120x120.png $(CC) $(FILE) -resize 76x76! $(dist_icons)apple-touch-icon-76x76.png $(CC) $(FILE) -resize 152x152! $(dist_icons)apple-touch-icon-152x152.png $(CC) $(FILE) -resize 180x180! $(dist_icons)apple-touch-icon.png $(CC) $(FILE) -resize 180x180! $(dist_public)apple-touch-icon.png $(CC) $(FILE) -resize 180x180! -quality 80% $(dist_public)apple-touch-icon-precomposed.png @echo "Generating.. IE 10 Metro tile icons" $(CC) $(FILE) -resize 144x144! $(dist_icons)mstile-144x144.png @echo "Generating.. IE 11 Metro tile for Windows 8.1 start screen" $(CC) $(FILE) -resize 70x70! $(dist_icons)mstile-small.png $(CC) $(FILE) -resize 150x150! $(dist_icons)mstile-medium.png $(CC) $(FILE) -resize 310x150! $(dist_icons)mstile-wide.png $(CC) $(FILE) -resize 310x310! $(dist_icons)mstile-large.png @echo "Generating.. manifest.json" $(file_manifest) @echo "Generating.. ieconfig.xml" $(file_ieconfig) @echo "Generating.. source.html" $(file_source) @echo "Done." .PHONY: clean clean: $(RM) -r $(DIST)* $(subst /,,$(DIST))