URL:
  <http://savannah.gnu.org/bugs/?35711>

                 Summary: Make needs to define targets earlier
                 Project: make
            Submitted by: psmith
            Submitted on: Sat 03 Mar 2012 02:01:17 PM EST
                Severity: 4 - Important
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.80
        Operating System: None
           Fixed Release: None
           Triage Status: Medium Effort

    _______________________________________________________

Details:

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.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?35711>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to