aboutsummaryrefslogtreecommitdiff
path: root/share/mk/meta2deps.py
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2013-05-11 00:50:00 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2013-05-11 00:50:00 +0000
commitbf0627757fb8f95773e96a26fe7d71c795f7e806 (patch)
tree480b303e4c6ec80e0da199a9f208bf8b5cce4250 /share/mk/meta2deps.py
parent3655322b2183ced3124aa0c718573dd307d914b4 (diff)
downloadsrc-bf0627757fb8f95773e96a26fe7d71c795f7e806.tar.gz
src-bf0627757fb8f95773e96a26fe7d71c795f7e806.zip
Notes
Diffstat (limited to 'share/mk/meta2deps.py')
-rwxr-xr-xshare/mk/meta2deps.py39
1 files changed, 28 insertions, 11 deletions
diff --git a/share/mk/meta2deps.py b/share/mk/meta2deps.py
index 6b6157c3ab4c..97b2381ae48f 100755
--- a/share/mk/meta2deps.py
+++ b/share/mk/meta2deps.py
@@ -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)