bugmake - Bugs: bug #35711, Make needs to define targets...


bug #35711: Make needs to define targets earlier

Submitted by:  Paul D. Smith <psmith>
Submitted on:  Sat 03 Mar 2012 07:01:17 PM UTC  
Severity:  4 - Important Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  3.80 Operating System:  None
Fixed Release:  None Triage Status:  Medium Effort

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 29 Nov 2020 11:16:25 PM UTC, comment #1: 

I've implemented a fix for the first item below: special targets are now recognized immediately.

This doesn't help the second item below, which prevents us from implementing something like a .TARGETS special variable.

Paul D. Smith <psmith>
Project Administrator
Sat 03 Mar 2012 07:01:17 PM UTC, original submission:  

Today make's parser does not define any targets until the entire target has been parsed completely.  Because of the way makefile syntax works, make cannot know that the target has been parsed completely until it's working on the NEXT statement (variable definition or another target).

This means that in a makefile like this:

foo: bar
        @cp $< $@
FOO = bar

the target "foo" is not defined as a target in make's internal structures until make has parsed the "FOO" line far enough to realize it's a different statement (a variable assignment).

This causes various problems:

First, if the target is a special target like .POSIX then the handling of .POSIX doesn't take effect immediately; this can cause some issues (for example, if the next line is a variable assignment and POSIX-style backslash/newline handling is desired).

Second, it means that new special variables like $(.TARGETS) are hard to create properly: this would list all known targets BUT due to the delay above the value of that variable is not always up to date when you expect it.

Make should make some effort to define targets as soon as it's parsed the target list (before the ":"), so that they're entered into the database as targets, then update them with final information later, after the rest of the rule has been parsed.

Paul D. Smith <psmith>
Project Administrator


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

Attach Files:

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 (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.7