.POSIX:
PAGES := $(shell find _content -name 'index.md' | sed 's/^_content/build/;s/md$$/html/')
PAGES_MD := $(shell find _content -name 'index.md' | sed 's/^_content/build/')
PAGES_FEED := $(shell find _content -name 'index.md' | sed 's/md$$/html/')
STATIC := $(shell find static -type f | sed 's/^/build\//')
IMG := $(shell find _content -regex '.*\.\(png\|gif\|jpg\)$$' | sed 's/^_content/build/')
PANDOC_ARGS = -f markdown-smart --wrap=none --lua-filter filters/*.lua
.PHONY: all
all: $(IMG) build/index.html build/projects/index.html $(PAGES) $(PAGES_MD) build/feed.xml build/feed-archive.xml build/feed.json build/feed-archive.json $(STATIC) build/static/style.css
.PHONY: push
push: all
rsync --delete -vrlc build/ ce9e:/var/www/blog
build/%.html: build/%.md _templates/base.html filters/*.lua
pandoc $(PANDOC_ARGS) --template _templates/base.html $< -o $@
@sed -i 's/
/g' $@
build/%.md: _content/%.md
@mkdir -p $$(dirname $@)
ln -f $< $@
build/index.md: _content/posts/*/index.md posts.sh
@mkdir -p $$(dirname $@)
./posts.sh > $@
.PHONY: build/projects/index.md
build/projects/index.md: projects.py
@mkdir -p $$(dirname $@)
python3 projects.py > $@
_content/%.html: _content/%.md filters/*.lua
pandoc $(PANDOC_ARGS) $< -o $@
@sed -i 's/
/g' $@
build/%.png: _content/%.png
@mkdir -p $$(dirname $@)
ln -f $< $@
build/%.jpg: _content/%.jpg
@mkdir -p $$(dirname $@)
ln -f $< $@
build/%.gif: _content/%.gif
@mkdir -p $$(dirname $@)
ln -f $< $@
build/feed.xml: feed-atom.sh $(PAGES_FEED)
./feed-atom.sh > $@
build/feed-archive.xml: feed-atom.sh $(PAGES_FEED)
./feed-atom.sh -a > $@
build/feed.json: feed-json.sh $(PAGES_FEED)
./feed-json.sh > $@
build/feed-archive.json: feed-json.sh $(PAGES_FEED)
./feed-json.sh -a > $@
build/static/%: static/%
@mkdir -p $$(dirname $@)
ln -f $< $@
build/static/style.css: style.css
cat node_modules/mfbs/css/base.css node_modules/mfbs/css/layout.css node_modules/mfbs/css/fontsize.css $< > $@
.PHONY: clean
clean:
rm -rf build
rm -f $(PAGES_FEED)