Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 May 2014 17:58:00 +0000 (UTC)
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r265374 - projects/bmake/share/mk
Message-ID:  <201405051758.s45Hw0fu018077@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sjg
Date: Mon May  5 17:58:00 2014
New Revision: 265374
URL: http://svnweb.freebsd.org/changeset/base/265374

Log:
  Update to latest versions.

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

Modified: projects/bmake/share/mk/dirdeps.mk
==============================================================================
--- projects/bmake/share/mk/dirdeps.mk	Mon May  5 17:56:10 2014	(r265373)
+++ projects/bmake/share/mk/dirdeps.mk	Mon May  5 17:58:00 2014	(r265374)
@@ -1,4 +1,4 @@
-# $Id: dirdeps.mk,v 1.28 2013/03/25 21:11:43 sjg Exp $
+# $Id: dirdeps.mk,v 1.33 2014/03/14 22:25:35 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -44,7 +44,7 @@
 #	All unqualified entries end up being qualified with .${TARGET_SPEC}
 #	and partially qualified (if TARGET_SPEC_VARS has multiple
 #	entries) are also expanded to a full .<target_spec>.
-#	The  _DIRDEPS_USE target uses the suffix to set TARGET_SPEC
+#	The  _DIRDEP_USE target uses the suffix to set TARGET_SPEC
 #	correctly when visiting each entry.
 #
 #	The fully qualified directory entries are used to construct a
@@ -71,7 +71,7 @@
 #
 # TARGET_SPEC_VARS
 #	The default value is just MACHINE, and for most environments
-#	this is sufficient.  The _DIRDEPS_USE target actually sets
+#	this is sufficient.  The _DIRDEP_USE target actually sets
 #	both MACHINE and TARGET_SPEC to the suffix of the current
 #	target so that in the general case TARGET_SPEC can be ignored.
 #
@@ -196,7 +196,11 @@ N_notmachine := ${.MAKE.DEPENDFILE_PREFE
 # if we were included recursively _DEP_TARGET_SPEC should be valid.
 .if empty(_DEP_TARGET_SPEC)
 # we may or may not have included a dependfile yet
+.if defined(.INCLUDEDFROMFILE)
+_last_dependfile := ${.INCLUDEDFROMFILE:M${.MAKE.DEPENDFILE_PREFIX}*}
+.else
 _last_dependfile := ${.MAKE.MAKEFILES:M*/${.MAKE.DEPENDFILE_PREFIX}*:[-1]}
+.endif
 .if !empty(_debug_reldir)
 .info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _last_dependfile='${_last_dependfile}'
 .endif
@@ -239,7 +243,8 @@ DEP_MACHINE := ${_DEP_TARGET_SPEC}
 # we can use this as a clue to do initialization and other one time things.
 .if !target(_DIRDEP_USE)
 # make sure this target exists
-dirdeps:
+dirdeps: beforedirdeps .WAIT
+beforedirdeps:
 
 # We normally expect to be included by Makefile.depend.*
 # which sets the DEP_* macros below.
@@ -269,11 +274,14 @@ DEP_SKIP_DIR = ${SKIP_DIR} \
 
 NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}}
 
-.if defined(NO_DIRDEPS) || defined(NODIRDEPS)
+.if defined(NO_DIRDEPS) || defined(NODIRDEPS) || defined(WITHOUT_DIRDEPS)
 # confine ourselves to the original dir
 DIRDEPS_FILTER += M${_DEP_RELDIR}*
 .endif
 
+# this is what we run below
+DIRDEP_MAKE?= ${.MAKE}
+
 # we supress SUBDIR when visiting the leaves
 # we assume sys.mk will set MACHINE_ARCH
 # you can add extras to DIRDEP_USE_ENV
@@ -285,7 +293,7 @@ _DIRDEP_USE:	.USE .MAKE
 		MACHINE_ARCH= NO_SUBDIR=1 ${DIRDEP_USE_ENV} \
 		TARGET_SPEC=${.TARGET:E} \
 		MACHINE=${.TARGET:E} \
-		${.MAKE} -C ${.TARGET:R} || exit 1; \
+		${DIRDEP_MAKE} -C ${.TARGET:R} || exit 1; \
 		break; \
 	done
 
@@ -397,7 +405,7 @@ DEP_DIRDEPS_FILTER = U
 .endif
 
 # this is what we start with
-__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:O:u:@d@${SRCTOP}/$d@}
+__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:C,//+,/,g:O:u:@d@${SRCTOP}/$d@}
 
 # some entries may be qualified with .<machine> 
 # the :M*/*/*.* just tries to limit the dirs we check to likely ones.

