From 355de4027500bc4a94ef63da690b23b336102147 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 27 Nov 2011 15:24:25 -0500 Subject: move non-generic things into theme.mk, add `clean' and `distclean' rules --- .gitignore | 5 +++-- Makefile | 36 ++++++++++++++++++++++++------------ theme.mk | 12 ++++++++++++ 3 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 theme.mk 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: ; diff --git a/theme.mk b/theme.mk new file mode 100644 index 0000000..0c62d19 --- /dev/null +++ b/theme.mk @@ -0,0 +1,12 @@ +srcfiles = \ + img/swoosh.svg \ + style.scss \ + header.php.patch \ + logo-style.scss.php \ + license.txt \ + css_shadow.php \ + twentyeleven-fix.scss + +targets = header.php style.css img/swoosh.png + +style.css: logo-style.scss twentyeleven-fix.scss -- cgit v1.2.3