| 1 | BROWSER_SIZES := 16 24 32 48 64 |
| 2 | #ANDROID_SIZES := 72 96 144 192 |
| 3 | # FIXME: The ICO is limited to 8 icons due to a Chrome bug: |
| 4 | # https://bugs.chromium.org/p/chromium/issues/detail?id=1381393 |
| 5 | ANDROID_SIZES := 96 144 192 |
| 6 | WEB_ICON_SIZES := $(BROWSER_SIZES) $(ANDROID_SIZES) |
| 7 | |
| 8 | #IOS_1X_SIZES := 20 29 40 76 # No such devices exist anymore |
| 9 | IOS_2X_SIZES := 40 58 80 120 152 167 |
| 10 | IOS_3X_SIZES := 60 87 120 180 |
| 11 | ALL_IOS_SIZES := $(IOS_1X_SIZES) $(IOS_2X_SIZES) $(IOS_3X_SIZES) |
| 12 | |
| 13 | ALL_ICONS := \ |
| 14 | $(ALL_IOS_SIZES:%=novnc-ios-%.png) \ |
| 15 | novnc.ico |
| 16 | |
| 17 | all: $(ALL_ICONS) |
| 18 | |
| 19 | # Our testing shows that the ICO file need to be sorted in largest to |
| 20 | # smallest to get the apporpriate behviour |
| 21 | WEB_ICON_SIZES_REVERSE := $(shell echo $(WEB_ICON_SIZES) | tr ' ' '\n' | sort -nr | tr '\n' ' ') |
| 22 | WEB_BASE_ICONS := $(WEB_ICON_SIZES_REVERSE:%=novnc-%.png) |
| 23 | .INTERMEDIATE: $(WEB_BASE_ICONS) |
| 24 | |
| 25 | novnc.ico: $(WEB_BASE_ICONS) |
| 26 | convert $(WEB_BASE_ICONS) "$@" |
| 27 | |
| 28 | # General conversion |
| 29 | novnc-%.png: novnc-icon.svg |
| 30 | convert -depth 8 -background transparent \ |
| 31 | -size $*x$* "$(lastword $^)" "$@" |
| 32 | |
| 33 | # iOS icons use their own SVG |
| 34 | novnc-ios-%.png: novnc-ios-icon.svg |
| 35 | convert -depth 8 -background transparent \ |
| 36 | -size $*x$* "$(lastword $^)" "$@" |
| 37 | |
| 38 | # The smallest sizes are generated using a different SVG |
| 39 | novnc-16.png novnc-24.png novnc-32.png: novnc-icon-sm.svg |
| 40 | |
| 41 | clean: |
| 42 | rm -f *.png |