aboutsummaryrefslogtreecommitdiffstats
path: root/mk/meta2deps.py
diff options
context:
space:
mode:
Diffstat (limited to 'mk/meta2deps.py')
-rwxr-xr-xmk/meta2deps.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/mk/meta2deps.py b/mk/meta2deps.py
index 6b6157c3ab4c..8c42303373f0 100755
--- a/mk/meta2deps.py
+++ b/mk/meta2deps.py
@@ -35,7 +35,7 @@ We only pay attention to a subset of the information in the
"""
RCSid:
- $Id: meta2deps.py,v 1.12 2013/03/31 22:31:59 sjg Exp $
+ $Id: meta2deps.py,v 1.13 2013/05/11 05:16:26 sjg Exp $
Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved.
@@ -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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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)