BSD make -- Malformed conditional

Chris Rees utisoft at gmail.com
Fri Jan 27 18:09:17 UTC 2012


On 27 January 2012 17:45, Matthew Seaman
<m.seaman at infracaninophile.co.uk> wrote:
> On 27/01/2012 16:51, Chris Rees wrote:
>>> .for item in ${LIST}
>>> > .if ${item} == "this"  # Ooops
>
>> You shouldn't use quotes either.
>
> I think that not quoting might be better style, but it's not the typical
> usage in make(1).  There are quite a few contrary examples in the ports:
>
> % < /tmp/ports-makefiles xargs grep '} == "' | wc -l
>    1674
> % < /tmp/ports-makefiles xargs grep '} == [^"]' | wc -l
>     531

These counterexamples are wrong.  Just because it works doesn't make it right.

Quotes are way overused in Makefiles, just because in other languages
they're necessary doesn't mean we should use them when unneccessary.

Thought is required about which language you're writing in.

Equally, no-one should be advocating things like:

.if (${FOO} == "bar")

just because it works-- we're not writing in C :)

We have the same problem with GNU test accepting "==", for example.

Chris


More information about the freebsd-ports mailing list