svn commit: r233052 - head/share/mk

Chris Rees utisoft at gmail.com
Mon Mar 19 21:07:24 UTC 2012


On 19 March 2012 19:37, Dimitry Andric <dim at freebsd.org> wrote:
> On 2012-03-19 08:21, Chris Rees wrote:
>> On 17 Mar 2012 05:40, "Bruce Evans" <brde at optusnet.com.au <mailto:brde at optusnet.com.au>> wrote:
>>>
>>> On Fri, 16 Mar 2012, Dimitry Andric wrote:
>>>
>>>> Log:
>>>>  Change the style of share/mk/bsd.sys.mk <http://bsd.sys.mk> to that of the other bsd.*.mk
>>>>  files, and style.Makefile(5), where applicable.  While here, update the
>>>>  link to the gcc warning documentation.
>>>
>>>
>>> Thanks.  I rather liked the "^.* foo" style for making ifdefs less
>>> unreadable, but it didn't look like it was written here, and it is
>>> a sign of other problems that so many nested ifdefs are used.  It
>>> only used a single space of each level of indentation, so the
>>> indentation was still hard too see.
>>>
>>> The "other bsd.*.mk" files don't include bsd.cpu.mk <http://bsd.cpu.mk>.  This still uses
>>> the "^. *foo" style (and is now the only *.mk file one that does this).
>>> For assignments, it mostly uses a different unusual style -- just the
>>> normal C style of a single space before and after '=' (or '+=').  Weird
>>> formattings of assignments are harder to grep for than weird formattings
>>> of ".foo", so I didn't try looking for them all.
>>
>> Indented .ifs etc are used (inconsistently) in bsd.port.mk <http://bsd.port.mk> et al, and can make a huge difference to readability; make is such a messy language that multiple levels are often needed.
>
> Well, the issue with Makefiles is that you cannot indent the actual
> statements.  So even if you sort-of-indent the directives, by adding
> spaces between the initial dot and the directive name, you still have a
> very messy left margin. :)
>
> It would be much nicer to be able to write:
>
> .if defined(FOO)
>  .if defined(BAR)
>    CFLAGS+=    -DFOO_BAR
>  .endif
> .endif
>
> But I guess that would require some overhaul in make.  It doesn't grok
> such indentations now.

That's right, lines starting with whitespace *must* be shell
commands-- it'll be some overhaul that changes that...

>
>> Perhaps we should try to agree a standard on them, perhaps two spaces?  It's a shame to be stripping them out.
>
> Two spaces sounds reasonable enough.  Though indent size is probably the
> ultimate bikeshed... ;)

True-- also whitespace-only changes are probably a bad idea for
merges.  I'm not suggesting changing anything existing, but I'd sure
like to keep the whitespace while it's already there ;)

Chris


More information about the svn-src-all mailing list