diff options
-rw-r--r-- | Makefile | 33 |
1 files changed, 28 insertions, 5 deletions
@@ -2,23 +2,46 @@ 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) -SOURCES=$(wildcard src/*.md src/**/*.md) 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) +all: $(HTML) $(RSS) out/%.html: $(HEADER) tmp/%.content.html - mkdir -p $(@D) + @mkdir -p $(@D) cat $^ > $@ tmp/%.content.html: src/%.md - mkdir -p $(@D) - cat $< | pandoc $(PANDOC_ARGS) > $@ + @mkdir -p $(@D) + pandoc $(PANDOC_ARGS) $< > $@ + +$(RSS): $(BLOG_XML) + @echo $@ + @echo '<rss version="2.0"><channel>' > $@ + @echo "<title>TODO</title><link>TODO</link><description>TODO</description>" >> $@ + @echo "<lastBuildDate>$$(date --rfc-email)</lastBuildDate>" >> $@ + cat $^ >> $@ + @echo '</channel></rss>' >> $@ + +tmp/%.xml: tmp/%.content.html + @echo '<item>' > $@ + @echo " <link>TODO</link>" >> $@ + @echo " <pubDate>TODO</pubDate>" >> $@ + @echo " <title>TODO</title>" >> $@ + @echo " <description><![CDATA[" >> $@ + cat $< >> $@ + @echo " ]]></description>" >> $@ + @echo '</item>' >> $@ clean: rm -rf tmp out |