diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-11-27 13:39:16 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-11-27 13:39:16 -0500 |
commit | 592e7b2b8213cc74e7bcf812cbee7c6db812757d (patch) | |
tree | 18993adcafbb88287c65d083af09980a76fe9b75 /Makefile | |
parent | a7d01d7e2d8af20a4dd5ea5b15b1a2be197d10cd (diff) |
fix a few issues in Makefile
* find the correct php executable
* don't ignore .gitignore
* fix problems with .gitignore and directories
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -1,10 +1,13 @@ +pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH))))) + RM = rm -f CP = cp PATCH = patch SASS = sass -PHP = php5 +PHP := $(firstword $(call pathsearch,php5) $(call pathsearch,php)) srcfiles = \ + .gitignore \ img/swoosh.svg \ style.scss \ header.php.patch \ @@ -32,10 +35,21 @@ style.css: logo-style.scss twentyeleven-fix.scss %.png: %.svg rsvg-convert $< > $@.$$$$ && pngcrush $@.$$$$ $@ ; $(RM) $@.$$$$ + +in_dir = $(patsubst ./%,%,$(dir $1)) +my_dir = $(patsubst %/,%,$(dir $1)) +define gitignore_file +$(if $(in_dir), + $(call gitignore_file,$(my_dir)) + echo '$(my_dir)/*' >> '$@'; +) +echo '!$1' >> '$@'; +endef + .gitignore: Makefile echo "# DO NOT EDIT, this file is automatically made by \`Makefile'" >$@ echo '# ' >> '$@' echo '# ignore everyting' >> '$@' echo '*' >> '$@' echo '# but these:' >> '$@' - for file in $(srcfiles); do echo !"$$file" >> '$@'; done + $(foreach file,$(srcfiles),$(call gitignore_file,$(file))) |