autoconf
[Top][All Lists]
Advanced

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

Re: Feature suggestion: Option to generate a Makefile include file conta


From: Gavin Smith
Subject: Re: Feature suggestion: Option to generate a Makefile include file containing assignments for all of the output variables
Date: Wed, 3 Apr 2013 12:45:49 +0100

Thanks, your suggestion works.

I'm not sure if what you say about automake would be true of any kind
of Makefile generator which did what automake did, but I'm still
experimenting with alternatives.

On Mon, Apr 1, 2013 at 3:23 PM, Nick Bowler <address@hidden> wrote:
> On 2013-03-30 14:56 +0000, Gavin Smith wrote:
>> autoconf-generated configure scripts substitute strings like @var@ in files
>> like for the value of output variables set in the configure script. Most of
>> the time, these will only be used in lines like
>>
>> var = @var@
>>
>> in Makefile.in. The Makefile.in may have many of these lines. In fact,
>> automake scans configure.ac for use of the AC_SUBST macro and automatically
>> adds such lines to the generated Makefile.in.
>>
>> It can be confusing to try to understand what it means for variables to
>> copied from one level of the build system to another. If a user writes
>> Makefile.in by hand, they will have to write out all these lines manually.
>> Also, it's hard to read Makefile.in's because of such lines.
>>
>> My suggestion would provide a simpler way which would work for most use
>> cases. It would be to generate a file (called, say, "config.mk") which
>> contained all these assignments automatically. I.e., config.mk would
>> contain lines like
>>
>> CC = cc
>> CXX = g++
>>
>> and so on. Then in the Makefile, have a line "include config.mk". The
>> output variables would be referred to in the Makefile as ordinary
>> environment variable (e.g. $(CC)).
> [...]
>
> To be honest, most Autoconf-using packages use Automake, and it's
> unclear that Automake would be able to make use of this feature.  In
> particular, Automake needs to suppress these definitions for assignments
> that are explicitly written into Makefile.am.  More importantly, a
> package can have more than one Makefile.am file, some of which have
> explicit assignments and others do not.  So I'm not sure if this
> feature would be useful to very many packages.
>
> But the good news is that Autoconf can already be used for something
> very close to what you are asking.  Totally untested, but you could add
> something like the following (perhaps with more error checking) to your
> bootstrap script:
>
>   % autoconf --trace 'AC_SUBST:$1' | sed 's/.*/& = @&@/' > config.mk.in
>
> then add AC_CONFIG_FILES([config.mk]) to configure.ac.
>
> Note also that just because something is AC_SUBSTed does not mean that
> it is syntactically valid to stick in a Makefile like this.  Automake
> also provides AM_SUBST_NOTMAKE to suppress the automatic Makefile.in
> assignment, and you may want something similar.
>
> Cheers,
> --
> Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)



reply via email to

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