help-make
[Top][All Lists]
Advanced

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

Re: Strange behaviour with variable


From: Paul D. Smith
Subject: Re: Strange behaviour with variable
Date: Tue, 6 Jan 2004 11:13:40 -0500

%% address@hidden writes:

  hpvl> When experimenting with some input variables I found the following
  hpvl> strange behaviour: 

  hpvl> I have an external module.hier file listing modules to be processed. 
  hpvl> I use the following lines in the generic makefile: 

  hpvl>  MODULES   = $(shell cat module.hier | $(GREP) )
                                               ^^^^^^^
Just $(GREP)?  Aren't you missing something here?

  hpvl> #determine list of modules 
  hpvl>  TOP_MOD   = $(word $(words $(MODULES)),$(MODULES) )   #determine last 
module from list 

You're adding all kinds of whitespace here.  By putting whitespace at
the end of the line (separating the function from the comment at the end
of the line) you're adding whitespace.  See the GNU make manual sections
"The Two Flavors of Variables" and "Setting Values".

  hpvl> When I do an echo of $(TOP_MOD) I do not see these spaces! 

How can you see spaces? :)

Anyway, make invokes a shell and the shell will strip extra whitespace
before it invokes the echo.

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