bug-make
[Top][All Lists]
Advanced

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

Re: Dynamic evaluation of build scripts


From: Paul Smith
Subject: Re: Dynamic evaluation of build scripts
Date: Mon, 12 Jan 2015 09:23:06 -0500

On Mon, 2015-01-12 at 13:14 +0100, SF Markus Elfring wrote:
> > GNU make is the only implementation of make that supports any GNU
> > make functions, including $(eval ...), if that's what you mean.
> 
> I hope that more software tools can cope with make file syntax and
> processing of corresponding GNU extensions.

I'm not sure what sorts of "tools" you had in mind, but no other
implementation of make can do so as I've said.

> > In fact, recursive variable expansion is about the only one
> > of the techniques I discuss above which is widely implemented
> > in other versions of make.
> 
> I find it interesting which limitations from other approaches need
> to be also considered for the development of reasonably portable
> build scripts.

Make implementations are notorious for having lots of incompatible
extensions.  That's because the POSIX standard for make (which all
implementations typically adhere to) is very limited in what it
requires, so implementations have added their own features in addition
to the standard, and they rarely are compatible with each other.

That's why automake exists: it allows you to write a more compact
makefile "template" which automake will expand into a fully-conforming
POSIX makefile... which typically involves a lot of redundancy because
you can't use shortcuts like pattern rules, etc.

> > No other make, that I know of, supports regenerating makefiles and
> > re-exec'ing.  And definitely no other make supports $(eval ...).
> 
> Does GNU software provide some promising functionality here?
> Are there any chances that it will spread out to further implementations?

Based on my experience, I'd say there's just about zero chance of that.

That's one reason I wrote the First Rule of Makefiles:
http://make.mad-scientist.net/papers/rules-of-makefiles/

GNU make is highly portable: it supports DOS, AmigaOS, and OpenVMS in
addition to the usual suspects: GNU/Linux, BSDs (including OSX), all
proprietary UNIX systems, Windows.  It's easier to build GNU make for
the target than to write makefiles which run with all the different
native instances of make (IMO).

If you cannot require GNU make (you have a free software project where
you don't want to make that demand of your users perhaps) then you might
use automake and autoconf to create a portable environment.

Another option is to use cmake, which has many of its own foibles but is
very good at what it does.

> > The $(call ...) function is what's normally used to create
> > a user-defined function that takes multiple arguments in GNU make...
> 
> Would it help to mention explicitly that the built-in function "eval"
> takes script code as a single input parameter?

The manual does say:

        The argument to the eval function is expanded, then the results
        of that expansion are parsed as makefile syntax.

note the singular "the argument".  It could be made more explicit I
suppose.




reply via email to

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