Code conventions for the build system
Salter, Thomas A
Thomas.Salter at unisys.com
Tue Oct 8 13:28:26 UTC 2013
I have not experimented with RECIPEPREFIX. I have tried other workarounds.
I've modified make to recognize 8 spaces as equivalent to a tab. I think there was only one place in all of JDK 7 where a non-rule line got confused with a rule.
I'm now trying to use an alternate character for a tab when moving files to our mainframe and then reinserting the tab when moving them back. That seems to work well. You changes to remove all other uses of tabs will greatly improve this approach.
I agree that switching to a non-tab prefix is scary, but then what you just did is somewhat scary as well. If a project like OpenJDK adopted this convention, maybe the IDE/ editor authors would be motivated to catch up.
Tom
-----Original Message-----
From: Magnus Ihse Bursie [mailto:magnus.ihse.bursie at oracle.com]
Sent: Tuesday, October 08, 2013 8:27 AM
To: Salter, Thomas A; build-dev at openjdk.java.net
Subject: Re: Code conventions for the build system
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