bug-make
[Top][All Lists]
Advanced

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

Re: Difficulties from the combination of functions "call" and "eval"


From: Paul Smith
Subject: Re: Difficulties from the combination of functions "call" and "eval"
Date: Sun, 18 Jan 2015 17:51:34 -0500

On Sun, 2015-01-18 at 22:28 +0100, SF Markus Elfring wrote:
> > Without knowing exactly what you mean by "handling of rules with
> > multiple output files" I can't say for sure, but I think it's unlikely
> > that $(eval ...) can help with this.
> 
> A lot of rules can come into the situation to fiddle with multiple
> output files easily.
> 
> Examples:
> * Specification of standard output files and standard error channels
>   for shell commands
> 
> * The database "SQLite" can create its storage file while also
>   exporting data to another file.
> 
> * I need to split an input file into several smaller files.

I don't see any way that $(eval ...) is needed or helpful for any of
those things.

> > This means the ONLY time setting a variable from within a recipe is
> > helpful is if the only place you need to use that variable is INSIDE
> > some other recipe that has not been run yet.
> 
> I imagine that conditional evaluation of recipes will be possible somehow,
> wont it?

I don't know what you mean by this question; if you mean that a recipe
should make a decision and do different things, then typically you would
use _shell_ conditional statements for this:

    foo:
            if [ -f somefile ]; then \
                do one thing; \
            else \
                do a different thing; \
            fi

There are other possibilities, but without a specific use-case we can't
say which one(s) are appropriate.


Here's my advice: forget about $(eval ...) completely.  Just stop using
it and pretend it doesn't exist.  From what we've seen, you don't need
it and your attempts to force your makefiles to use it are
unquestionably causing confusion and errors.

$(eval ...) is a (relatively) recently implemented, very advanced
feature that exists only in GNU make: no other implementation of make
has anything like it (that I'm aware of).

At the same time, people have been writing sophisticated, complex,
capable build systems based on make for decades before $(eval ...)
existed, and still do so today with other implementations of make that
don't have it.

So you really just don't need $(eval ...), except in rare situations
where you really do need it.  Nothing you've shown us so far really
needs it.  So just forget about it.

If you get stuck trying to do something in the future, then you can come
back and ask a detailed question, and if $(eval ...) is needed to solve
that problem we'll let you know.




reply via email to

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