2021-06-13 08:46:27 +08:00
|
|
|
DST_DIR := ./_dst
|
2018-08-28 03:57:51 +08:00
|
|
|
PUBLISH_DIR := ./_publish
|
2021-06-13 08:46:27 +08:00
|
|
|
DOCSET_TMP_DIR := ./_docset_tmp
|
|
|
|
DOCSET_DST_DIR := ./Elvish.docset
|
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
|
|
|
|
2021-11-29 22:08:05 +08:00
|
|
|
TOOL_PKGS := highlight macros elvdoc genblog
|
|
|
|
TOOL_BINS := $(addprefix tools/,$(addsuffix .bin,$(TOOL_PKGS)))
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2021-11-29 22:08:05 +08:00
|
|
|
# Generates the website into $(DST_DIR).
|
|
|
|
gen: $(TOOL_BINS) $(HTMLS)
|
|
|
|
tools/genblog.bin . $(DST_DIR)
|
2021-11-11 07:43:44 +08:00
|
|
|
ln -sf `pwd`/fonts `pwd`/favicons/* $(DST_DIR)/
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2021-11-29 22:08:05 +08:00
|
|
|
# Generates docset into $(DOCSET_DST_DIR).
|
|
|
|
docset: $(TOOL_BINS) $(HTMLS)
|
|
|
|
ELVISH_DOCSET_MODE=1 tools/genblog.bin . $(DOCSET_TMP_DIR)
|
2021-06-15 06:18:22 +08:00
|
|
|
./tools/mkdocset $(DOCSET_TMP_DIR) $(DOCSET_DST_DIR)
|
2021-06-13 08:46:27 +08:00
|
|
|
|
2021-11-29 22:08:05 +08:00
|
|
|
# Synchronizes the generated website into $(PUBLISH_DIR), which is passed to
|
|
|
|
# rsync and can be a remote place.
|
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
|
|
|
|
2021-11-30 03:21:51 +08:00
|
|
|
check-rellinks: gen
|
|
|
|
python3 tools/check-rellinks.py $(DST_DIR)
|
|
|
|
|
2018-06-06 04:33:59 +08:00
|
|
|
clean:
|
2021-11-29 22:08:05 +08:00
|
|
|
rm -rf $(TOOL_BINS) $(HTMLS) $(DST_DIR) $(DOCSET_TMP_DIR) $(DOCSET_DST_DIR)
|
|
|
|
|
|
|
|
.PHONY: gen docset publish clean
|
|
|
|
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
|
|
|
tools/%.bin: cmd/% $$(wildcard cmd/%/*.go)
|
|
|
|
go build -o $@ ./$<
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2021-11-29 22:08:05 +08:00
|
|
|
%.html: %.md $(TOOL_BINS) tools/md-to-html $$(shell tools/ref-deps $$@)
|
|
|
|
tools/md-to-html $< $@
|