bug-make
[Top][All Lists]
Advanced

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

Re: Conditional recipe execution


From: Paul Smith
Subject: Re: Conditional recipe execution
Date: Fri, 23 Jan 2015 18:09:05 -0500

On Fri, 2015-01-23 at 23:17 +0100, SF Markus Elfring wrote:
> >> I find that a backslash would not be needed at this place if would like to
> >> keep the "RM command" on a separate logical line.
> > 
> > It is definitely needed.  As I've said, it is not possible for a single
> > variable or function reference to span multiple logical lines.
> 
> Are there any chances to lift this restriction for make functions?

It's very unlikely.  The entire implementation of the parser in make at
its most basic level is completely line-oriented.  It would be quite a
bit of code change to change this behavior.

> > If you want to do this you have to use define/endef to create a variable
> > that contains newlines, then use the variable in the recipe;
> > see example below.
> 
> I hoped somehow that another level of data indirection could be avoided.

To be honest, based on what I've seen, you could do with a few more
levels of indirection.  The rules you've presented here are (to me)
almost impossible to read.  Abstracting some of these longer and more
complex contents into other variable assignments might help make the
structure of the makefile more clear.

Maybe.

In any event you don't have a choice, if you want to keep this behavior.

> > I'm really not at all sure why you're using $(info ...) here...
> 
> The error message looked "a bit nicer" than a complaint on a shorter "if".
> 
> > it won't actually do anything if you do that.
> 
> It prints the generated recipe at least after the addition of the backslash
> you recommended, doesn't it?

It prints the recipe, but cannot run the recipe, because the result of
expanding the $(info ...) function is the empty string.  So after make
expands the recipe everything printed by $(info ...) is gone (it went to
stdout) and make won't actually run those commands.




reply via email to

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