Re: Conditional broken line in recipe

Alejandro Colomar <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Organization Linux
Message-ID <[email protected]>
Hi Paul,

On 2023-09-03 04:06, Paul Smith wrote:
> 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


That would hurt readability a little bit.  I think ONESHELL is
calling me in whisper.  :)

Cheers,

Alex

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
OpenPGP_signature (application/pgp-signature, 833 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.