mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-01 10:19:01 +00:00
4d2dc1e3f7
The GNUmakefile had 1295 lines and mixed build configuration, LLVM bootstrapping, device generation, four test suites, the smoke tests, release packaging, and lint tools. The smoke tests alone were 500 lines. Move each part into its own file in make/ and include them from GNUmakefile. config.mk must be included first because the other files use its variables in immediate assignments and conditionals. There is no change in behavior. The parsed make database is identical for the default build and for ASSERT=1, STATIC=1, XTENSA=0, STM32=0, WASM=0, and CROSS=aarch64-linux-gnu, except for MAKEFILE_LIST and the .PHONY list, which now also includes targets that were phony but not declared. The Dockerfile copies GNUmakefile alone before it builds LLVM, to keep that layer independent of the source tree. It must copy make/ too.
37 lines
1.4 KiB
Makefile
37 lines
1.4 KiB
Makefile
# Developer tooling: lint, spellcheck, and the help target.
|
|
|
|
.PHONY: tools
|
|
tools:
|
|
go generate -tags tools ./
|
|
|
|
LINTDIRS=src/os/ src/reflect/
|
|
.PHONY: lint
|
|
lint: tools ## Lint source tree
|
|
revive -version
|
|
# TODO: lint more directories!
|
|
# revive.toml isn't flexible enough to filter out just one kind of error from a checker, so do it with grep here.
|
|
# Can't use grep with friendly formatter. Plain output isn't too bad, though.
|
|
# Use 'grep .' to get rid of stray blank line
|
|
revive -config revive.toml compiler/... $$( find $(LINTDIRS) -type f -name '*.go' ) \
|
|
| grep -v "should have comment or be unexported" \
|
|
| grep '.' \
|
|
| awk '{print}; END {exit NR>0}'
|
|
|
|
SPELLDIRSCMD=find . -depth 1 -type d | egrep -wv '.git|lib|llvm|src'; find src -depth 1 | egrep -wv 'device|internal|net|vendor'; find src/internal -depth 1 -type d | egrep -wv src/internal/wasi
|
|
.PHONY: spell
|
|
spell: tools ## Spellcheck source tree
|
|
misspell -error --dict misspell.csv -i 'ackward,devided,extint,rela' $$( $(SPELLDIRSCMD) ) *.go *.md
|
|
|
|
.PHONY: spellfix
|
|
spellfix: tools ## Same as spell, but fixes what it finds
|
|
misspell -w --dict misspell.csv -i 'ackward,devided,extint,rela' $$( $(SPELLDIRSCMD) ) *.go *.md
|
|
|
|
# https://www.client9.com/self-documenting-makefiles/
|
|
.PHONY: help
|
|
help:
|
|
@awk -F ':|##' '/^[^\t].+?:.*?##/ {\
|
|
gsub(/\$$\(LLVM_BUILDDIR\)/, "$(LLVM_BUILDDIR)"); \
|
|
printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF \
|
|
}' $(MAKEFILE_LIST)
|
|
#.DEFAULT_GOAL=help
|