bug-make
[Top][All Lists]
Advanced

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

Re: Target-specific variable in subdirectory problem


From: Paul Smith
Subject: Re: Target-specific variable in subdirectory problem
Date: Wed, 02 Aug 2017 15:55:20 -0400

On Wed, 2017-08-02 at 20:40 +0100, Sven C. Dack wrote:
> It's my understanding that we don't actually know what Benjamin wants to 
> do, because nobody has asked. So I don't see how this would make me wrong.
> 
>  From his mail am I assuming he wants his Makefile to print "BAR" for a 
> target "test-stem" as well as "subdir/test-stem", which is what he will 
> get when he uses $(eval ...).

Because he is using a pattern-specific variable assignment instead of
just assigning the variable globally we can infer that he would like to
have the "FOO = BAR" assignment only in the context of targets that
match that pattern but not other targets.

So for this makefile:

  test-%: FOO = BAR
  test-%:
          echo $(FOO)

  other:
          echo $(FOO)

He would like to see:

  $ make test-foo
  echo BAR
  BAR

  $ make other
  echo

If we change the pattern-specific variable to use $(eval FOO = BAR) he
would see:

  $ make test-foo
  echo BAR
  BAR

  $ make other
  echo BAR
  BAR



reply via email to

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