Allow caller to pass a TARGET_SPEC which may be more complex than
just MACHINE, for recognizing objects which do not need qualifying in dirdeps.
This commit is contained in:
parent
3655322b21
commit
bf0627757f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/bmake/; revision=250491
@ -124,6 +124,12 @@ def sort_unique(list, cmp=None, key=None, reverse=False):
|
||||
nl.append(e)
|
||||
return nl
|
||||
|
||||
def add_trims(x):
|
||||
return ['/' + x + '/',
|
||||
'/' + x,
|
||||
x + '/',
|
||||
x]
|
||||
|
||||
class MetaFile:
|
||||
"""class to parse meta files generated by bmake."""
|
||||
|
||||
@ -152,6 +158,9 @@ def __init__(self, name, conf={}):
|
||||
set to 'none' if we are not cross-building.
|
||||
More specifically if machine cannot be deduced from objdirs.
|
||||
|
||||
TARGET_SPEC
|
||||
Sometimes MACHINE isn't enough.
|
||||
|
||||
HOST_TARGET
|
||||
when we build for the psuedo machine 'host'
|
||||
the object tree uses HOST_TARGET rather than MACHINE.
|
||||
@ -177,6 +186,8 @@ def __init__(self, name, conf={}):
|
||||
self.debug_out = getv(conf, 'debug_out', sys.stderr)
|
||||
|
||||
self.machine = getv(conf, 'MACHINE', '')
|
||||
self.machine_arch = getv(conf, 'MACHINE_ARCH', '')
|
||||
self.target_spec = getv(conf, 'TARGET_SPEC', '')
|
||||
self.curdir = getv(conf, 'CURDIR')
|
||||
self.reldir = getv(conf, 'RELDIR')
|
||||
self.dpdeps = getv(conf, 'DPDEPS')
|
||||
@ -196,16 +207,11 @@ def __init__(self, name, conf={}):
|
||||
if not _srctop in self.srctops:
|
||||
self.srctops.append(_srctop)
|
||||
|
||||
trim_list = ['/' + self.machine + '/',
|
||||
'/' + self.machine,
|
||||
self.machine + '/',
|
||||
self.machine]
|
||||
|
||||
trim_list = add_trims(self.machine)
|
||||
if self.machine == 'host':
|
||||
trim_list += ['/' + self.host_target + '/',
|
||||
'/' + self.host_target,
|
||||
self.host_target + '/',
|
||||
self.host_target]
|
||||
trim_list += add_trims(self.host_target)
|
||||
if self.target_spec:
|
||||
trim_list += add_trims(self.target_spec)
|
||||
|
||||
for objroot in getv(conf, 'OBJROOTS', []):
|
||||
for e in trim_list:
|
||||
@ -303,6 +309,8 @@ def find_obj(self, objroot, dir, path, input):
|
||||
print >> self.debug_out, "found %s: %s\n" % (ddepf, ddep)
|
||||
if ddep.endswith(self.machine):
|
||||
ddep = ddep[0:-(1+len(self.machine))]
|
||||
elif self.target_spec and ddep.endswith(self.target_spec):
|
||||
ddep = ddep[0:-(1+len(self.target_spec))]
|
||||
|
||||
if not ddep:
|
||||
# no .dirdeps, so remember that we've seen the raw input
|
||||
@ -520,6 +528,8 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
|
||||
|
||||
-m "MACHINE"
|
||||
|
||||
-a "MACHINE_ARCH"
|
||||
|
||||
-H "HOST_TARGET"
|
||||
|
||||
-D "DPDEPS"
|
||||
@ -548,6 +558,9 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
|
||||
machine = os.environ['MACHINE']
|
||||
if machine:
|
||||
conf['MACHINE'] = machine
|
||||
machine_arch = os.environ['MACHINE_ARCH']
|
||||
if machine_arch:
|
||||
conf['MACHINE_ARCH'] = machine_arch
|
||||
srctop = os.environ['SB_SRC']
|
||||
if srctop:
|
||||
conf['SRCTOPS'].append(srctop)
|
||||
@ -560,9 +573,11 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
|
||||
debug = 0
|
||||
output = True
|
||||
|
||||
opts, args = getopt.getopt(argv[1:], 'dS:C:O:R:m:D:H:q' + xopts)
|
||||
opts, args = getopt.getopt(argv[1:], 'a:dS:C:O:R:m:D:H:qT:' + xopts)
|
||||
for o, a in opts:
|
||||
if o == '-d':
|
||||
if o == '-a':
|
||||
conf['MACHINE_ARCH'] = a
|
||||
elif o == '-d':
|
||||
debug += 1
|
||||
elif o == '-q':
|
||||
output = False
|
||||
@ -582,6 +597,8 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
|
||||
conf['DPDEPS'] = a
|
||||
elif o == '-m':
|
||||
conf['MACHINE'] = a
|
||||
elif o == '-T':
|
||||
conf['TARGET_SPEC'] = a
|
||||
elif xoptf:
|
||||
xoptf(o, a, conf)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user