On Mon, 2025-06-30 at 17:55 +0100, Tim Murphy wrote: > That cannot work logically. How can make control what happens inside > a shell command? How can make wait until mkdir is executed by the > shell and then expand $(file) before the next shell command executes?
I think the ask is that the expansion happens for each line in the recipe, just before that line is executed instead of before the first line is executed. So: all: mkdir -p test.d $(file > test.d/test.txt, $(contents)) There are two command lines here, and they are invoked serially in separate shells (or equivalent). Currently, make expands all the lines before executing any line. Another way to do it would be to expand each line right before make is about to execute it. In that situation, the mkdir would have been executed before the $(file...) function would be expanded.