diff --git a/Makefile b/Makefile index acfe280..636deaf 100755 --- a/Makefile +++ b/Makefile @@ -14,7 +14,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -CC = convert +ifeq ($(OS),Windows_NT) + CC = magick +else + CC = convert +endif + SOURCE ?= source.png # Files & forlders @@ -105,46 +110,46 @@ all: $(SOURCE) -mkdir $(DIST) $(dist_public) $(dist_icons) @echo "Generating.. Regular icons" - @$(CC) $(SOURCE) -resize 16x16! $(dist_icons)favicon-16x16.png - @$(CC) $(SOURCE) -resize 32x32! $(dist_icons)favicon-32x32.png - @$(CC) $(SOURCE) -resize 48x48! $(dist_icons)favicon-48x48.png - @$(CC) $(SOURCE) -resize 57x57! $(dist_icons)favicon-57x57.png - @$(CC) $(SOURCE) -resize 76x76! $(dist_icons)favicon-76x76.png - @$(CC) $(SOURCE) -resize 96x96! $(dist_icons)favicon-96x96.png - @$(CC) $(SOURCE) -resize 128x128! $(dist_icons)favicon-128x128.png - @$(CC) $(SOURCE) -resize 192x192! $(dist_icons)favicon-192x192.png - @$(CC) $(SOURCE) -resize 192x192! $(dist_icons)favicon-196x196.png - @$(CC) $(SOURCE) -resize 228x228! $(dist_icons)favicon-228x228.png + @$(CC) $(SOURCE) -resize 16x16 $(dist_icons)favicon-16x16.png + @$(CC) $(SOURCE) -resize 32x32 $(dist_icons)favicon-32x32.png + @$(CC) $(SOURCE) -resize 48x48 $(dist_icons)favicon-48x48.png + @$(CC) $(SOURCE) -resize 57x57 $(dist_icons)favicon-57x57.png + @$(CC) $(SOURCE) -resize 76x76 $(dist_icons)favicon-76x76.png + @$(CC) $(SOURCE) -resize 96x96 $(dist_icons)favicon-96x96.png + @$(CC) $(SOURCE) -resize 128x128 $(dist_icons)favicon-128x128.png + @$(CC) $(SOURCE) -resize 192x192 $(dist_icons)favicon-192x192.png + @$(CC) $(SOURCE) -resize 192x192 $(dist_icons)favicon-196x196.png + @$(CC) $(SOURCE) -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) $(SOURCE) -resize 196x196! $(dist_icons)favicon-196x196.png - @$(CC) $(SOURCE) -resize 192x192! $(dist_icons)android-chrome-192x192.png - @$(CC) $(SOURCE) -resize 196x196! $(dist_icons)android-chrome-512x512.png + @$(CC) $(SOURCE) -resize 196x196 $(dist_icons)favicon-196x196.png + @$(CC) $(SOURCE) -resize 192x192 $(dist_icons)android-chrome-192x192.png + @$(CC) $(SOURCE) -resize 196x196 $(dist_icons)android-chrome-512x512.png @echo "Generating.. Apple icons" - @$(CC) $(SOURCE) -resize 57x57! $(dist_icons)apple-touch-icon-57x57.png - @$(CC) $(SOURCE) -resize 114x114! $(dist_icons)apple-touch-icon-114x114.png - @$(CC) $(SOURCE) -resize 72x72! $(dist_icons)apple-touch-icon-72x72.png - @$(CC) $(SOURCE) -resize 144x144! $(dist_icons)apple-touch-icon-144x144.png - @$(CC) $(SOURCE) -resize 60x60! $(dist_icons)apple-touch-icon-60x60.png - @$(CC) $(SOURCE) -resize 120x120! $(dist_icons)apple-touch-icon-120x120.png - @$(CC) $(SOURCE) -resize 76x76! $(dist_icons)apple-touch-icon-76x76.png - @$(CC) $(SOURCE) -resize 152x152! $(dist_icons)apple-touch-icon-152x152.png - @$(CC) $(SOURCE) -resize 180x180! $(dist_icons)apple-touch-icon.png - @$(CC) $(SOURCE) -resize 180x180! $(dist_public)apple-touch-icon.png - @$(CC) $(SOURCE) -resize 180x180! -quality 80% $(dist_public)apple-touch-icon-precomposed.png + @$(CC) $(SOURCE) -resize 57x57 $(dist_icons)apple-touch-icon-57x57.png + @$(CC) $(SOURCE) -resize 114x114 $(dist_icons)apple-touch-icon-114x114.png + @$(CC) $(SOURCE) -resize 72x72 $(dist_icons)apple-touch-icon-72x72.png + @$(CC) $(SOURCE) -resize 144x144 $(dist_icons)apple-touch-icon-144x144.png + @$(CC) $(SOURCE) -resize 60x60 $(dist_icons)apple-touch-icon-60x60.png + @$(CC) $(SOURCE) -resize 120x120 $(dist_icons)apple-touch-icon-120x120.png + @$(CC) $(SOURCE) -resize 76x76 $(dist_icons)apple-touch-icon-76x76.png + @$(CC) $(SOURCE) -resize 152x152 $(dist_icons)apple-touch-icon-152x152.png + @$(CC) $(SOURCE) -resize 180x180 $(dist_icons)apple-touch-icon.png + @$(CC) $(SOURCE) -resize 180x180 $(dist_public)apple-touch-icon.png + @$(CC) $(SOURCE) -resize 180x180 -quality 80% $(dist_public)apple-touch-icon-precomposed.png @echo "Generating.. IE 10 Metro tile icons" - @$(CC) $(SOURCE) -resize 144x144! $(dist_icons)mstile-144x144.png + @$(CC) $(SOURCE) -resize 144x144 $(dist_icons)mstile-144x144.png @echo "Generating.. IE 11 Metro tile for Windows 8.1 start screen" - @$(CC) $(SOURCE) -resize 70x70! $(dist_icons)mstile-small.png - @$(CC) $(SOURCE) -resize 150x150! $(dist_icons)mstile-medium.png - @$(CC) $(SOURCE) -resize 310x150! $(dist_icons)mstile-wide.png - @$(CC) $(SOURCE) -resize 310x310! $(dist_icons)mstile-large.png + @$(CC) $(SOURCE) -resize 70x70 $(dist_icons)mstile-small.png + @$(CC) $(SOURCE) -resize 150x150 $(dist_icons)mstile-medium.png + @$(CC) $(SOURCE) -resize 310x150 $(dist_icons)mstile-wide.png + @$(CC) $(SOURCE) -resize 310x310 $(dist_icons)mstile-large.png @echo "Generating.. manifest.json" $(file_manifest) @@ -159,4 +164,4 @@ all: $(SOURCE) .PHONY: clean clean: - $(RM) -r $(DIST)* $(subst /,,$(DIST)) \ No newline at end of file + $(RM) -r $(DIST)* $(subst /,,$(DIST)) diff --git a/README.md b/README.md index 16f6861..abe9875 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ Generates all necessary favicons for your website. This includes iOS Safari, Google Chrome, Mozilla Firefox, Windows 8 and 10, and possibly some other browsers. -# Getting Started +## Getting Started To get started with favicon generator you need to make sure [ImageMagick](https://imagemagick.org/index.php) and the latest [GNU make](https://www.gnu.org/software/make/) software are installed and present in your PATH environment variable. -# Configuration +## Configuration By default, makefile uses `convert` file of ImageMagick software, but you can change that by specifying a new name as a parameter for make -``` +```make make CC= ``` or by changing the following line in a makefile @@ -17,14 +17,14 @@ CC = magick Also, the default image filename make is looking for is `source.png`, and you can change that either passing the new filename as a parameter ``` -make FILE= +make SOURCE= ``` or by changing the following line ``` -FILE ?= +SOURCE ?= ``` -# Using bash +## Using bash You use bash script `generate.sh` to use the program anywhere on your system. First of, you have to create a symbolic link to an executable using the following command ```bash $ ln -s /generate.sh ~/.local/bin/webicongen @@ -36,7 +36,7 @@ $ webicongen ``` The output directory will be created automatically. -# Usage +## Usage After everything is configured, simply place your image in the same directory as makefile, and then simply run `make`. It will generate the following directory structure ``` dist/ @@ -79,7 +79,9 @@ dist/ `public` folder must be the same as your project's public folder, you can simply copy-paste it into your project (make sure you don't have one of these generated files already in your project, such as `manifest.json`). -# Acknowledgements +--- + +## Acknowledgements I would love to hear any ideas or issues regarding this makefile. Make sure to create an issue or a pull request. You can also send me an email to stuzer05 at gmail.com