Current-Users archive

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

Re: make has problems w/ pkgsrc

On Tue, Dec 23, 2008 at 03:54:34PM +0100, Kurt Schreiner wrote:

> make: "../../mk/tools/../../mk/tools/" line 1249: Malformed 
> conditional
> (empty(${_TOOLS_DEPMETHOD.${:Udigest}}:C/\:.*$//:M${:Udigest>=20010302\:../../pkgtools/digest:C/\:.*$//}))

I know what causes this one, and a fix ...
The relevant source line is:

.        if empty(${_TOOLS_DEPMETHOD.${_t_}}:C/\:.*$//:M${_dep_:C/\:.*$//})

Both _t_ and _dep_ are control variables from .for loops.
The problematic part is the modifier :M${_dep_:C/\:.*$//}
If you try that modifier with the 'old' make and normal variables
you'll find it fails.
The 'problem' is that the code to find the end of the modifier
argument just scans for a ':' - so it sees ${_dep_ after that
it is all downhill!
The : (and the \:) could be \ escaped to make it work (but that
doesn't work for .for variables in the 'new' make).

The reason it used to work is that _dep_ was substituted as text
before the makefile was parsed - with the modifiers actioned.
So the :M argument was (something like) digest>=20010302.

With the 'new' version .for control variables are changed to
a variable expansion that will give the correct text, any
modifiers being appled when the line is parsed.
This means that .for control variables are valid in exactly the
same places as normal variables.
The expansion used is $[{(]<variable>[:})] => $[{(]:U<value>[:})]
(ie substitute for the variable "" being undefined)
Perhaps \ should be added to the list of valid terminators.

In any case it looks as though the script can be deemed broken!
Using a temorary variable will fix it, eg:
_dep_test := ${_dep_:C/\:.*$//}   
.        if empty(${_TOOLS_DEPMETHOD.${_t_}}:C/\:.*$//:M${_dep_test})
which will work with both new and old make.

Dunno why the other script fails :-(


David Laight:

Home | Main Index | Thread Index | Old Index