summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-11-27 15:24:25 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-11-27 15:24:25 -0500
commit7d6044395bdf9dbd4b06251f5e78c1016937e627 (patch)
tree6d94e106e2ebd2e13d709120b81129808ea25b7f
parent592e7b2b8213cc74e7bcf812cbee7c6db812757d (diff)
move non-generic things into theme.mk, add `clean' and `distclean' rules
-rw-r--r--.gitignore5
-rw-r--r--Makefile36
2 files changed, 27 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index 3c706a1..d348d80 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,14 +3,15 @@
# ignore everyting
*
# but these:
-!.gitignore
!img
img/*
!img/swoosh.svg
!style.scss
!header.php.patch
-!Makefile
!logo-style.scss.php
!license.txt
!css_shadow.php
!twentyeleven-fix.scss
+!.gitignore
+!theme.mk
+!Makefile
diff --git a/Makefile b/Makefile
index f0eb157..6f3ba14 100644
--- a/Makefile
+++ b/Makefile
@@ -6,20 +6,12 @@ PATCH = patch
SASS = sass
PHP := $(firstword $(call pathsearch,php5) $(call pathsearch,php))
-srcfiles = \
- .gitignore \
- img/swoosh.svg \
- style.scss \
- header.php.patch \
- Makefile \
- logo-style.scss.php \
- license.txt \
- css_shadow.php \
- twentyeleven-fix.scss
+default: all
-all: header.php style.css img/swoosh.png .gitignore
+include theme.mk
+srcfiles += .gitignore theme.mk Makefile
-style.css: logo-style.scss twentyeleven-fix.scss
+all: .gitignore $(targets)
%: %.patch ../twentyeleven/%
$(RM) $@
@@ -35,6 +27,7 @@ style.css: logo-style.scss twentyeleven-fix.scss
%.png: %.svg
rsvg-convert $< > $@.$$$$ && pngcrush $@.$$$$ $@ ; $(RM) $@.$$$$
+################################################################################
in_dir = $(patsubst ./%,%,$(dir $1))
my_dir = $(patsubst %/,%,$(dir $1))
@@ -53,3 +46,22 @@ endef
echo '*' >> '$@'
echo '# but these:' >> '$@'
$(foreach file,$(srcfiles),$(call gitignore_file,$(file)))
+
+################################################################################
+
+git2make = $1 $(subst *,.*,$1)
+gitignore_y = $(call git2make,$(shell sed -n 's/^[^\#!]/&/p' .gitignore))
+gitignore_n = $(call git2make,$(shell sed -n 's/^!//p' .gitignore))
+gitignore_i = . .. .git %/.. %/.
+gitignore = $(filter-out $(gitignore_i) $(wildcard $(gitignore_n)),$(wildcard $(gitignore_y)))
+
+clean: .gitignore PHONY
+ $(RM) -r $(filter-out $(targets),$(gitignore))
+distclean: .gitignore PHONY
+ $(RM) -r $(gitignore)
+
+################################################################################
+
+.PHONY: FORCE PHONY
+FORCE: ;
+PHONY: ;