3 SITEURL := https://blog.danieliu.xyz
7 .PHONY: help build clean
10 TEMPLATE_DIR := templates
15 ARTICLE_PATH := $(BUILD_DIR)/article
16 ARTICLE_LIST := $(basename $(shell ls $(SRC_DIR)))
18 # some helper functions
20 export SITEURL="$(SITEURL)"
21 export USERVAR1="$(USERVAR1)"
22 export USERVAR2="$(USERVAR2)"
26 echo 'pinopress help|build|clean'
28 build: $(BUILD_DIR)/rolling.html $(BUILD_DIR)/archive.html $(ARTICLE_PATH)/$(addsuffix .html,$(ARTICLE_LIST))
31 $(BUILD_DIR)/rolling.html:
32 echo 'building rolling file'
34 cat $(TEMPLATE_DIR)/head.template.html $(TEMPLATE_DIR)/rollingbody.template.html $(TEMPLATE_DIR)/foot.template.html > "$@"
35 envsubst < "$@" | sponge "$@"
38 $(BUILD_DIR)/archive.html:
39 echo 'building archive file'
41 cat $(TEMPLATE_DIR)/head.template.html $(TEMPLATE_DIR)/archivebody.template.html $(TEMPLATE_DIR)/foot.template.html > "$@"
42 envsubst < "$@" | sponge "$@"
45 $(ARTICLE_PATH)/%.html: articles/%.md
48 export ARTICLE_TITLE="$(shell ./$(MODULE_DIR)/md-header "$<" name)"
49 export PUBLISHED_DATE="$(shell ./$(MODULE_DIR)/md-header "$<" published)"
50 cat $(TEMPLATE_DIR)/head.template.html > "$@"
51 # module pipeline starts here
52 ./$(MODULE_DIR)/md "$^" >> "$@"
53 # module pipeline ends here
54 cat $(TEMPLATE_DIR)/foot.template.html >> "$@"
55 envsubst < "$@" | sponge "$@"
59 rm $(BUILD_DIR)/rolling.html $(BUILD_DIR)/archive.html $(ARTICLE_PATH)/*