new file mode 100644
@@ -0,0 +1,31 @@
+# -*-Makefile-*-
+
+TOOL=gard ffspart
+CHECK_TOOL=$(patsubst %,check-%,$(TOOL))
+TOOL_COVERAGE=$(patsubst %,%-coverage,$(TOOL))
+TOOL_TEST_CLEAN=$(patsubst %,%-test-clean,$(TOOL))
+
+
+.PHONY: check
+check: $(CHECK_TOOL)
+
+#Makefile knows to build and clean it before checking, should also
+#make clean before checking. If not, .o files for different
+#architectures might be lying around and clean once done to avoid the
+#opposite
+.PHONY: $(CHECK_TOOL)
+$(CHECK_TOOL):
+ $(call QTEST, RUN-TEST , make CC=$(HOSTCC) CROSS='' CROSS_COMPILE='' \
+ -C external/$(patsubst check-%,%,$@) check, $@)
+
+clean: $(TOOL_TEST_CLEAN)
+
+.PHONY: $(TOOL_COVERAGE)
+coverage: $(TOOL_COVERAGE)
+
+$(TOOL_COVERAGE): $(patsubst %-coverage, check-%, $@)
+
+.PHONY: $(TOOL_TEST_CLEAN)
+$(TOOL_TEST_CLEAN):
+ $(call QTEST, CLEANUP , make -C external/$(patsubst %-test-clean,%,$@) clean, $@)
+
deleted file mode 100644
@@ -1,20 +0,0 @@
-# -*-Makefile-*-
-
-check: check-ffspart
-
-#Makefile knows to build it before checking, should also
-#make clean before checking. If not, .o files for different
-#architectures might be lying around and clean once done to
-#avoid the opposite
-check-ffspart: ffspart-test-clean
- @make CROSS_COMPILE='' -C external/ffspart/ check
- @make CROSS_COMPILE='' -C external/ffspart/ clean
-
-.PHONY: check-ffspart
-
-clean: ffspart-test-clean
-
-ffspart-test-clean:
- @make -C external/ffspart clean
-
-.PHONY: ffspart-test-clean
deleted file mode 100644
@@ -1,26 +0,0 @@
-# -*-Makefile-*-
-
-check: check-gard
-
-#Makefile knows to build it before checking, should also
-#make clean before checking. If not, .o files for different
-#architectures might be lying around and clean once done to
-#avoid the opposite
-check-gard: gard-test-clean gard
- $(call QTEST, RUN-TEST , make CC=$(HOSTCC) CROSS='' CROSS_COMPILE='' -C external/gard/ check, $@)
- $(call QTEST, CLEANUP , make CC=$(HOSTCC) CROSS='' CROSS_COMPILE='' -C external/gard/ clean, $@)
-
-.PHONY: check-gard
-
-clean: gard-test-clean
-
-.PHONY: gard-coverage
-
-coverage: gard-coverage
-
-gard-coverage: check-gard
-
-gard-test-clean:
- $(call QTEST, CLEANUP , make -C external/gard clean, $@)
-
-.PHONY: gard-test-clean
The reason for this is that check targets for one tool will start to depend on other tools. For example, future pflash tests will rely on ffspart to generate pnors. The current method is too racey and results in races cleaning/building ffspart for its tests and for pflash tests. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> --- external/Makefile.check | 31 +++++++++++++++++++++++++++++++ external/ffspart/test/Makefile.check | 20 -------------------- external/gard/test/Makefile.check | 26 -------------------------- 3 files changed, 31 insertions(+), 46 deletions(-) create mode 100644 external/Makefile.check delete mode 100644 external/ffspart/test/Makefile.check delete mode 100644 external/gard/test/Makefile.check