# BENZIN Makefile
HEADER=templates/header.html
PANDOC_ARGS=--from=gfm+emoji --to=html --section-divs
RSS=out/blog/index.xml
BLOG_SOURCES=$(wildcard src/blog/*.md)
SOURCES=$(wildcard src/*.md) $(BLOG_SOURCES)
TMP_HTML=$(patsubst src/%.md, tmp/%.content.html, $(SOURCES))
HTML=$(patsubst src/%.md, out/%.html, $(SOURCES))
BLOG_XML=$(patsubst src/%.md, tmp/%.xml, $(BLOG_SOURCES))
.PHONY: clean all
.SECONDARY: $(TMP_HTML)
all: $(HTML) $(RSS)
out/%.html: $(HEADER) tmp/%.content.html
@mkdir -p $(@D)
cat $^ > $@
tmp/%.content.html: src/%.md
@mkdir -p $(@D)
pandoc $(PANDOC_ARGS) $< > $@
$(RSS): $(BLOG_XML)
@echo $@
@echo '' > $@
@echo "TODOTODOTODO" >> $@
@echo "$$(date --rfc-email)" >> $@
cat $^ >> $@
@echo '' >> $@
tmp/%.xml: tmp/%.content.html
@echo '- ' > $@
@echo " TODO" >> $@
@echo " TODO" >> $@
@echo " TODO" >> $@
@echo " > $@
cat $< >> $@
@echo " ]]>" >> $@
@echo '
' >> $@
clean:
rm -rf tmp out