patchmake - Patches: patch #3342, .ALIAS special target

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #3342: .ALIAS special target

Submitter:  F <falemagn>
Submitted:  Sun 05 Sep 2004 02:31:04 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Fixed Release:  None

Wed 22 Jun 2005 07:11:11 PM UTC, comment #2: 

There's an old thread on the make mailing list which explains why that's not a solution. In short: 1) it's slower and 2) it mandates a strict ordering between variable's assigment and target declarations.

F <falemagn>
Wed 22 Jun 2005 06:08:45 PM UTC, comment #1: 

Sorry if this doesn't solve it, but why not (for your example above) use

alias=target2 target3 target4
target1 : $(alias)

?

It would seem to me that that would do the same thing.

Dan Hirsch <thequux>
Sun 05 Sep 2004 02:31:04 PM UTC, original submission:  

Hello,

The attached patch implements a so called ".ALIAS" special target.

An .ALIAS target is firts of all a .PHONY target, which means there's no real file on disk with the name of the target; however, unlike .PHONY targets, .ALIAS targets can - and that's their main purpose - be used as prerequisites of normal targets, acting as a sort of "bridge" between the real target and all the prerequisites of the .ALIAS targert: basically, the .ALIAS target can be considered an "alias" for all of its prerequisites.

An .ALIAS target is given "virtual" timestamps. These timestamps are used to connect the parent of the .ALIAS target with the prerequisites of the .ALIAS target. Basically, an .ALIAS target, at the moment of being considered, has an OLD_MTIME mtime, so that it appears older than anything else. However, at the moment it's finished being considered, and thus at the moment all of its prerequisites are finished being considered, its mtime is the mtime of the youngest of its prerequisites.

An example:

    .ALIAS alias

    target1 : alias
    alias   : target2 target3 target4

is completely equivalent to

    target1: target2
    target1: target3
    target1: target4

whilst it's not equivalent to:

    .PHONY alias

    target1 : alias
    alias   : target2 target3 target4

because, in the above case, target1 would always be remade, regardless of whether target2, target3 and target4 have been brought up to date.

I found the need for this special target in my build system, where I make heavy use of the $(eval) function, and where there are "modules" that depend on other "modules": the modules are defined as .ALIAS'es to the real files, and other modules list their dependencies using those aliases, rather than the real files, as they have no way to know where the real files are going to be, but they do know there are certain modules named in a certain way.

Another way of looking at the .ALIAS targets is to consider them as sort of symlinks, although they're very special symlinks as they can refer to more than one file at any given time.

I'm quite new to Make hacking, hence I might have not considered certain situations which I might not be aware of, but I tried to keep the patch to a minimum size and make it as less intrusive as possible. However, I've tested the patch for the cases I need it and it works perfectly.

I'll be happy to discuss any issues I've not considered, in order to let the patch make it to the mainline. Also, I will document the .ALIAS target should this patch be accepted.






F <falemagn>

 

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

Attached Files
file #7836:  make-3.81beta1-alias.diff added by falemagn (3KiB - application/octet-stream - .ALIAS patch for GNU Make 3.81beta1)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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.

 

Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by
2004-09-05 falemagn Attached File- Added make-3.81beta1-alias.diff, #3642

Back to the top

Powered by Savane 3.14-79a4.
Corresponding source code