From 7d6044395bdf9dbd4b06251f5e78c1016937e627 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 ++++++++++++++++++++++++------------ 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: ; -- cgit v1.2.3-54-g00ecf