[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: missing separator
From: |
Dave Korn |
Subject: |
RE: missing separator |
Date: |
Mon, 6 Aug 2007 12:40:11 +0100 |
On 06 August 2007 01:04, Paul Smith wrote:
> On Sun, 2007-08-05 at 17:12 -0500, David A. Greene wrote:
>> I've got a series of nested calls that generate bits of makefile (rules,
>> variable assignments, etc.). One of the calls is producing a "missing
>> separator" error but of course the call itself looks just fine. I assume
>> the problem is with one of the nested calls or in some of the generated
>> makefile content. Is there any good way to trace what is going on and try
>> to track down the problem? I've tried writing simplified testcases with
>> no luck reproducing the problem.
>
> This can get pretty tricky, no doubt.
>
> The simplest answer is to replace your $(eval ...) functions with
> $(info ...) functions, at strategic places. Then make will print out
> EXACTLY what it would expand as the argument to call. You can do
> similar things with $(call ...) if you like.
>
> For deep nesting this can get tricky.
>
>
> Another option is to use the GNU make debugger; I've not used it much
> myself and I'm not sure what version of GNU make is currently supported,
> but you can find out more here:
>
> http://bashdb.sourceforge.net/remake/
I highly recommend this, assuming a 3.80-based make is good enough for your
application. Just add the "-X" option and you'll get reams of debugging
output showing every function call made and the exact output string it
returns. It usually makes spotting this kind of bug trivially easy since you
can see at a glance where the problem is.
Often, it's a result of trying to concatenate multi-line defines in a target
build rule. When variables are concatenated (e.g. using +=), make generally
adds a blank space, since it's thinking in terms of white-space separated
wordlists. If you were hoping for one string to end with a newline, and the
next to begin with a TAB and be part of the same rule, this space prefixes the
TAB and breaks the rule. The workaround is for the multi-line define to end
with a newline followed by a blank line with a TAB at the start. The space
then gets appended to this TAB, resulting in a valid build rule command line
(TAB + space + start of next rule command).
cheers,
DaveK
--
Can't think of a witty .sigline today....