help-make
[Top][All Lists]
Advanced

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

Re: Question about target specific variable


From: Paul D. Smith
Subject: Re: Question about target specific variable
Date: Wed, 5 Nov 2003 17:32:04 -0500

%% "Qingyi Grace Yu" <address@hidden> writes:

  qgy> I have a question about target specific variable. My Makefile
  qgy> consists of  following parts:

  qgy> include file_1
  qgy> ...
  qgy> LIBRARY = libftcaux.so
  qgy> TARG = $(LIBDIR)/$(LIBRARY)
       ^^^^
I assume this should be TARGET, not TARG?
  qgy> ...
  qgy> include file_2


  qgy> In file_1, there are:

  qgy> opt : $(TARGET)
  qgy> ...
  qgy> opt : LIBDIR = $(PROTODIR)/opt/lib
  qgy> ...

  qgy> When I invoke make by "make opt", it returns
        ...
  qgy> That means LIBDIR is not defined in my Makefile. But if I change
  qgy> the target specific variable to a norml assignment, i.e. "LIBDIR
  qgy> = $(PROTODIR)/opt/lib" instead of "opt : LIBDIR =
  qgy> $(PROTODIR)/opt/lib", everything works fine.

Yes, this is exactly as expected.

  qgy> Wondering if I'm doing anything wrong here. Could you help me?

See the GNU make section on target-specific variables; it says:

>    The other exception is "target-specific variable values".  This
> feature allows you to define different values for the same variable,
> based on the target that `make' is currently building.  As with
> automatic variables, these values are only available within the context
> of a target's command script (and in other target-specific assignments).

Note the last sentence.

-- 
-------------------------------------------------------------------------------
 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]