feature suggestion: configurable recipe echoing

"Cook, Malcolm" <[email protected]> Thu, 30 May 2024 21:41:07 +0000
Newsgroups gmane.comp.gnu.make.general
Message-ID <DS7PR20MB46714E04597A01AE0956E5D6BEF32@DS7PR20MB4671.namprd20.prod.outlook.com>
Hi make-makers,

When using GNU Make as a workflow management tool, I use the feature [Choosing the Shell](https://www.gnu.org/software/make/manual/make.html#index-_002eSHELLFLAGS_002c-value-of) and give SHELL (and .SHELLFLAGS) to  [Target-specific Variable Values](https://www.gnu.org/software/make/manual/make.html#Target_002dspecific).  

Doing so allows me to write recipes in a mix of e.g. bash, perl, R, sql, python, etc).

When doing so, I often wish I had the ability to configure Gnu Make's [Recipe Echoing](https://www.gnu.org/software/make/manual/make.html#Echoing) to identify the SHELL executing the recipe.

This would make the trace of recipe execution much more easily interpretable.

if I could, I would probably choose to prefix each line of echoed recipe with the basename of the SHELL, followed by a colon and a space.

Perhaps we could introduce a new special variable, say .ECHO_FORMAT, which might be expanded and used to printf the recipe about to be executed.  It could have its default set as follows:

.ECHO_FORMAT:=%s\n

... but could be used to my ends by setting it as:

.ECHO_FORMAT=$(basename ${SHELL}): %s\n

What do you think?


Malcolm Cook - Scientific Data and Applications Coordinator
Stowers Institute for Medical Research