-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
99 lines (78 loc) · 2.95 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#
# Dan Wilcox <[email protected]> 2017
#
UNAME = $(shell uname)
NAME=pd
SRC_PNG=masters/icon1024.png
SRC_PNG_FILE=masters/GenericDocumentIcon.png
SRC_SVG=masters/icon.svg
ICO=$(NAME).ico
ICNS=$(NAME).icns
ICONSET=$(NAME).iconset
FILE=$(NAME)-file.png
ICNS_FILE=$(NAME)-file.icns
ICONSET_FILE=$(NAME)-file.iconset
GIF=$(NAME).gif
XPM=$(NAME).xpm
.PHONY: clean
all: $(ICO) $(ICNS) $(ICNS_FILE) $(GIF)
# Windows ico
$(ICO): $(SRC_PNG)
convert $(SRC_PNG) -define icon:auto-resize=256,128,64,48,32,16 $(ICO)
# shrink & composite over default macOS file icon
$(FILE): $(SRC_PNG)
convert $(SRC_PNG_FILE) \( $(SRC_PNG) -resize 512 \) \
-gravity center -geometry +0+0 -composite $(FILE)
# macOS iconsets
ifeq ($(UNAME), Darwin)
# app icon
$(ICNS): $(SRC_PNG)
mkdir $(ICONSET)
sips -z 16 16 $(SRC_PNG) --out $(ICONSET)/icon_16x16.png
sips -z 32 32 $(SRC_PNG) --out $(ICONSET)/[email protected]
sips -z 32 32 $(SRC_PNG) --out $(ICONSET)/icon_32x32.png
sips -z 64 64 $(SRC_PNG) --out $(ICONSET)/[email protected]
sips -z 128 128 $(SRC_PNG) --out $(ICONSET)/icon_128x128.png
sips -z 256 256 $(SRC_PNG) --out $(ICONSET)/[email protected]
sips -z 256 256 $(SRC_PNG) --out $(ICONSET)/icon_256x256.png
sips -z 512 512 $(SRC_PNG) --out $(ICONSET)/[email protected]
sips -z 512 512 $(SRC_PNG) --out $(ICONSET)/icon_512x512.png
cp $(SRC_PNG) $(ICONSET)/[email protected]
iconutil -c icns $(ICONSET)
rm -rf $(ICONSET)
# document icon
$(ICNS_FILE): $(FILE)
mkdir $(ICONSET_FILE)
sips -z 16 16 $(FILE) --out $(ICONSET_FILE)/icon_16x16.png
sips -z 32 32 $(FILE) --out $(ICONSET_FILE)/[email protected]
sips -z 32 32 $(FILE) --out $(ICONSET_FILE)/icon_32x32.png
sips -z 64 64 $(FILE) --out $(ICONSET_FILE)/[email protected]
sips -z 128 128 $(FILE) --out $(ICONSET_FILE)/icon_128x128.png
sips -z 256 256 $(FILE) --out $(ICONSET_FILE)/[email protected]
sips -z 256 256 $(FILE) --out $(ICONSET_FILE)/icon_256x256.png
sips -z 512 512 $(FILE) --out $(ICONSET_FILE)/[email protected]
sips -z 512 512 $(FILE) --out $(ICONSET_FILE)/icon_512x512.png
cp $(FILE) $(ICONSET_FILE)/[email protected]
iconutil -c icns $(ICONSET_FILE)
rm -rf $(ICONSET_FILE)
else
$(ICNS): $(SRC_PNG)
echo "$(ICNS) can only be generated on macOS"
$(ICNS_FILE): $(SRC_PNG)
echo "$(ICNS_FILE) can only be generated on macOS"
endif
# gif for loading via Tk on Linux, etc
$(GIF): $(SRC_PNG)
convert $(SRC_PNG) -filter box -resize 512 $(GIF)
# xpm for X11 on Linux
# this get's it close enough to be adjusted by hand
$(XPM): $(SRC_PNG)
convert $(SRC_PNG) -filter box -resize 32 $(XPM)
# generate pngs from SVG directly using inkscape
inkscape:
for _res in 16 32 48 64 96 128 256 512 ; do \
inkscape --export-type="png" --export-filename=pd-$${_res}.png \
--export-width $${_res} --export-height $${_res} $(SRC_SVG) ; \
done
clean:
rm -f $(ICO) $(FILE) $(ICNS) $(ICONSET) $(GIF) $(XPM) pd-*.png