[bug #36486] Overrides and append to pattern specific variables

View: New views
3 Messages — Rating Filter:   Alert me  

[bug #36486] Overrides and append to pattern specific variables

by Jimmy Zelinskie :: Rate this Message:

| View Threaded | Show Only this Message

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

                 Summary: Overrides and append to pattern specific variables
                 Project: make
            Submitted by: None
            Submitted on: Thu 17 May 2012 15:34:27 UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.82
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

Hi,

Using a target pattern to append to an override variable is not behaving as I
expect.  The behaviour is also different depending on whether the override
variable is defined on the command line or inside a makefile.  The problem is
demonstrated by the following makefile:

override MO=mo
all: ; @echo 'MO=$(MO), CLO=$(CLO)'
a%: MO += add_to_mo
a%: CLO += add_to_clo

I build it with the following command:

make CLO=clo

The output I see is:

MO=mo add_to_mo, CLO=clo clo

But what I expected to see was:

MO=mo, CLO=clo

It seems the pattern specific append is affecting the value of the override
variables, however I don't think that should be possible unless the pattern
specific append it also given the override attribute.  The case with the CLO
variable seems particularly strange as the effect is to double the globally
defined value.

regards,
Rob.






    _______________________________________________________

Reply to this item at:

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

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


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

[bug #36486] Overrides and append to pattern specific variables

by Jimmy Zelinskie :: Rate this Message:

| View Threaded | Show Only this Message

Follow-up Comment #1, bug #36486 (project make):

Similar to the OP's bug:


override ASDF := global
A: ASDF += A1

A:
  @echo "${@}: ${ASDF}"


Running make causes it to print:

A: global A1


    _______________________________________________________

Reply to this item at:

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

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


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

[bug #36486] Overrides and append to pattern specific variables

by Jimmy Zelinskie :: Rate this Message:

| View Threaded | Show Only this Message

Follow-up Comment #2, bug #36486 (project make):

This is a bug, but it's going to require some non-trivial effort to fix.  The
problem is that make is recursively walking down (or up, whichever you like)
the variable sets, and when it pops back out it returns only the value string
of the expanded content.  So, when we pop out of the recursion we have no way
to know that at the end (or the top) we found an "override" variable and we
shouldn't append anything to it.

To fix this we'll need to rework the returned values from the various variable
expansion functions so that more information, than just the value string, is
returned.  That kind of change may ripple throughout the codebase.

    _______________________________________________________

Reply to this item at:

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

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


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