aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile156
-rw-r--r--config.mk7
-rw-r--r--make-stage-2.mk129
4 files changed, 147 insertions, 146 deletions
diff --git a/.gitignore b/.gitignore
index 6cbd03c..704ad22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@
conv
*.o
*.su
+/generated-rules.mk
diff --git a/Makefile b/Makefile
index 1a64ef1..2071ccf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,150 +1,28 @@
-.NONPOSIX:
+.POSIX:
CONFIGFILE = config.mk
include $(CONFIGFILE)
-DIRS =\
- actions\
- apps\
- categories\
- devices\
- emblems\
- emotes\
- mimetypes\
- places\
- status
+all:
-include icons.mk
-
-ALL_PNG_ICONS = $(foreach S,$(SIZES),$(foreach I,$(ICONS),$(S)x$(S)$(DIR_SUFFIX)/$(I).png))
-
-all: index.theme $(ALL_PNG_ICONS)
-
-all-fast: index.theme all-fast-icons
-
-index.theme: Makefile
- set -e;\
- printf '%s\n' \
- '[Icon Theme]'\
- 'Name=$(THEME_NAME)'\
- 'Comment=$(THEME_DESC)'\
- 'Example=folder'\
- ''\
- '# KDE specific stuff'\
- 'DisplayDepth=32'\
- 'LinkOverlay=link_overlay'\
- 'LockOverlay=lock_overlay'\
- 'ZipOverlay=zip_overlay'\
- 'DesktopDefault=48'\
- 'DesktopSizes='$$(printf ',%s' $(SIZES) | sed 's/^,//')\
- 'ToolbarDefault=22'\
- 'ToolbarSizes=8,16,22,32,48'\
- 'MainToolbarDefault=22'\
- 'MainToolbarSizes=8,16,22,32,48'\
- 'SmallDefault=16'\
- 'SmallSizes=16'\
- 'PanelDefault=32'\
- 'PanelSizes='$$(printf ',%s' $(SIZES) | sed 's/^,//')\
- ''\
- > index.theme
- printf 'Directories=' >> index.theme
- set -e;\
- for s in $(SIZES); do\
- for d in $(DIRS); do\
- printf ',%sx%s/%s' $$s $$s $$d;\
- done;\
- done | sed 's/^,//' >> index.theme
- set -e;\
- for d in $(DIRS); do\
- printf ',scalable/%s' $$d;\
- done >> index.theme
- printf '\n' >> index.theme
- set -e;\
- for s in $(SIZES) scalable; do\
- for d in $(DIRS); do\
- printf '\n';\
- ./make-dir-info $$s $$d;\
- done;\
- done >> index.theme
-
-all-fast-icons: $(ICONS:=.x)
-
-scalable-$(DIR_SUFFIX_)/%.svg: scalable/%.svg
- @mkdir -p -- "$$(dirname "$@")"
- if ! test "$@" = "scalable/$*.svg"; then\
- if test -L "scalable/$*.svg"; then\
- ln -s "$$(readlink -- "scalable/$*.svg")" $@;\
- else\
- sed < scalable/$*.svg > $@\
- -e 's/#[bB][eE][bB][eE][bB][eE]/#$(BASE_COLOUR)/g'\
- -e 's/#[eE][fF]2929/#$(ALARM_RED)/g'\
- -e 's/#[fF]57900/#$(ALARM_ORANGE)/g'\
- -e 's/#[cC][dD]656[cC]/#$(RED)/g'\
- -e 's/#[dD]69553/#$(ORANGE)/g'\
- -e 's/#[cC][cC][aA][dD]47/#$(YELLOW)/g'\
- -e 's/#32[aA]679/#$(GREEN)/g'\
- -e 's/#00[aA]09[fF]/#$(CYAN)/g'\
- -e 's/#2495[bB][eE]/#$(BLUE)/g'\
- -e 's/#[aA]46[eE][bB]0/#$(MAGENTA)/g'\
- -e 's/#000000/#$(OUTLINE)/g';\
- fi;\
- fi
-
-%.x: conv
- @if test -n "$(DIR_SUFFIX)"; then make scalable$(DIR_SUFFIX)/$*.svg; fi
- @ # Does work as a dependeny in GNU make for some reason,
- @ # additionally, this lets us avoid starting make once
- @ # extra for every icon
- ./conv scalable$(DIR_SUFFIX)/$*.svg $(SIZES)
-
-conv: conv.c
- $(CC) -o $@ $< $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
-
-8x8$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
- ./conv $@
-
-16x16$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
- ./conv $@
-
-22x22$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
- ./conv $@
-
-24x24$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
- ./conv $@
-
-32x32$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
- ./conv $@
-
-36x36$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
- ./conv $@
-
-48x48$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
- ./conv $@
-
-install: index.theme $(ALL_PNG_ICONS)
- mkdir -p -- "$(DESTDIR)$(ICONPREFIX)"
- set -e;\
- for d in $(DIRS); do\
- for s in $(SIZES); do\
- mkdir -p -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/$${s}x$${s}/$${d}";\
- done;\
- mkdir -p -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/scalable/$${d}";\
- done
- set -e;\
- for i in $(ICONS); do\
- for s in $(SIZES); do\
- cp -P -- "$${s}x$${s}$(DIR_SUFFIX)/$${i}.png" "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/$${s}x$${s}/$${i}.png";\
- done;\
- cp -P -- "scalable$(DIR_SUFFIX)/$${i}.svg" "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/scalable/$${i}.svg";\
- done
- cp -- index.theme "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/index.theme"
-
-uninstall:
- rm -rf -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)"
+generated-rules.mk: $(CONFIGFILE)
+ @test ! -e $@ || chmod -- u+w $@
+ printf '# %s\n' 'This file is generated from Makefile' > $@
+ printf '\n%1i$$(DIR_SUFFIX)/%%.png: scalable$$(DIR_SUFFIX)/%%.svg conv\n\t./conv $$@\n' $(SIZES) | \
+ sed 's/^[0-9]\+/&x&/' >> $@
+ @chmod -- a-w $@
clean:
- -rm -f -- index.theme *.o *.su conv
+ -rm -f -- index.theme *.o *.su conv generated-rules.mk
-if test -n "$(DIR_SUFFIX)"; then rm -rf -- scalable$(DIR_SUFFIX); fi
-for s in $(SIZES); do printf "$${s}x$${s}$(DIR_SUFFIX)\n"; done | xargs rm -rf --
+# These are just added so autocompletion works with them
+all all-fast all-fast-icons install uninstall index.theme conv: generated-rules.mk
+ +@$(MAKE) -f make-stage-2.mk $@
+
+.DEFAULT:
+ +@$(MAKE) generated-rules.mk
+ +@$(MAKE) -f make-stage-2.mk $@
+
.PHONY: all all-fast all-fast-icons install uninstall clean
diff --git a/config.mk b/config.mk
index db05de0..026792e 100644
--- a/config.mk
+++ b/config.mk
@@ -21,10 +21,3 @@ OUTLINE = 000000
# Uncomment the two lines above if you want to use customised colours
SIZES = 16 24 32 48
-# Supported sizes are 8, 16, 22, 24, 32, 36, and 48,
-# you you want any other size add
-#
-# ###x###$(DIR_SUFFIX)/%.png: scalable$(DIR_SUFFIX)/%.svg conv
-# ./conv $@
-#
-# with ### replaces for the size to add support for.
diff --git a/make-stage-2.mk b/make-stage-2.mk
new file mode 100644
index 0000000..5482c26
--- /dev/null
+++ b/make-stage-2.mk
@@ -0,0 +1,129 @@
+## Not compatible with POSIX make, tested with GNU make
+
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
+
+DIRS =\
+ actions\
+ apps\
+ categories\
+ devices\
+ emblems\
+ emotes\
+ mimetypes\
+ places\
+ status
+
+include icons.mk
+
+ALL_PNG_ICONS = $(foreach S,$(SIZES),$(foreach I,$(ICONS),$(S)x$(S)$(DIR_SUFFIX)/$(I).png))
+
+all: index.theme $(ALL_PNG_ICONS)
+
+all-fast: index.theme all-fast-icons
+
+index.theme: Makefile
+ set -e;\
+ printf '%s\n' \
+ '[Icon Theme]'\
+ 'Name=$(THEME_NAME)'\
+ 'Comment=$(THEME_DESC)'\
+ 'Example=folder'\
+ ''\
+ '# KDE specific stuff'\
+ 'DisplayDepth=32'\
+ 'LinkOverlay=link_overlay'\
+ 'LockOverlay=lock_overlay'\
+ 'ZipOverlay=zip_overlay'\
+ 'DesktopDefault=48'\
+ 'DesktopSizes='$$(printf ',%s' $(SIZES) | sed 's/^,//')\
+ 'ToolbarDefault=22'\
+ 'ToolbarSizes=8,16,22,32,48'\
+ 'MainToolbarDefault=22'\
+ 'MainToolbarSizes=8,16,22,32,48'\
+ 'SmallDefault=16'\
+ 'SmallSizes=16'\
+ 'PanelDefault=32'\
+ 'PanelSizes='$$(printf ',%s' $(SIZES) | sed 's/^,//')\
+ ''\
+ > index.theme
+ printf 'Directories=' >> index.theme
+ set -e;\
+ for s in $(SIZES); do\
+ for d in $(DIRS); do\
+ printf ',%sx%s/%s' $$s $$s $$d;\
+ done;\
+ done | sed 's/^,//' >> index.theme
+ set -e;\
+ for d in $(DIRS); do\
+ printf ',scalable/%s' $$d;\
+ done >> index.theme
+ printf '\n' >> index.theme
+ set -e;\
+ for s in $(SIZES) scalable; do\
+ for d in $(DIRS); do\
+ printf '\n';\
+ ./make-dir-info $$s $$d;\
+ done;\
+ done >> index.theme
+
+all-fast-icons: $(ICONS:=.x)
+
+scalable-$(DIR_SUFFIX_)/%.svg: scalable/%.svg
+ @mkdir -p -- "$$(dirname "$@")"
+ if ! test "$@" = "scalable/$*.svg"; then\
+ if test -L "scalable/$*.svg"; then\
+ ln -sf "$$(readlink -- "scalable/$*.svg")" $@;\
+ else\
+ sed < scalable/$*.svg > $@\
+ -e 's/#[bB][eE][bB][eE][bB][eE]/#$(BASE_COLOUR)/g'\
+ -e 's/#[eE][fF]2929/#$(ALARM_RED)/g'\
+ -e 's/#[fF]57900/#$(ALARM_ORANGE)/g'\
+ -e 's/#[cC][dD]656[cC]/#$(RED)/g'\
+ -e 's/#[dD]69553/#$(ORANGE)/g'\
+ -e 's/#[cC][cC][aA][dD]47/#$(YELLOW)/g'\
+ -e 's/#32[aA]679/#$(GREEN)/g'\
+ -e 's/#00[aA]09[fF]/#$(CYAN)/g'\
+ -e 's/#2495[bB][eE]/#$(BLUE)/g'\
+ -e 's/#[aA]46[eE][bB]0/#$(MAGENTA)/g'\
+ -e 's/#000000/#$(OUTLINE)/g';\
+ fi;\
+ fi
+
+%.x: conv
+ @if test -n "$(DIR_SUFFIX)"; then $(MAKE) scalable$(DIR_SUFFIX)/$*.svg; fi
+ @ # Does work as a dependeny in GNU make for some reason,
+ @ # additionally, this lets us avoid starting make once
+ @ # extra for every icon
+ ./conv scalable$(DIR_SUFFIX)/$*.svg $(SIZES)
+
+conv: conv.c
+ $(CC) -o $@ $< $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+
+include generated-rules.mk
+
+install: index.theme $(ALL_PNG_ICONS)
+ mkdir -p -- "$(DESTDIR)$(ICONPREFIX)"
+ set -e;\
+ for d in $(DIRS); do\
+ for s in $(SIZES); do\
+ mkdir -p -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/$${s}x$${s}/$${d}";\
+ done;\
+ mkdir -p -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/scalable/$${d}";\
+ done
+ set -e;\
+ for i in $(ICONS); do\
+ for s in $(SIZES); do\
+ cp -P -- "$${s}x$${s}$(DIR_SUFFIX)/$${i}.png" "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/$${s}x$${s}/$${i}.png";\
+ done;\
+ cp -P -- "scalable$(DIR_SUFFIX)/$${i}.svg" "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/scalable/$${i}.svg";\
+ done
+ cp -- index.theme "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)/index.theme"
+
+uninstall:
+ rm -rf -- "$(DESTDIR)$(ICONPREFIX)/$(THEME_DIR)"
+
+clean:
+ +@$(MAKE) -f Makefile clean
+
+.PHONY: all all-fast all-fast-icons install uninstall clean