bugmake - Bugs: bug #35062, Add lazy evaluation of...

 
 

bug #35062: Add lazy evaluation of prerequisites

Submitter:  Lukasz Mielicki <lmielick>
Submitted:  Wed 14 Dec 2011 01:16:59 AM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  Wont Fix Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  None Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 20 Dec 2011 01:52:08 PM UTC, comment #4: 


> (However functions that referenced "outside influences" like wildcard etc. could not be duplicated (a wildcard expansion while the makefile is read in and an expansion well on into the work of building targets could well give very different results for example).


A makefile where partially existent build work influences the final build state is not a correct makefile.  The only safe way to use it would be with "make clean && make" always.

Anonymous
Sat 17 Dec 2011 03:39:53 PM UTC, comment #3: 

Well, yes, it would be possible to do something like store the internal variable database as a kind of "versioned" database, where changes to variable values do not overwrite previous ones but instead are added on.  Then when a target is defined it would keep a reference to the state of the variable database at that time so that all variable references in prerequisite lists would be expanded in the context of that state, instead of the "current" (ending) state.  Or something similar.

However functions that referenced "outside influences" like wildcard etc. could not be duplicated (a wildcard expansion while the makefile is read in and an expansion well on into the work of building targets could well give very different results for example).

And my final comment stands: it would be an enormous amount of work.


One possibility would be to use SECONDEXPANSION to avoid the immediate expansion of prerequisites.  However, today make will secondarily expand all (explicit) targets, not just targets that are considered during a given run.  I would be willing to look into an enhancement that deferred secondary expansion until a target was considered and not secondarily expanding targets that are not considered.

Paul D. Smith <psmith>
Group administrator
Sat 17 Dec 2011 02:36:11 PM UTC, comment #2: 


> With your suggested change you would see just "bar" (no "foo").


It might be worth noting that this "massive incompatibility" is not in the suggested change per se but in Paul Hacker's idea of how it could be possibly implemented.  Of course it is possible to have the feature without the incompatibility.

Anonymous
Wed 14 Dec 2011 01:38:19 AM UTC, comment #1: 

Sorry but this would completely change make in a way that's massively incompatible... and confusing.

For example, today if you say:

PRE = foo
all: $(PRE)
PRE = bar
all: $(PRE)

foo bar: ; @echo $@


You'll see "foo" then "bar".  With your suggested change you would see just "bar" (no "foo").

This is such a complete abrogation of the historical behavior of make that I don't think it's appropriate, even as an option (especially since it would be an enormous amount of work to implement).

Paul D. Smith <psmith>
Group administrator
Wed 14 Dec 2011 01:16:59 AM UTC, original submission:  

The idea is not to evaluate prerequisites of target not being make goals. Such approach would improve non-recursive make performance by skipping unnecessary wildcard/shell calls for targets not being build.

E.g. the following Makefile would output only:
A prerequisites evaluated

all: a
a: $(info A prerequisites evaluated)
b: $(info B prerequisites evaluated)
.PHONY: a b all

This could be handled in a way similar to .SECONDEXPANSION not to cause compatibility issues in cases where prerequisites expansions  causes side effects. However greater care may be needed to support eval.

Lukasz Mielicki <lmielick>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by lmielick (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-12-14 psmith StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code