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