Use the weave program from golang.org/x/example to weave together the README text with buildable programs. This ensures the code in the README compiles. Change-Id: Ib5e10c8f808cc6d1ed4addbee784607e910ba30b Reviewed-on: https://go-review.googlesource.com/c/tools/+/673796 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
19 lines
589 B
Makefile
19 lines
589 B
Makefile
# This makefile builds ../README.md from the files in this directory.
|
|
|
|
OUTFILE=../../README.md
|
|
|
|
$(OUTFILE): build README.src.md
|
|
go run golang.org/x/example/internal/cmd/weave@latest README.src.md > $(OUTFILE)
|
|
|
|
# Compile all the code used in the README.
|
|
build: $(wildcard */*.go)
|
|
go build -o /tmp/mcp-readme/ ./...
|
|
|
|
# Preview the README on GitHub.
|
|
# $HOME/markdown must be a github repo.
|
|
# Visit https://github.com/$HOME/markdown to see the result.
|
|
preview: $(OUTFILE)
|
|
cp $(OUTFILE) $$HOME/markdown/
|
|
(cd $$HOME/markdown/ && git commit -m . README.md && git push)
|
|
|
|
.PHONY: build preview
|