bug-make
[Top][All Lists]
Advanced

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

Re: Please help with syntax for target specific variable


From: Paul D. Smith
Subject: Re: Please help with syntax for target specific variable
Date: Tue, 27 Aug 2002 13:37:19 -0400

%% "Jai Maraj" <address@hidden> writes:

  jm> I'm having trouble using a 'target specific variable' .
  jm> I haven't used this feature before and am sure what I'm doing wrong.

  jm> Makefile content is

  jm> jaitest: MYVAR=friend
  jm>         @echo Hello $(MYVAR)

This is not a target-specific variable definition.  This is a rule
definition, with a target of "jaitest", a prerequisite of
"MYVAR=friend", and a command script of "@echo Hello $(MYVAR)".

You cannot mix target-specific variables with rule definitions; they may
look syntactically similar but they are completely different things.

You want to write:

  jaitest: MYVAR = friend

  jaitest:
        @echo Hello $(MYVAR)

which is two things: the first line is a target-specific variable
setting for the target "jaitest", and the second thing is a rule
definition with a target of "jaitest" and no prerequisites, and a
command script of "@echo Hello $(MYVAR)".

  jm> Make version & machine info
  jm> Version: GNU Make version 3.76.1

Also please be aware that target-specific variables are _NOT_ supported
in this very old version of GNU make.

You will need to upgrade to a newer version (the current version is
3.79.1) if you want to use this feature.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]