• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/make -f
2
3NAMES := wpa_gui ap laptop group invitation
4SIZES := 16x16 22x22 32x32 48x48 64x64 128x128
5ICONS := $(addsuffix .png, $(foreach name, $(NAMES), $(foreach size, $(SIZES), $(size)/$(name))))
6ICONS += $(addsuffix .xpm, $(NAMES))
7
8ifeq (1, $(shell which inkscape; echo $$?))
9$(error "No inkscape in PATH, it is required for exporting icons.")
10else
11ifeq (0, $(shell inkscape --without-gui 2>&1 > /dev/null; echo $$?))
12# Inkscape < 1.0
13INKSCAPE_GUI_FLAG := --without-gui
14INKSCAPE_OUTPUT_FLAG := --export-png
15else
16# Inkscape >= 1.0
17INKSCAPE_GUI_FLAG :=
18INKSCAPE_OUTPUT_FLAG := --export-filename
19endif
20endif
21
22all: $(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
36clean:
37	$(RM) -r pixmaps hicolor
38