help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conditional broken line in recipe


From: Paul Smith
Subject: Re: Conditional broken line in recipe
Date: Sat, 02 Sep 2023 22:06:05 -0400
User-agent: Evolution 3.48.4 (by Flathub.org)

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

I'm sure you've tried it and discovered the answer is "no".  The
backslash will append the next line to the previous line and it won't
be considered a make statement.

You need to put the ifdef outside the recipe:

    ifeq (...)
      BAR = | bar
    else
      BAR =
    endif

    target:
            foo $(BAR) | baz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]