[Top][All Lists]

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

Re: Strange behaviour with variable

From: hans . peter . van . lohuizen
Subject: Re: Strange behaviour with variable
Date: Wed, 7 Jan 2004 09:42:51 +0100

Thanks Paul for your comments sofar,
in fact I had an issue with the $(GREP) as described below.

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

Sorry I left this out, Yes I had a filter function for comment lines in with # and empty lines:

GREP = egrep -v '^ *$|#'
first I had the line:
MODULES   = $(shell cat ../bin/module.hier | egrep -v '^$|#' )
But then make complained about missing ).
I thought that # in a shell function was allowed but it seems that make is interpreting
everything after # as comment even if it is in a shell function??

By writing:
MODULES   = $(shell cat ../bin/module.hier | $(GREP) )
It seemed to work correctly.
Although I just found out that commentlines starting with # will still give an error and are
not filtered out, but lines starting with a space and then a # are filtered. Can you explain this?
Would there be a better way to filter #-lines in make?

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

 pds>You're adding all kinds of whitespace here.  By putting whitespace at
 pds>the end of the line (separating the function from the comment at the end
 pds>of the line) you're adding whitespace.  

OK I see that now.

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

 pds>Anyway, make invokes a shell and the shell will strip extra whitespace
 pds>before it invokes the echo.
Good point, that will explain I did not see spaces.

reply via email to

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