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
|
|
|
# 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-05 06:38:08 +08:00
|
|
|
ifdef TTYSHOT
|
2023-03-02 06:39:06 +08:00
|
|
|
%.ttyshot.html: %.elvts tools/ttyshot.bin
|
2022-08-09 20:43:21 +08:00
|
|
|
tools/ttyshot.bin $(if $(findstring verbose,$(TTYSHOT)),-v,) -o $@ $<
|
2022-08-05 06:38:08 +08:00
|
|
|
else
|
|
|
|
%.ttyshot.html:
|
|
|
|
@: ttyshot generation disabled by default
|
|
|
|
endif
|
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:
|
|
|
|
|
2024-01-09 07:30:15 +08:00
|
|
|
# Rules below have dynamic prerequisite lists, which requires GNU Make's
|
|
|
|
# .SECONDEXPANSION.
|
2021-11-29 22:08:05 +08:00
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
2023-01-02 02:09:58 +08:00
|
|
|
tools/%.bin: cmd/% $$(wildcard cmd/%/*) go.mod ../go.mod $$(shell tools/cmd-deps ./cmd/%)
|
2021-11-29 22:08:05 +08:00
|
|
|
go build -o $@ ./$<
|
2018-06-06 04:33:59 +08:00
|
|
|
|
2023-01-02 02:09:58 +08:00
|
|
|
%.html: %.md tools/md2html.bin $$(shell tools/md-deps $$@)
|
2023-01-02 01:53:23 +08:00
|
|
|
tools/md2html.bin < $< > $@
|