2020-06-14 20:56:58 +08:00
|
|
|
TOOLS_DIR := ./tools
|
2018-08-28 03:57:51 +08:00
|
|
|
DST_DIR = ./_dst
|
|
|
|
PUBLISH_DIR := ./_publish
|
2018-06-13 05:58:16 +08:00
|
|
|
|
2020-06-14 20:56:58 +08:00
|
|
|
MDS := home.md $(filter-out %/README.md,$(wildcard [^_]*/*.md))
|
2018-06-06 04:33:59 +08:00
|
|
|
HTMLS := $(MDS:.md=.html)
|
2018-06-13 05:58:16 +08:00
|
|
|
|
2020-06-14 19:45:17 +08:00
|
|
|
TOOLS := highlight macros elvdoc genblog
|
2018-06-06 04:33:59 +08:00
|
|
|
|
|
|
|
default: gen
|
|
|
|
|
2018-08-28 03:57:51 +08:00
|
|
|
%.html: %.md $(TOOL_BINARIES) $(TOOLS_DIR)/md-to-html
|
|
|
|
$(TOOLS_DIR)/md-to-html $< $@
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2018-06-06 04:38:39 +08:00
|
|
|
# Generates the website into the dst directory.
|
2020-06-14 19:45:17 +08:00
|
|
|
gen: tools $(HTMLS)
|
2021-02-16 05:21:41 +08:00
|
|
|
$(TOOLS_DIR)/genblog.bin . $(DST_DIR)
|
2020-06-15 07:06:28 +08:00
|
|
|
ln -sf `pwd`/fonts.css `pwd`/favicons/* $(DST_DIR)/
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2019-12-26 19:28:48 +08:00
|
|
|
tools:
|
|
|
|
for tool in $(TOOLS); do \
|
2020-06-14 20:56:58 +08:00
|
|
|
go build -o $(TOOLS_DIR)/$$tool.bin ./cmd/$$tool; \
|
2019-12-26 19:28:48 +08:00
|
|
|
done
|
|
|
|
|
2020-06-14 20:43:37 +08:00
|
|
|
genblog:
|
|
|
|
: # a nop, kept for backward compatibility with elves/up
|
|
|
|
|
2019-12-26 19:28:48 +08:00
|
|
|
# Synchronizes the generated website into $(PUBLISH_DIR). The PUBLISH_DIR
|
2020-10-06 02:35:52 +08:00
|
|
|
# environment variable can be overridden to a remote place to publish this online.
|
2018-06-06 04:33:59 +08:00
|
|
|
publish: gen
|
2018-08-28 03:57:51 +08:00
|
|
|
rsync -aLv --delete ./_dst/ $(PUBLISH_DIR)/
|
2018-06-06 04:33:59 +08:00
|
|
|
|
|
|
|
clean:
|
2019-12-26 19:28:48 +08:00
|
|
|
rm -f $(HTMLS) _tools/*.bin
|
2018-08-28 03:57:51 +08:00
|
|
|
rm -rf $(DST_DIR)
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2020-06-14 20:43:37 +08:00
|
|
|
.PHONY: default gen tools genblog publish clean
|
2018-06-13 05:58:16 +08:00
|
|
|
.SECONDARY: $(TOOL_BINARIES)
|