summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-11-29 17:09:39 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-11-29 17:09:39 -0500
commit5714a584a3f8cd576df4a2042286b10cf76e54c3 (patch)
tree51b6170dc208ac4939c0e932bed4269523db15cf /Makefile
parentea262045fbf26c153e6e4c46b5b67ad296cda8c1 (diff)
Add ability to use imagemagick convert instead of rsvg-convert
* Add `pick' function to pick the first program found in $PATH from a list * Set SVG2PNG = $(call pick,rsvg-convert convert) * If SVG2PNG resolves to rsvg-convert, set SVG2PNG_OUTFLAG=-o * Change the SVG2PNG invocation from $(SVG2PNG) $< > $@.$$$$ to $(SVG2PNG) $< $(SVG2PNG_OUTFLAG) $@.$$$$
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 13 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 7df9dba..550c18b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,16 @@
pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
+pick = $(firstword $(foreach prog,$1,$(call pathsearch,$(prog))) false)
RM = rm -f
CP = cp
PATCH = patch
SASS = sass
-PHP := $(firstword $(call pathsearch,php5) $(call pathsearch,php))
-SVG2PNG = rsvg-convert
-PNGCRUSH = $(firstword $(call pathsearch,pngcrush) $(call pathsearch,cp))
+PHP = $(call pick,php5 php)
+PNGCRUSH = $(call pick,pngcrush cp)
+SVG2PNG = $(call pick,rsvg-convert convert)
+ifeq ($(notdir $(SVG2PNG)),rsvg-convert)
+SVG2PNG_OUTFLAG = -o
+endif
default: all
@@ -28,9 +32,11 @@ all: .gitignore $(targets)
$(PHP) -f $< > $@
%.png: %.svg
- $(SVG2PNG) $< > $@.$$$$ && $(PNGCRUSH) $@.$$$$ $@ ; $(RM) $@.$$$$
+ $(SVG2PNG) $< $(SVG2PNG_OUTFLAG) $@.$$$$ && \
+ $(PNGCRUSH) $@.$$$$ $@ ; \
+ $(RM) $@.$$$$
-################################################################################
+###########################################################################
in_dir = $(patsubst ./%,%,$(dir $1))
my_dir = $(patsubst %/,%,$(dir $1))
@@ -50,7 +56,7 @@ endef
echo '# but these:' >> '$@'
$(foreach file,$(srcfiles),$(call gitignore_file,$(file)))
-################################################################################
+###########################################################################
git2make = $1 $(subst *,.*,$1)
gitignore_y = $(call git2make,$(shell sed -n 's/^[^\#!]/&/p' .gitignore))
@@ -63,7 +69,7 @@ clean: .gitignore PHONY
distclean: .gitignore PHONY
$(RM) -r $(gitignore)
-################################################################################
+###########################################################################
.PHONY: FORCE PHONY
FORCE: ;