From 6a71a74ed8bbc060440a79b19a47d4d038411b30 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 16 Jul 2026 11:45:17 +1200 Subject: [PATCH] tests: Add clean_rules target Calling `make clean` can fail if a test folder has been collected but the source no longer exists. `make clean_rules` bypasses this by skipping the `include make/rules/collect.mk` in the same way as `make help`. --- tests/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 6063a01..cc20b30 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -47,7 +47,8 @@ make/rules/collect.mk: make/collect_tests.py make/rules/test/%.mk: python3 make/test_rules.py --rule $@ --source $< -ifneq (help,$(MAKECMDGOALS)) +NO_COLLECT_TARGS := help clean_rules +ifneq ($(filter-out $(NO_COLLECT_TARGS),$(MAKECMDGOALS)),) # This should run every time but only trigger anything depending on it whenever # the script overwrites make/rules/found_tools. This doesn't really match how @@ -66,3 +67,7 @@ endif include make/rules/collect.mk endif + +.PHONY: clean_rules +clean_rules: + @rm -rf make/rules