summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
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: ;