Code conventions for the build system

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Tue Oct 8 12:27:18 UTC 2013


On 2013-10-08 14:08, Salter, Thomas A wrote:
> Was there any thought given to using this GNU Make feature to get rid of significant tab characters, or is it not even possible in all the supported build environments?  Some of the legacy systems I deal with don't handle tab characters well.
>
> From: http://www.gnu.org/software/make/manual/make.html#Special-Variables
>
> .RECIPEPREFIX
> The first character of the value of this variable is used as the character make assumes is introducing a recipe line. If the variable is empty (as it is by default) that character is the standard tab character. For example, this is a valid makefile:
>            .RECIPEPREFIX = >
>            all:
>            > @echo Hello, world
>
> The value of .RECIPEPREFIX can be changed multiple times; once set it stays in effect for all rules parsed until it is modified.

I was not aware of this feature. It is ... interesting. But a bit scary. 
:-)

It's definitely worth considering, although not in this patch.

My first impression is that, while the decision to use tab as a special 
character in makefile syntax was a particularly bad one, it is still the 
norm. And even though IDE/editor support is quite limited for Makefiles, 
they usually can succeed in determining recipes by the tabs and the 
preceding colon. Change that, and you'll lose editor support (unless the 
editors are intelligent enough to parse .RECIPEPREFIX; which is of 
course possible, but unlikely).

On the other hand, tab in rules are not a good idea, and a character 
like ">" would certainly make rules stand out more visibly.

Have you used a non-tab .RECIPEPREFIX in the real world, with good results?

/Magnus



More information about the build-dev mailing list