1 #!/usr/bin/make -f 2 3 NAMES := wpa_gui ap laptop group invitation 4 SIZES := 16x16 22x22 32x32 48x48 64x64 128x128 5 ICONS := $(addsuffix .png, $(foreach name, $(NAMES), $(foreach size, $(SIZES), $(size)/$(name)))) 6 ICONS += $(addsuffix .xpm, $(NAMES)) 7 8 ifeq (1, $(shell which inkscape; echo $$?)) 9 $(error "No inkscape in PATH, it is required for exporting icons.") 10 else 11 ifeq (0, $(shell inkscape --without-gui 2>&1 > /dev/null; echo $$?)) 12 # Inkscape < 1.0 13 INKSCAPE_GUI_FLAG := --without-gui 14 INKSCAPE_OUTPUT_FLAG := --export-png 15 else 16 # Inkscape >= 1.0 17 INKSCAPE_GUI_FLAG := 18 INKSCAPE_OUTPUT_FLAG := --export-filename 19 endif 20 endif 21 22 all: $(ICONS) 23 24 %.png: 25 mkdir -p hicolor/$(word 1, $(subst /, ,$(@)))/apps/ 26 inkscape $(subst .png,.svg, $(word 2, $(subst /, , $(@)))) $(INKSCAPE_GUI_FLAG) \ 27 --export-width=$(word 1, $(subst x, , $(@))) \ 28 --export-height=$(word 2, $(subst x, , $(subst /, , $(@)))) \ 29 $(INKSCAPE_OUTPUT_FLAG)=hicolor/$(word 1, $(subst /, ,$(@)))/apps/$(word 2, $(subst /, , $@)) 30 31 %.xpm: 32 mkdir -p pixmaps/ 33 convert hicolor/16x16/apps/$(@:.xpm=.png) pixmaps/$(@:.xpm=-16.xpm) 34 convert hicolor/32x32/apps/$(@:.xpm=.png) pixmaps/$@ 35 36 clean: 37 $(RM) -r pixmaps hicolor 38