bug-make
[Top][All Lists]
Advanced

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

Re: Make bug related to backquotes


From: Paul D. Smith
Subject: Re: Make bug related to backquotes
Date: Tue, 31 Aug 2004 19:42:26 -0400

%% Pierre B <address@hidden> writes:

  pb> The problem is with the backquote AND/OR addprefix.
  pb> The following makefile illustrates the bug.

I think you're misunderstanding something basic here.

Make does not process backquotes.  The shell processes backquotes.  Make
only processes functions, such as the $(shell ...) function.

So, the result of this line:

  buggy_string:=`ls *.tst`#

is to create a variable named "buggy_string" with the literal contents
"`ls *.tst`", _NOT_ the expansion of the backquote.

Then later we see:

  pb>   @ echo xbeginx $(addprefix ./,${buggy_string}) xendx mucked up

What does this do?  The addprefix function is invoked before the script
is passed to the shell, so the actual shell command that's being run
here is:

    echo xbeginx ./`ls ./*.tst` xendx mucked up

Now you can see why you get the results you do.


It would be enlightening, perhaps, for you to invoke make with the -n
option so it prints the commands it would send to the shell without
actually sending them there.  Then you can see what is being expanded by
make and what isn't.

Also, you could remove the "@" prefix characters until you know it's
working, to see exactly what's going on.

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