summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2010-04-07 19:10:39 +0100
committerNick White <git@njw.me.uk>2010-04-07 19:10:39 +0100
commitb0e20294ede98e023317c090803dad1ba54578b1 (patch)
treea7ce0253a9abe5ef96e78aa293aac10a869dbd7d /Makefile
downloadnjw-website-b0e20294ede98e023317c090803dad1ba54578b1.tar.bz2
njw-website-b0e20294ede98e023317c090803dad1ba54578b1.zip
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..71cf825
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+# See COPYING file for copyright, license and warranty details.
+
+SITENAME=njw.me.uk
+MARKDOWN=smu
+
+RSS=rss.rdf
+PAGES=$(shell find . -name '*.txt' ! -name 'robots.txt' ! -name $(RSS))
+EXTRAS=$(shell find . -name '*.css')
+TARGETS=$(PAGES:.txt=.xml) $(RSS)
+GZIP=$(PAGES:=.gz) $(TARGETS:=.gz) $(EXTRAS:=.gz)
+
+all: $(TARGETS) $(GZIP)
+
+$(TARGETS): includes/header.xml includes/footer.xml
+
+$(RSS): $(PAGES)
+ @echo making $@
+ @sh makerss.sh $(SITENAME) $* > $@
+
+index.xml: index.txt includes/header-index.xml includes/footer.xml
+ @echo making $@
+ @sed "s/TITLE/`head -n 1 < $<`/" < includes/header-index.xml > $@
+ @$(MARKDOWN) $< >> $@
+ @sed "s/MODDATE/`ls -lc $<|awk '{print $$6}'`/" < includes/footer.xml >> $@
+
+.txt.xml:
+ @echo making $@
+ @sed "s/TITLE/`head -n 1 < $<`/" < includes/header.xml > $@
+ @$(MARKDOWN) $< >> $@
+ @sed "s/MODDATE/`ls -lc $<|awk '{print $$6}'`/" < includes/footer.xml >> $@
+
+# bug: if any target changes, all are recompressed
+$(GZIP): $(TARGETS)
+ @echo compressing $*
+ @gzip < $* >> $@
+
+clean:
+ rm -f -- $(TARGETS) $(GZIP)
+
+.SUFFIXES: .txt .xml .rdf .gz