bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #29757] Target-specific variables change their flavor


From: anonymous
Subject: [bug #29757] Target-specific variables change their flavor
Date: Mon, 03 May 2010 18:42:22 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.3) Gecko/20100409 Gentoo Firefox/3.6.3

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

                 Summary: Target-specific variables change their flavor
                 Project: make
            Submitted by: None
            Submitted on: Mon 03 May 2010 06:42:21 PM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.81
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

I encountered this problem when writing a complex Makefile, so at the
beginning I didn't figured out where the problem was. But then I managed to
isolate it, and I was astonished. Here a simple Makefile:


deferred_var = $(wildcard *)
static_var := some text

foo: static_var += $(deferred_var)

deferred_var = nothing

foo:
        @echo "$(static_var)"


If I place it in an empty directory, I would expect the output of make to
be:
 some text Makefile
But, instead of that, I get:
 some text nothing

I think this is wrong, static_var is a simply-expanded variable, and:
"When you add to a variable's value with `+=', make acts essentially as if
you had included the extra text in the initial definition of the variable. If
you defined it first with `:=', making it a simply-expanded variable, `+='
adds to that simply-expanded definition, and expands the new text before
appending it to the old value just as `:=' does"

If I replace
 foo: static_var += $(deferred_var)
with
 foo: static_var := $(static_var) $(deferred_var)
it works as expected, but it's an ugly workaround.

This happens of course only when doing a target-specific assignment, but it's
quite annoying.




    _______________________________________________________

Reply to this item at:

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

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]