On Sun, 2023-09-03 at 01:00 +0200, Alejandro Colomar wrote:
> Hi!
> 
> Is something like this possible?
> 
> target:
>         foo \
> ifeq (...)
>         | bar \
> endif
>         | baz

I'm afraid not.  The way I approach similar situations is this pattern:


<code>

ifeq (...)

define target._conditional-piece
bar
endef

else

define target._conditional-piece
baz
endef

endif

###

target:
        foo \
        | $(target._conditional-piece)

</code>


The main advantage IMO is for debugging; ie when your run `make -pnr
target' the output contains only the version of `target._conditional-
piece` which you'd be interested in based on the condition.  Much in
the same vein as your pseudo-code.

Additionally, I find this easier to adapt than converting all to
.ONESHELL.  YMMV

--
Bahman

Reply via email to