mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-11-28 07:21:21 +08:00
e74cda7bc3
This command used to depend on pkg/mods/doc to access the embedded .elv, which
in turn depends on all the packages that implement builtin modules. The latter
set of packages depends on almost all the Elvish packages transitively. As a
result, almost any change in any Elvish package will trigger a rebuild of this
command and the whole website.
This commit minimizes the dependency on Elvish packages by having it read the
.elv files during runtime instead (enabled by
9112eb1ab2
).
Additionally:
- Move HighlightCodeBlock, needed by website/cmd/md2html, from pkg/mods/doc
to pkg/elvdoc. Moving it is necessary to completely remove the dependency of
website/cmd/md2html on pkg/mods/doc.
- Remove the dependency of pkg/edit/highlight on pkg/eval. It only uses
eval.UnpackCompilationErrors; move this work to the supplied Check function.
This removes the transitive dependency of website/cmd/md2html on pkg/eval.
- Augment website/tools/md-deps to recognize @module lines and add dependency on
the corresponding .elv files.
52 lines
1.4 KiB
Makefile
52 lines
1.4 KiB
Makefile
DST_DIR := ./_dst
|
|
PUBLISH_DIR := ./_publish
|
|
DOCSET_TMP_DIR := ./_docset_tmp
|
|
DOCSET_DST_DIR := ./Elvish.docset
|
|
|
|
MDS := home.md $(filter-out %/README.md,$(wildcard [^_]*/*.md))
|
|
HTMLS := $(MDS:.md=.html)
|
|
|
|
# Generates the website into $(DST_DIR).
|
|
gen: tools/gensite.bin $(HTMLS)
|
|
tools/gensite.bin . $(DST_DIR)
|
|
ln -sf `pwd`/fonts `pwd`/favicons/* $(DST_DIR)/
|
|
|
|
# Generates docset into $(DOCSET_DST_DIR).
|
|
docset: tools/gensite.bin $(HTMLS)
|
|
ELVISH_DOCSET_MODE=1 tools/gensite.bin . $(DOCSET_TMP_DIR)
|
|
tools/mkdocset $(DOCSET_TMP_DIR) $(DOCSET_DST_DIR)
|
|
|
|
# Synchronizes the generated website into $(PUBLISH_DIR), which is passed to
|
|
# rsync and can be a remote place.
|
|
publish: gen
|
|
rsync -aLv --delete ./_dst/ $(PUBLISH_DIR)/
|
|
|
|
check-rellinks: gen
|
|
python3 tools/check-rellinks.py $(DST_DIR)
|
|
|
|
clean:
|
|
rm -rf tools/*.bin $(HTMLS) $(DST_DIR) $(DOCSET_TMP_DIR) $(DOCSET_DST_DIR)
|
|
|
|
ifdef TTYSHOT
|
|
%.ttyshot.html: %.elvts tools/ttyshot.bin
|
|
tools/ttyshot.bin $(if $(findstring verbose,$(TTYSHOT)),-v,) -o $@ $<
|
|
else
|
|
%.ttyshot.html:
|
|
@: ttyshot generation disabled by default
|
|
endif
|
|
|
|
.PHONY: gen docset publish check-rellinks clean
|
|
|
|
# Don't remove intermediate targets
|
|
.SECONDARY:
|
|
|
|
# Rules below have dynamic prerequisite lists, which requires GNU Make's
|
|
# .SECONDEXPANSION.
|
|
.SECONDEXPANSION:
|
|
|
|
tools/%.bin: cmd/% $$(wildcard cmd/%/*) go.mod ../go.mod $$(shell tools/cmd-deps ./cmd/%)
|
|
go build -o $@ ./$<
|
|
|
|
%.html: %.md tools/md2html.bin $$(shell tools/md-deps $$@)
|
|
tools/md2html.bin < $< > $@
|