Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 May 2013 00:50:00 +0000 (UTC)
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r250491 - projects/bmake/share/mk
Message-ID:  <201305110050.r4B0o0of031756@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sjg
Date: Sat May 11 00:50:00 2013
New Revision: 250491
URL: http://svnweb.freebsd.org/changeset/base/250491

Log:
  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.

Modified:
  projects/bmake/share/mk/meta2deps.py

Modified: projects/bmake/share/mk/meta2deps.py
==============================================================================
--- projects/bmake/share/mk/meta2deps.py	Sat May 11 00:05:05 2013	(r250490)
+++ projects/bmake/share/mk/meta2deps.py	Sat May 11 00:50:00 2013	(r250491)
@@ -124,6 +124,12 @@ def sort_unique(list, cmp=None, key=None
         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='',
 
     -m "MACHINE"
 
+    -a "MACHINE_ARCH"
+
     -H "HOST_TARGET"
 
     -D "DPDEPS"
@@ -548,6 +558,9 @@ def main(argv, klass=MetaFile, xopts='',
         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='',
     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='',
             conf['DPDEPS'] = a
         elif o == '-m':
             conf['MACHINE'] = a
+        elif o == '-T':
+            conf['TARGET_SPEC'] = a
         elif xoptf:
             xoptf(o, a, conf)
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305110050.r4B0o0of031756>