diff options
Diffstat (limited to 'GNUmakefile')
-rw-r--r-- | GNUmakefile | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/GNUmakefile b/GNUmakefile index 28f287a..518f8d6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -58,7 +58,7 @@ generate-clean: rm -f -- $(generate/files) .PHONY: generate-clean -# `build` ###################################################################### +# `build` and `check` ########################################################## platforms := $(shell sed -nE 's/if *\(PICO_PLATFORM STREQUAL "(.*)"\)/\1/p' cmd/*/CMakeLists.txt) @@ -72,21 +72,35 @@ $(foreach p,$(platforms),build/$p/build): build/%/build: build/%/Makefile genera $(MAKE) -C $(<D) .PHONY: $(foreach p,$(platforms),build/$p/build) +check: build + $(MAKE) -j1 -k $(foreach p,$(platforms),build/$p/check) +.PHONY: check + +$(foreach p,$(platforms),build/$p/check): build/%/check: build/%/Makefile + CTEST_OUTPUT_ON_FAILURE=1 $(MAKE) -C $(<D) test +.PHONY: $(foreach p,$(platforms),build/$p/check) + # `lint` and `format` ########################################################## -include build-aux/sources.mk +sources_all := $(foreach v,$(filter sources_%,$(.VARIABLES)),$($v)) get_dscname = sed -n '1,3{ /^\#!/d; /^<!--$$/d; /-\*- .* -\*-/d; s,[/*\# ]*,,; s/ - .*//;p; q; }' +build-aux/venv: build-aux/requirements.txt + python3 -m venv $@ + $@/bin/pip install -r $< + touch --no-create $@ + # `lint` ########### lint: $(MAKE) -k $(patsubst sources_%,lint/%,$(filter sources_%,$(.VARIABLES))) lint/sh lint/bash: lint/%: shellcheck $(sources_$*) -lint/python3: lint/%: - mypy --strict --scripts-are-modules $(sources_$*) - black --check $(sources_$*) - isort --check $(sources_$*) +lint/python3: lint/%: build-aux/venv + ./build-aux/venv/bin/mypy --strict --scripts-are-modules $(sources_$*) + ./build-aux/venv/bin/black --check $(sources_$*) + ./build-aux/venv/bin/isort --check $(sources_$*) lint/c: lint/%: @for filename in $(filter %.h,$(sources_$*)); do \ dscname=$$($(get_dscname) $$filename); \ @@ -98,7 +112,7 @@ lint/c: lint/%: grep -Fxq "#endif /* $${guard} */" "$$filename"; }; then \ echo "$$filename does not have $${guard} guard"; r=1; \ fi; \ - done + done; exit $$r lint/make lint/cmake lint/gitignore lint/ini lint/9p lint/markdown: lint/%: @: lint/unknown: lint/%: @@ -132,9 +146,9 @@ lint/all: lint/%: # `format` ######### format: $(MAKE) -k $(patsubst sources_%,format/%,$(filter-out sources_all,$(filter sources_%,$(.VARIABLES)))) -format/python3: format/%: - black $(sources_$*) - isort $(sources_$*) +format/python3: format/%: ./build-aux/venv + ./build-aux/venv/bin/black $(sources_$*) + ./build-aux/venv/bin/isort $(sources_$*) format/sh format/bash: format/% @: format/c: format/%: |