Re: [dev] Special target ".POSIX" in Makefiles

From: NRK <nrk_AT_disroot.org>
Date: Fri, 31 Dec 2021 12:57:21 +0600

On Fri, Dec 31, 2021 at 12:49:46PM +0600, NRK wrote:
> What would be a posix replacement for `?=` ? I assume something like:
>
> VAR = $$(if test -n "$$VAR"; then printf "%s" "$$VAR"; else printf "fallback"; fi)
>

Now that I think about it, posix shell has parameter expansion that
could be used here for a more compact assignment:

        VAR = $${VAR:-fallback}

should also do the trick. I guess it could also be double quoted to
protect against word splitting as well. But I don't think that'd be a
good idea for things like CFLAGS where word splitting is desired.

- NRK
Received on Fri Dec 31 2021 - 07:57:21 CET

This archive was generated by hypermail 2.3.0 : Fri Dec 31 2021 - 08:00:08 CET