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
|
|
|
|
2022-01-01 23:26:01 +08:00
|
|
|
MD_TO_HTML_TOOLS = $(addprefix tools/,$(shell grep -o '\w*\.bin' tools/md-to-html))
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2021-11-29 22:08:05 +08:00
|
|
|
# Generates the website into $(DST_DIR).
|
2022-01-01 23:26:01 +08:00
|
|
|
gen: tools/gensite.bin $(HTMLS)
|
2022-01-01 20:06:27 +08:00
|
|
|
tools/gensite.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).
|
2022-01-01 23:26:01 +08:00
|
|
|
docset: tools/gensite.bin $(HTMLS)
|
2022-01-01 20:06:27 +08:00
|
|
|
ELVISH_DOCSET_MODE=1 tools/gensite.bin . $(DOCSET_TMP_DIR)
|
2022-01-01 23:26:01 +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:
|
2022-01-01 23:26:01 +08:00
|
|
|
rm -rf tools/*.bin $(HTMLS) $(DST_DIR) $(DOCSET_TMP_DIR) $(DOCSET_DST_DIR)
|
2021-11-29 22:08:05 +08:00
|
|
|
|
2022-08-01 05:18:59 +08:00
|
|
|
ttyshot/%.html:
|
|
|
|
@echo Exclude ttyshots from the pattern rule for %.html
|
|
|
|
|
2021-12-28 21:13:27 +08:00
|
|
|
|
2022-01-01 23:26:01 +08:00
|
|
|
.PHONY: gen docset publish check-rellinks clean
|
2021-11-29 22:08:05 +08:00
|
|
|
|
2022-01-04 01:54:06 +08:00
|
|
|
# Don't remove intermediate targets
|
|
|
|
.SECONDARY:
|
|
|
|
|
2021-11-29 22:08:05 +08:00
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
2022-08-01 04:55:47 +08:00
|
|
|
tools/%.bin: cmd/% $$(wildcard cmd/%/*)
|
2021-11-29 22:08:05 +08:00
|
|
|
go build -o $@ ./$<
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2022-01-01 23:26:01 +08:00
|
|
|
%.html: %.md tools/md-to-html $(MD_TO_HTML_TOOLS) $$(shell tools/extra-deps $$@)
|
2021-11-29 22:08:05 +08:00
|
|
|
tools/md-to-html $< $@
|