[prev in list] [next in list] [prev in thread] [next in thread] 

List:       autoconf
Subject:    Re: Future plans for Autotools
From:       Paul Eggert <eggert () cs ! ucla ! edu>
Date:       2021-01-25 23:15:47
Message-ID: 408c6984-b859-2d29-fc8f-e19fd1fcab7d () cs ! ucla ! edu
[Download RAW message or body]

On 1/25/21 2:59 PM, Gavin Smith wrote:
> Does this
> work or does GNU make have other ways of doing this?  (It would be
> better if it could be done without communicating via files.)  Is there
> any way to set a Makefile variable from within a rule and then depend upon
> that variable being set in other rules?

GNU Make supports variables defined via ::=, and an earlier section of a 
GNU makefile could compute CC and assign to it that way. This would 
handle the simple case you gave. Unfortunately there are other cases 
that would require intermediate files with current GNU Make. Still, the 
overhead in using files would be worth it (at least for me) if we could 
use make -j.

The ::= feature was added to POSIX ten years ago or so, so it could even 
be used in Makefiles intended to be portable to other new-enough 
POSIX-compatible platforms. It wouldn't work on older platforms, though.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic