help-make
[Top][All Lists]
Advanced

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

RE: help with the scope of pattern-specific variables


From: Nestor Amaya
Subject: RE: help with the scope of pattern-specific variables
Date: Tue, 7 Aug 2001 09:07:26 -0400

My apologies... I should have been more explicit: the version I am using is
in fact 3.77. I get the same behaviour on either Solaris or DOS platforms. I
will upgrade and try again.

Thank you kindly for your help,

Nestor

-----Original Message-----
From: Paul D. Smith [mailto:address@hidden
Sent: Monday, August 06, 2001 5:22 PM
To: Nestor Amaya
Cc: 'address@hidden'
Subject: Re: help with the scope of pattern-specific variables


%% Nestor Amaya <address@hidden> writes:

  na> the prerequisites of a target do inherit the values of
  na> *target*-specific variables. This is my desired behaviour, and I
  na> have verified this with a testcase. However, in the next section
  na> of the book, the authors describe *pattern*-specific variables
  na> without mention of the scope of the assignment.  As with
  na> target-specific variable assignments, I would like the
  na> prerequisites of my target to also inherit the value of the parent
  na> target's *pattern*-specific variables. Is this possible?

It is possible, and it is the correct behavior.

  na> For example, given the following makefile:

  na>   ====================== Makfile ================================
  na>   TARGET_SPEC_VAR = tvar_not_ok
  na>   tvar : TARGET_SPEC_VAR = tvar_ok
  na>   tvar : tvar_dep;
  na>   tvar_dep : 
  na>           @echo $(TARGET_SPEC_VAR)

  na>   PATTERN_SPEC_VAR = pvar_not_ok
  na>   %.pvar : PATTERN_SPEC_VAR = pvar_ok
  na>   %.pvar : pvar_dep
  na>           @echo $(PATTERN_SPEC_VAR)
  na>   pvar_dep : 
  na>           @echo $(PATTERN_SPEC_VAR)

  na> But then if I type:
  na>   % make some.pvar
  na>   pvar_not_ok
  na>   pvar_ok

If I test this with GNU make 3.79.1, and I get:

  pvar_ok
  pvar_ok

Since you don't mention what version you're using I can't really say
much more than it works for me with the latest released code.

-- 
----------------------------------------------------------------------------
---
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad
Scientist



reply via email to

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