Modified: projects/bmake/share/mk/gendirdeps.mk
==============================================================================
--- projects/bmake/share/mk/gendirdeps.mk	Mon May  5 17:56:10 2014	(r265373)
+++ projects/bmake/share/mk/gendirdeps.mk	Mon May  5 17:58:00 2014	(r265374)
@@ -1,4 +1,4 @@
-# $Id: gendirdeps.mk,v 1.21 2013/03/28 20:01:05 sjg Exp $
+# $Id: gendirdeps.mk,v 1.25 2014/03/14 21:28:37 sjg Exp $
 
 # Copyright (c) 2010-2013, Juniper Networks, Inc.
 # All rights reserved.
@@ -162,7 +162,7 @@ dir_list != cd ${_OBJDIR} && \
 .warning Skipping ${_DEPENDFILE:S,${SRCTOP}/,,}
 # we are not going to update anything
 .else
-
+dpadd_dir_list=
 .if !empty(DPADD)
 _nonlibs := ${DPADD:T:Nlib*:N*include}
 .if !empty(_nonlibs)
@@ -174,6 +174,7 @@ ddep_list += $f.dirdep
 ddep_list += ${f:H}.dirdep
 .else
 dir_list += ${f:H:tA}
+dpadd_dir_list += ${f:H:tA}
 .endif
 .endfor
 .if !empty(ddep_list)
@@ -197,7 +198,7 @@ dir_list += ${ddeps}
 # so we add 
 # ${"${dir_list:M*bsd/sys/${MACHINE_ARCH}/include}":?bsd/include:}
 # to GENDIRDEPS_DIR_LIST_XTRAS
-_objtops = ${OBJTOP} ${_OBJTOP} ${_obtop}
+_objtops = ${OBJTOP} ${_OBJTOP} ${_objtop}
 _objtops := ${_objtops:O:u}
 dirdep_list = \
 	${_objtops:@o@${dir_list:M$o*/*:C,$o[^/]*/,,}@} \
