export ALLTAGS := $(shell bin/listTags) ALLBLOGS := $(shell bin/listBlogs all) STANDALONE := $(subst .md,,$(subst content/,,$(wildcard content/*.md))) .SECONDEXPANSION: .PHONY: blogs tags standalone push-blog push-assets all clean #################### # TEMPLATE PARTS # #################### tmp/templates/taglist.html: mkdir -p tmp/templates/ bin/htmlTagList $(ALLTAGS) > $@ ############ # INTROS # ############ tmp/intros/%.html: content/blog/*-%.md mkdir -p tmp/intros/ bin/htmlIntro $< > $@ tmp/intros/%.rss: content/blog/*-%.md mkdir -p tmp/intros/ bin/rssIntro $< > $@ tmp/intros/%.gmi: content/blog/*-%.md mkdir -p tmp/intros/ bin/gmiIntro $< > $@ ############## # ARCHIVES # ############## public/feed.rss: $(foreach blog, $(ALLBLOGS), tmp/intros/$(blog).rss ) mkdir -p public bin/generateRSS $^ > $@ public/index.html: $(foreach blog, $(ALLBLOGS), tmp/intros/$(blog).html ) mkdir -p public bin/htmlIndex index $^ > $@ public/index.gmi: $(foreach blog, $(ALLBLOGS), tmp/intros/$(blog).gmi ) mkdir -p public bin/gmiIndex index $^ > $@ public/tag/%/index.html: $$(foreach blog, $$(shell bin/listBlogs % ), tmp/intros/$$(blog).html ) tmp/templates/taglist.html mkdir -p $(@D) bin/htmlIndex tag $* $^ > $@ ########### # Pages # ########### public/blog/%/index.html: content/blog/*-%.md tmp/templates/taglist.html mkdir -p $(@D) pandoc --template=templates/blog.html -f markdown -t html5 -M comments $< > $@ public/%/index.html: content/%.md tmp/templates/taglist.html mkdir -p $(@D) pandoc --template=templates/blog.html -f markdown -t html5 -M comments $< > $@ public/blog/%/index.gmi: content/blog/*-%.md mkdir -p $(@D) echo -n "# " > $@ grep 'title: ' $< | cut -d ' ' -f 2- >> $@ echo "" >> $@ md2gemini -f -l paragraph $< >> $@ public/card: content/card.curl > $@ ########### # PHONY # ########### tags: $(foreach tag, $(ALLTAGS), public/tag/$(shell echo $(tag) | tr 'A-Z' 'a-z')/index.html ) blogs: $(foreach blog, $(ALLBLOGS), public/blog/$(shell echo $(blog) | tr 'A-Z' 'a-z')/index.html ) $(foreach blog, $(ALLBLOGS), public/blog/$(shell echo $(blog) | tr 'A-Z' 'a-z')/index.gmi ) standalone: $(foreach page, $(STANDALONE), public/$(page)/index.html ) all: tags blogs standalone public/index.html public/feed.rss public/card push-blog: rsync -azvhP ./public/ generalPurpose:docker/jonathanh/public push-assets: rsync -azvhP ./assets/ generalPurpose:docker/jonathanh/public/assets clean: rm -rf public/* rm -rf tmp/