diff options
Diffstat (limited to 'GNUmakefile')
-rw-r--r-- | GNUmakefile | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/GNUmakefile b/GNUmakefile index 9836b33..fa76266 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -101,8 +101,17 @@ check: $(MAKE) -k INNER=t $(foreach t,$(build_types),$(foreach p,$(platforms),build/$p-$t/check)) .PHONY: check +# `gcc` writes .gcno +# Running the program writes .gcda (updates existing files, concurrent-safe) +# GCC `gcov` post-processes .gcno+.gcda to .gcov +# `gcovr` is a Python script that calls `gcov` and merges and post-processes the .gcov files to other formats +gcovr_flags = --txt=$(@D)/coverage.txt +gcovr_flags += --html=$(@D)/coverage.html --html-details --html-single-page=js-enabled +gcovr_flags += --sort uncovered-number --sort-reverse $(foreach t,$(build_types),$(foreach p,$(platforms),build/$p-$t/check)): build/%/check: build/%/build + ./build-aux/gcov-prune $(@D) +cd $(@D) && ctest --output-on-failure $(if $(filter --jobserver-auth=%,$(MAKEFLAGS)),--parallel) + gcovr $(gcovr_flags) -- $(@D) .PHONY: $(foreach t,$(build_types),$(foreach p,$(platforms),build/$p-$t/check)) # `lint` and `format` ########################################################## @@ -116,33 +125,17 @@ build-aux/venv: build-aux/requirements.txt touch --no-create $@ # `lint` ############################### -# generic ########## lint: - $(MAKE) -k INNER=t $(patsubst sources_%,lint/%,$(filter sources_%,$(.VARIABLES))) # Only lint binaries if the build scripts pass lint. - $(MAKE) INNER=t lint/bin + $(MAKE) -k INNER=t lint/src + $(MAKE) INNER=t lint/bin +lint/src: $(patsubst sources_%,lint/%,$(filter-out sources_all,$(filter sources_%,$(.VARIABLES)))) lint/bin: build build-aux/lint-bin ./build-aux/lint-bin $(foreach t,$(build_types),build/rp2040-$t/cmd/sbc_harness/sbc_harness.elf) -lint/all: lint/%: build-aux/lint-generic build-aux/get-dscname - ./build-aux/lint-generic $(sources_$*) -lint/unknown: lint/%: build-aux/lint-unknown - ./build-aux/lint-unknown $(sources_$*) +lint/unknown lint/c lint/sh lint/bash lint/python3 lint/make lint/cmake lint/gitignore lint/ini lint/9p-idl lint/9p-log lint/markdown lint/pip lint/man-cat: build-aux/lint-src + ./build-aux/lint-src $(@F) $(sources_$(@F)) +lint/python3: build-aux/venv .PHONY: lint lint/% -# specific ######### -lint/c: lint/%: build-aux/lint-h build-aux/get-dscname - ./build-aux/lint-h $(filter %.h,$(sources_$*)) -lint/sh lint/bash: lint/%: - shellcheck $(sources_$*) - shfmt --diff --case-indent --simplify $(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_$*) - ./build-aux/venv/bin/pylint $(sources_$*) - ! grep -nh 'SPECIAL$$' -- lib9p/core.gen lib9p/core_gen/*.py - ./build-aux/venv/bin/pytest $(foreach f,$(sources_python3),$(if $(filter test_%.py,$(notdir $f)),$f)) -lint/make lint/cmake lint/gitignore lint/ini lint/9p-idl lint/9p-log lint/markdown lint/pip lint/man-cat: lint/%: - @: TODO: Write/adopt linters for these file types # `format` ############################# # generic ########## @@ -153,9 +146,9 @@ format: format/c: format/%: @: TODO: Adopt a C code-formatter format/sh format/bash: format/%: - shfmt --write --case-indent --simplify $(sources_$*) -format/python3: format/%: ./build-aux/venv - ./build-aux/venv/bin/black $(sources_$*) - ./build-aux/venv/bin/isort $(sources_$*) -format/make format/cmake format/gitignore format/ini format/9p-idl format/9p-log format/markdown format/pip format/man-cat: format/%: + shfmt --write --case-indent --simplify $(sources_$(@F)) +format/python3: ./build-aux/venv + ./build-aux/venv/bin/black $(sources_$(@F)) + ./build-aux/venv/bin/isort $(sources_$(@F)) +format/make format/cmake format/gitignore format/ini format/9p-idl format/9p-log format/markdown format/pip format/man-cat: @: TODO: Write/adopt formatters for these file types |