On Tue, 2021-03-16 at 09:50 -0700, Kaz Kylheku wrote: > tests is a target which depends on $(TEST_OK), which expands to a > collection of stamp files. Each stamp file is touched when its > corresponding test succeeds. When a stamp file is up-to-date with > regard to the program, then that test is not executed. Thus if we do > "make -k tests", all working tests are identified and "make tests" > will not re-run them, unless the program is rebuilt.
I'm afraid your message provides a lot of detail that I didn't fully understand. Also you don't show exactly what is happening; for example you don't show example content for the TESTS_OK variable. It would be much simpler to understand a minimal test case with just a few files and completely defined (no undefined variables). However, from what I understand what you want to do isn't going to work. It will never work to have a makefile where prerequisites are deleted by some other prerequisite, and make is expected to realize this. Make does various amounts of caching of content, for one thing. For another thing, the order in which prerequisites are run in parallel builds is not well-defined. It seems like a much simpler solution would be to use a recursive make invocation to implement the "retest" target. Rather than things like target-specific TXR_RETEST variable assignments, etc., why not just use something like: retest: rm -rf tst $(MAKE) tests ??