News for hackers. Stuff that matters.
Re:Learn Makefiles with the Tastiest Examples by radiospiel on Wednesday May 17, 2023 @05:31AM (#35973024)
What's the problem with "make clean test"? A test target would have a test-build prerequisite anyways, so

- clean out build artefacts - rebuild test builds - run tests

sounds very much ok to me.

Re:Learn Makefiles with the Tastiest Examples by Groxx on Thursday May 18, 2023 @02:30PM (#35992150)
One obvious problem is that that isn't what `make clean test` does.

Order isn't guaranteed, and most clean targets won't have any dependency relationship with test targets, so it could test and then clean. Or interleave them (clean between test dependencies). Or run them both simultaneously if someone has set the -j flag, and then who knows what happens.

Other than that, make's behavior when a target updates dependencies of another target which do not share dependencies can get extremely complicated, and often depends on execution order. Clean generally affects many/most, so it's sometimes very problematic to run with any other.