@@ -212,8 +213,11 @@ M2D_OBJROOTS := ${M2D_OBJROOTS:O:u:[-1..
 skip_ql= ${SRCTOP}* ${_objtops:@o@$o*@}
 .for o in ${M2D_OBJROOTS:${skip_ql:${M_ListToSkip}}}
 # we need := so only skip_ql to this point applies
-ql :=	${dir_list:${skip_ql:${M_ListToSkip}}:M$o*/*/*:C,$o([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,}
-qualdir_list += ${ql}
+ql.$o := ${dir_list:${skip_ql:${M_ListToSkip}}:M$o*/*/*:C,$o([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,}
+qualdir_list += ${ql.$o}
+.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
+.info ${RELDIR}: o=$o ${ql.$o qualdir_list:L:@v@$v=${$v}@}
+.endif
 skip_ql+= $o*
 .endfor
 
@@ -225,7 +229,7 @@ DIRDEPS = \
 	${qualdir_list:N${RELDIR}.*:N${RELDIR}/*}
 
 # We only consider things below $RELDIR/ if they have a makefile.
-# This is the same test that _DIRDEPS_USE applies.
+# This is the same test that _DIRDEP_USE applies.
 # We have do a double test with dirdep_list as it _may_ contain 
 # qualified dirs - if we got anything from a stage dir.
 # qualdir_list we know are all qualified.
@@ -236,11 +240,12 @@ DIRDEPS += \
 	${dirdep_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/$d/$m):?$d:${exists(${SRCTOP}/${d:R}/$m):?$d:}}@}@} \
 	${qualdir_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/${d:R}/$m):?$d:}@}@}
 
-DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:O:u}
+DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:C,//+,/,g:O:u}
 
 .if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
 .info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS}
 .info ${RELDIR}: dir_list='${dir_list}'
+.info ${RELDIR}: dpadd_dir_list='${dpadd_dir_list}'
 .info ${RELDIR}: dirdep_list='${dirdep_list}'
 .info ${RELDIR}: qualdir_list='${qualdir_list}'
 .info ${RELDIR}: SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS}'
@@ -256,7 +261,7 @@ src_dirdep_list = \
 SRC_DIRDEPS = \
 	${src_dirdep_list:N${RELDIR}:N${RELDIR}/*:C,(/h)/.*,,}
 
-SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:O:u}
+SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:C,//+,/,g:O:u}
 
 # if you want to capture SRC_DIRDEPS in .MAKE.DEPENDFILE put
 # SRC_DIRDEPS_FILE = ${_DEPENDFILE} 

Modified: projects/bmake/share/mk/meta2deps.py
==============================================================================
--- projects/bmake/share/mk/meta2deps.py	Mon May  5 17:56:10 2014	(r265373)
+++ projects/bmake/share/mk/meta2deps.py	Mon May  5 17:58:00 2014	(r265374)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+
 """
 This script parses each "meta" file and extracts the
 information needed to deduce build and src dependencies.
@@ -35,7 +37,7 @@ We only pay attention to a subset of the
 
 """
 RCSid:
-	$Id: meta2deps.py,v 1.15 2013/07/29 20:41:23 sjg Exp $
+	$Id: meta2deps.py,v 1.16 2013/12/20 06:08:52 sjg Exp $
 
 	Copyright (c) 2011-2013, Juniper Networks, Inc.
 	All rights reserved.
@@ -90,14 +92,14 @@ def resolve(path, cwd, last_dir=None, de
             continue
         p = '/'.join([d,path])
         if debug > 2:
-            print >> debug_out, "looking for:", p,
+            print("looking for:", p, end=' ', file=debug_out)
         if not os.path.exists(p):
             if debug > 2:
-                print >> debug_out, "nope"
+                print("nope", file=debug_out)
             p = None
             continue
         if debug > 2:
-            print >> debug_out, "found:", p
+            print("found:", p, file=debug_out)
         return p
     return None
 
@@ -236,21 +238,21 @@ class MetaFile:
             self.objroots.sort(reverse=True)
             
             if self.debug:
-                print >> self.debug_out, "host_target=", self.host_target
-                print >> self.debug_out, "srctops=", self.srctops
-                print >> self.debug_out, "objroots=", self.objroots
+                print("host_target=", self.host_target, file=self.debug_out)
+                print("srctops=", self.srctops, file=self.debug_out)
+                print("objroots=", self.objroots, file=self.debug_out)
 
             self.dirdep_re = re.compile(r'([^/]+)/(.+)')
 
         if self.dpdeps and not self.reldir:
             if self.debug:
-                print >> self.debug_out, "need reldir:",
+                print("need reldir:", end=' ', file=self.debug_out)
             if self.curdir:
                 srctop = self.find_top(self.curdir, self.srctops)
                 if srctop:
                     self.reldir = self.curdir.replace(srctop,'')
                     if self.debug:
-                        print >> self.debug_out, self.reldir
+                        print(self.reldir, file=self.debug_out)
             if not self.reldir:
                 self.dpdeps = None      # we cannot do it?
 
@@ -280,7 +282,7 @@ class MetaFile:
         if not self.reldir:
             return None
         for f in sort_unique(self.file_deps):
-            print >> out, 'DPDEPS_%s += %s' % (f, self.reldir)
+            print('DPDEPS_%s += %s' % (f, self.reldir), file=out)
 
     def seenit(self, dir):
         """rememer that we have seen dir."""
@@ -291,14 +293,14 @@ class MetaFile:
         if data not in list:
             list.append(data)
             if self.debug:
-                print >> self.debug_out, "%s: %sAdd: %s" % (self.name, clue, data)
+                print("%s: %sAdd: %s" % (self.name, clue, data), file=self.debug_out)
 
     def find_top(self, path, list):
         """the logical tree may be split accross multiple trees"""
         for top in list:
             if path.startswith(top):
                 if self.debug > 2:
-                    print >> self.debug_out, "found in", top
+                    print("found in", top, file=self.debug_out)
                 return top
         return None
 
@@ -307,9 +309,9 @@ class MetaFile:
         ddep = None
         for ddepf in [path + '.dirdep', dir + '/.dirdep']:
             if not ddep and os.path.exists(ddepf):
-                ddep = open(ddepf, 'rb').readline().strip('# \n')
+                ddep = open(ddepf, 'r').readline().strip('# \n')
                 if self.debug > 1:
-                    print >> self.debug_out, "found %s: %s\n" % (ddepf, ddep)
+                    print("found %s: %s\n" % (ddepf, ddep), file=self.debug_out)
                 if ddep.endswith(self.machine):
                     ddep = ddep[0:-(1+len(self.machine))]
                 elif self.target_spec and ddep.endswith(self.target_spec):
@@ -331,7 +333,7 @@ class MetaFile:
                     if not (self.machine == 'host' and
                             dmachine == self.host_target):
                         if self.debug > 2:
-                            print >> self.debug_out, "adding .%s to %s" % (dmachine, ddep)
+                            print("adding .%s to %s" % (dmachine, ddep), file=self.debug_out)
                         ddep += '.' + dmachine
 
         return ddep
@@ -342,7 +344,7 @@ class MetaFile:
             self.parse(name, file)
         except:
             # give a useful clue
-            print >> sys.stderr, '{}:{}: '.format(self.name, self.line),
+            print('{}:{}: '.format(self.name, self.line), end=' ', file=sys.stderr)
             raise
         
     def parse(self, name=None, file=None):
@@ -379,7 +381,7 @@ class MetaFile:
             f = file
             cwd = last_dir = self.cwd
         else:
-            f = open(self.name, 'rb')
+            f = open(self.name, 'r')
         skip = True
         pid_cwd = {}
         pid_last_dir = {}
@@ -396,7 +398,7 @@ class MetaFile:
             if not line[0] in interesting:
                 continue
             if self.debug > 2:
-                print >> self.debug_out, "input:", line,
+                print("input:", line, end=' ', file=self.debug_out)
             w = line.split()
 
             if skip:
@@ -413,7 +415,7 @@ class MetaFile:
                     self.cwd = cwd = last_dir = w[1]
                     self.seenit(cwd)    # ignore this
                     if self.debug:
-                        print >> self.debug_out, "%s: CWD=%s" % (self.name, cwd)
+                        print("%s: CWD=%s" % (self.name, cwd), file=self.debug_out)
                 continue
 
             pid = int(w[1])
@@ -438,12 +440,12 @@ class MetaFile:
                     cwd = cwd[0:-2]
                 last_dir = cwd
                 if self.debug > 1:
-                    print >> self.debug_out, "cwd=", cwd
+                    print("cwd=", cwd, file=self.debug_out)
                 continue
 
             if w[2] in self.seen:
                 if self.debug > 2:
-                    print >> self.debug_out, "seen:", w[2]
+                    print("seen:", w[2], file=self.debug_out)
                 continue
             # file operations
             if w[0] in 'ML':
@@ -461,7 +463,7 @@ class MetaFile:
             dir,base = os.path.split(path)
             if dir in self.seen:
                 if self.debug > 2:
-                    print >> self.debug_out, "seen:", dir
+                    print("seen:", dir, file=self.debug_out)
                 continue
             # we can have a path in an objdir which is a link
             # to the src dir, we may need to add dependencies for each
@@ -472,19 +474,19 @@ class MetaFile:
             # now put path back together
             path = '/'.join([dir,base])
             if self.debug > 1:
-                print >> self.debug_out, "raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path)
+                print("raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path), file=self.debug_out)
             if w[0] in 'SRWL':
                 if w[0] == 'W' and path.endswith('.dirdep'):
                     continue
                 if path in [last_dir, cwd, self.cwd, self.curdir]:
                     if self.debug > 1:
-                        print >> self.debug_out, "skipping:", path
+                        print("skipping:", path, file=self.debug_out)
                     continue
                 if os.path.isdir(path):
                     if w[0] in 'RW':
                         last_dir = path;
                     if self.debug > 1:
-                        print >> self.debug_out, "ldir=", last_dir
+                        print("ldir=", last_dir, file=self.debug_out)
                     continue
 
             if w[0] in 'REWML':
@@ -642,10 +644,10 @@ def main(argv, klass=MetaFile, xopts='',
     debug_out = getv(conf, 'debug_out', sys.stderr)
 
     if debug:
-        print >> debug_out, "config:"
-        print >> debug_out, "psyco=", have_psyco
-        for k,v in conf.items():
-            print >> debug_out, "%s=%s" % (k,v)
+        print("config:", file=debug_out)
+        print("psyco=", have_psyco, file=debug_out)
+        for k,v in list(conf.items()):
+            print("%s=%s" % (k,v), file=debug_out)
 
     for a in args:
         if a.endswith('.meta'):
@@ -657,9 +659,9 @@ def main(argv, klass=MetaFile, xopts='',
                     m = klass(f, conf)
 
     if output:
-        print m.dirdeps()
+        print(m.dirdeps())
 
-        print m.src_dirdeps('\nsrc:')
+        print(m.src_dirdeps('\nsrc:'))
 
         dpdeps = getv(conf, 'DPDEPS')
         if dpdeps:
@@ -672,6 +674,6 @@ if __name__ == '__main__':
         main(sys.argv)
     except:
         # yes, this goes to stdout
-        print "ERROR: ", sys.exc_info()[1]
+        print("ERROR: ", sys.exc_info()[1])
         raise
 



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