summaryrefslogtreecommitdiffstats
path: root/contrib/bmake/mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/mk')
-rw-r--r--contrib/bmake/mk/ChangeLog15
-rw-r--r--contrib/bmake/mk/init.mk8
-rw-r--r--contrib/bmake/mk/install-mk4
-rw-r--r--contrib/bmake/mk/lib.mk21
-rwxr-xr-xcontrib/bmake/mk/meta2deps.py36
-rw-r--r--contrib/bmake/mk/own.mk3
-rw-r--r--contrib/bmake/mk/prog.mk11
7 files changed, 73 insertions, 25 deletions
diff --git a/contrib/bmake/mk/ChangeLog b/contrib/bmake/mk/ChangeLog
index 32e064b..db1e289 100644
--- a/contrib/bmake/mk/ChangeLog
+++ b/contrib/bmake/mk/ChangeLog
@@ -1,3 +1,18 @@
+2013-07-26 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * install-mk (MK_VERSION): 20130726
+ some updates from Juniper and FreeBSD
+ o meta2deps.py: indicate file and line number when we hit parse
+ errors
+ also allow @file to provide huge list of .meta files.
+ * meta2deps.py: add try_parse() to cleanup the above.
+
+2013-07-16 Simon J. Gerraty <sjg@bad.crufty.net>
+
+ * install-mk (MK_VERSION): 20130716
+ * own.mk: add GPROG as an option
+ * prog.mk: honor MK_GPROF==yes
+
2013-05-10 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20130505
diff --git a/contrib/bmake/mk/init.mk b/contrib/bmake/mk/init.mk
index ed63fe6..e700370 100644
--- a/contrib/bmake/mk/init.mk
+++ b/contrib/bmake/mk/init.mk
@@ -1,4 +1,4 @@
-# $Id: init.mk,v 1.8 2012/11/11 22:37:02 sjg Exp $
+# $Id: init.mk,v 1.9 2013/07/18 05:46:24 sjg Exp $
#
# @(#) Copyright (c) 2002, Simon J. Gerraty
#
@@ -36,6 +36,12 @@ COPTS += ${COPTS.${.IMPSRC:T}}
CPPFLAGS += ${CPPFLAGS.${.IMPSRC:T}}
CPUFLAGS += ${CPUFLAGS.${.IMPSRC:T}}
+CC_PG?= -pg
+CXX_PG?= ${CC_PG}
+CC_PIC?= -DPIC
+CXX_PIC?= ${CC_PIC}
+PROFFLAGS?= -DGPROF -DPROF
+
.if ${.MAKE.LEVEL:U1} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no"
# this tells lib.mk and prog.mk to not actually build anything
_SKIP_BUILD = not building at level 0
diff --git a/contrib/bmake/mk/install-mk b/contrib/bmake/mk/install-mk
index da15d80..59b1b01 100644
--- a/contrib/bmake/mk/install-mk
+++ b/contrib/bmake/mk/install-mk
@@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
-# $Id: install-mk,v 1.90 2013/05/11 05:16:26 sjg Exp $
+# $Id: install-mk,v 1.92 2013/07/27 05:37:37 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@@ -70,7 +70,7 @@
# sjg@crufty.net
#
-MK_VERSION=20130505
+MK_VERSION=20130726
OWNER=
GROUP=
MODE=444
diff --git a/contrib/bmake/mk/lib.mk b/contrib/bmake/mk/lib.mk
index 24f9527..f219115 100644
--- a/contrib/bmake/mk/lib.mk
+++ b/contrib/bmake/mk/lib.mk
@@ -1,4 +1,4 @@
-# $Id: lib.mk,v 1.48 2012/11/12 04:08:18 sjg Exp $
+# $Id: lib.mk,v 1.49 2013/07/18 05:46:24 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@@ -146,9 +146,6 @@ LD_shared=${SHLIB_SHFLAGS}
MKPICLIB?= yes
# sys.mk can override these
-CC_PG?=-pg
-CC_PIC?=-DPIC
-
LD_X?=-X
LD_x?=-x
LD_r?=-r
@@ -284,7 +281,7 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age
.if (${LD_X} == "")
.c.po:
- ${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET}
+ ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}
.cc.po .C.po:
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
@@ -293,14 +290,14 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age
${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
.else
.c.po:
- @echo ${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET}.o
+ @echo ${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}
+ @${COMPILE.c} ${CC_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.cc.po .C.po:
- @echo ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
+ @echo ${COMPILE.cc} ${CXX_PG} ${PROFFLAGS} ${.IMPSRC} -o ${.TARGET}
+ @${COMPILE.cc} ${CXX_PG} ${.IMPSRC} -o ${.TARGET}.o
@${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
@@ -319,7 +316,7 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age
${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}
.S.po .s.po:
- ${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
+ ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
.else
.c.so:
@@ -335,8 +332,8 @@ SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age
@rm -f ${.TARGET}.o
.S.po .s.po:
- @echo ${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
- @${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
+ @echo ${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
+ @${COMPILE.S} ${PROFFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
diff --git a/contrib/bmake/mk/meta2deps.py b/contrib/bmake/mk/meta2deps.py
index 8c42303..254f230 100755
--- a/contrib/bmake/mk/meta2deps.py
+++ b/contrib/bmake/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.13 2013/05/11 05:16:26 sjg Exp $
+ $Id: meta2deps.py,v 1.15 2013/07/29 20:41:23 sjg Exp $
Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved.
@@ -77,7 +77,7 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
"""
if path.endswith('/.'):
path = path[0:-2]
- if path[0] == '/':
+ if len(path) > 0 and path[0] == '/':
return path
if path == '.':
return cwd
@@ -107,10 +107,12 @@ def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
this gets called a lot, so we try to avoid calling realpath
until we know we have something.
"""
- path = resolve(path, cwd, last_dir, debug, debug_out)
- if path and (path.find('./') > 0 or
- path.endswith('/..') or
- os.path.islink(path)):
+ rpath = resolve(path, cwd, last_dir, debug, debug_out)
+ if rpath:
+ path = rpath
+ if (path.find('./') > 0 or
+ path.endswith('/..') or
+ os.path.islink(path)):
return os.path.realpath(path)
return path
@@ -191,6 +193,7 @@ class MetaFile:
self.curdir = getv(conf, 'CURDIR')
self.reldir = getv(conf, 'RELDIR')
self.dpdeps = getv(conf, 'DPDEPS')
+ self.line = 0
if not self.conf:
# some of the steps below we want to do only once
@@ -254,7 +257,7 @@ class MetaFile:
self.cwd = os.getcwd() # make sure this is initialized
if name:
- self.parse()
+ self.try_parse()
def reset(self):
"""reset state if we are being passed meta files from multiple directories."""
@@ -333,6 +336,15 @@ class MetaFile:
return ddep
+ def try_parse(self, name=None, file=None):
+ """give file and line number causing exception"""
+ try:
+ self.parse(name, file)
+ except:
+ # give a useful clue
+ print >> sys.stderr, '{}:{}: '.format(self.name, self.line),
+ raise
+
def parse(self, name=None, file=None):
"""A meta file looks like:
@@ -373,11 +385,13 @@ class MetaFile:
pid_last_dir = {}
last_pid = 0
+ self.line = 0
if self.curdir:
self.seenit(self.curdir) # we ignore this
interesting = 'CEFLRV'
for line in f:
+ self.line += 1
# ignore anything we don't care about
if not line[0] in interesting:
continue
@@ -634,7 +648,13 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
print >> debug_out, "%s=%s" % (k,v)
for a in args:
- m = klass(a, conf)
+ if a.endswith('.meta'):
+ m = klass(a, conf)
+ elif a.startswith('@'):
+ # there can actually multiple files per line
+ for line in open(a[1:]):
+ for f in line.strip().split():
+ m = klass(f, conf)
if output:
print m.dirdeps()
diff --git a/contrib/bmake/mk/own.mk b/contrib/bmake/mk/own.mk
index 85ea66b..e29ff9e 100644
--- a/contrib/bmake/mk/own.mk
+++ b/contrib/bmake/mk/own.mk
@@ -1,4 +1,4 @@
-# $Id: own.mk,v 1.26 2012/12/11 23:40:19 sjg Exp $
+# $Id: own.mk,v 1.27 2013/07/18 05:46:24 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@@ -90,6 +90,7 @@ OPTIONS_DEFAULT_NO+= DPADD_MK
# process options
OPTIONS_DEFAULT_NO+= \
INSTALL_AS_USER \
+ GPROF \
LIBTOOL \
LINT \
META_MODE \
diff --git a/contrib/bmake/mk/prog.mk b/contrib/bmake/mk/prog.mk
index 99fd7e8..3a7a07e 100644
--- a/contrib/bmake/mk/prog.mk
+++ b/contrib/bmake/mk/prog.mk
@@ -1,4 +1,4 @@
-# $Id: prog.mk,v 1.24 2012/12/13 23:04:14 sjg Exp $
+# $Id: prog.mk,v 1.25 2013/07/18 05:46:24 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@@ -50,6 +50,15 @@ LIBCRT0= ${DESTDIR}/usr/lib/crt0.o
.include <dpadd.mk>
.endif
+.if ${MK_GPROF} == "yes"
+CFLAGS+= ${CC_PG} ${PROFFLAGS}
+LDADD+= ${CC_PG}
+.if ${MK_DPADD_MK} == "no"
+LDADD_LIBC_P?= -lc_p
+LDADD_LAST+= ${LDADD_LIBC_P}
+.endif
+.endif
+
.if defined(SHAREDSTRINGS)
CLEANFILES+=strings
.c.o:
OpenPOWER on IntegriCloud