summaryrefslogtreecommitdiff
path: root/Makefile
blob: bacd28906518dd8660905a8008f5cd66dc4bccf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# See COPYING file for copyright, license and warranty details.

SITENAME=http://njw.me.uk
FOAF=http://njw.me.uk/foaf\#i
MARKDOWN=smu

RSS=rss.n3
PAGES=$(shell find . -name '*.txt' ! -name 'robots.txt' ! -name $(RSS))
EXTRAS=$(shell find . -name '*.css') foaf.n3
TARGETS=$(PAGES:.txt=.xml) $(RSS)
GZIP=$(PAGES:=.gz) $(TARGETS:=.gz) $(EXTRAS:=.gz)

all: $(TARGETS) $(GZIP)

$(TARGETS): includes/header.xml includes/footer.xml

$(RSS): $(PAGES) makerss.sh
	@echo making $@
	@sh makerss.sh $(SITENAME) $(FOAF) $* > $@

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) $(EXTRAS)
	@echo compressing $*
	@gzip < $* >> $@

clean:
	rm -f -- $(TARGETS) $(GZIP)

.SUFFIXES: .txt .xml .rdf .gz