From: Ian Jackson Date: Sat, 14 Dec 2019 13:35:45 +0000 (+0000) Subject: build system: Fix race bug in recheck target X-Git-Tag: v0.6.0~19 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=8d389acd693325fab2799840844750149d95809a;p=secnet.git build system: Fix race bug in recheck target Signed-off-by: Ian Jackson --- diff --git a/Dir.sd.mk b/Dir.sd.mk index 1dba143..baabaf6 100644 --- a/Dir.sd.mk +++ b/Dir.sd.mk @@ -128,10 +128,20 @@ TESTDIRS=stest mtest &TARGETS_fullcheck += $(&TARGETS_check) &TARGETS_fullcheck += msgcode-test.confirm -recheck: - rm -f $(&TARGETS_check) - rm -rf $(addsuffix /d-*, $(TESTDIRS)) - $(MAKE) -f main.mk check +RECHECK_RM += $(&TARGETS_check) +RECHECK_RM += $(addsuffix /d-*, $(TESTDIRS)); +# Really the eval below should come very late, so that subdirs can add +# their stuff to RECHECK_RM, but we do not have a way to do that with +# subdirmk yet. So we embed ad-hoc knowledge about TESTDIRS. + +# This contrives to delete things before make starts, if the user +# said "recheck". The alternative is having recheck be a target +# which contains the rm's and then runs $(MAKE) again but then +# we recursively re-enter make in parallel, which is Bad. +$(eval $(if $(filter recheck,$(MAKECMDGOALS)), \ + $(shell set -x; rm -rf $(RECHECK_RM) ))) + +recheck: check .PHONY: FORCE version.c: FORCE