%% "Henry LeRoy Miller, Jr." <[EMAIL PROTECTED]> writes:

  hlm> I am unable to get the feature 'target-specific variables' to work.

  hlm> It appears that make attempts to interpret the assignment as a 
  hlm> dependency (pre-requisite).

  hlm> I found the bit about escaping the equal sign in the NEWS document 
  hlm> for 3.77 changes - it ought to be mentioned in the texinfo docs (or 
  hlm> at least referenced from the section dealing with target-specific 
  hlm> variables).

You only escape the equals sign if you _DON'T_ want to use
target-specific variables.  That is, if you had a dependency that
contained an = as part of the filename, you must escape it so make
doesn't think it's a target-specific variable.

Make looks at the first prerequisites to see if they look like a
variable assignment, and if they do it treats the line as a
target-specific variable assignment rather than a rule definition.

  hlm> test2 : pkgDir\=$(bDir)
  hlm>  @echo 'Here on elsewhere at $(pkgDir)'

This isn't a target-specific variable definition at all, because you've
escaped the = sign, so make treats it as a normal rule definition.

  hlm> #test3 : pkgDir=$(cDir)
  hlm> #        @echo 'Here on elsewhere at $(pkgDir)'

  hlm> test4 : test1 empty pkgDir\=$(cDir)
  hlm>  @echo 'Here on elsewhere at $(pkgDir)'

This is incorrect.

You cannot "mix and match" target-specific variable definitions with
normal rule definitions.  You cannot put a target-specific variable in
with a list of normal prerequisites, and you cannot put one in a rule
definition with a script attached.

Target-specific variable definitions are completely separate entities
from rules; they have a similar syntax, but are treated differently.

Write these as:

  test3: pkgDir=$(cDir)
  test3:
        @echo 'Here on elsewhere at $(pkgDir)'

  test4 : pkgDir = $(cDir)
  test4 : test1 empty
        @echo 'Here on elsewhere at $(pkgDir)'

and it will work.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Reply via email to