On Mon, 2025-06-30 at 13:23 -0400, Zack Weinberg wrote: > > It's not $(file) that is causing this effect it's how all make > > functions work of any kind. There is always expansion just before a > > command is executed. When a command is sent to the shell make has > > no further control of it. > > Again, just because that's how it works *now* doesn't mean it has to > stay that way.
This is true, but before it can be changed we have to very carefully consider the backward-compatibility implications. > there is no fundamental reason why a $(file) within a command *could > not* pass unchanged through function expansion and then be executed > directly by the code that runs subprocesses (instead of actually > invoking a subprocess). Actually that's not true: there ARE fundamental reasons this can't work. Hopefully my latest comment in Savannah begins to show why. You have to move past the trivial special case where the entire recipe line consists of nothing but a single invocation of a $(file...) function. In fact the $(file...) function, just like any other variable or function, can appear and be expanded virtually ANYWHERE in a makefile: both in and not in a recipe, and when in a recipe it could appear in the middle of a bunch of other shell commands, or in the middle of a bunch of other make constructs (other functions, variable names, etc.)