21 lines
736 B
Makefile
21 lines
736 B
Makefile
|
|
# Testability guard
|
||
|
|
#
|
||
|
|
# Tree testability is a single top-level property tracked by
|
||
|
|
# $(TOPDIR)/dirs-all.done: created by a full `make all` from the topdir,
|
||
|
|
# removed by `make clean`. A per-dir `make test` only makes sense when the tree
|
||
|
|
# is importable, i.e. testable. So `test` requires testability, and a `make
|
||
|
|
# clean` that drops artifacts crucial for testing (a Python module's
|
||
|
|
# __init__.py, ...) invalidates it.
|
||
|
|
|
||
|
|
.PHONY: testability invalidate-testability
|
||
|
|
|
||
|
|
TEST_GUARD = $(TOPDIR)/dirs-all.done
|
||
|
|
|
||
|
|
all:
|
||
|
|
|
||
|
|
testability:
|
||
|
|
@test -f "$(TEST_GUARD)" || \
|
||
|
|
{ echo 'Error: Tree not testable -- run "make all" (or "make test") from project root to fix that!' >&2; exit 1; }
|
||
|
|
|
||
|
|
invalidate-testability:
|
||
|
|
$(RM) -f "$(TEST_GUARD)"
|