Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/mk DTrace: Add CTF generation to the make framework. ...
details: https://anonhg.NetBSD.org/src/rev/f5a6fb04ed7e
branches: trunk
changeset: 752643:f5a6fb04ed7e
user: darran <darran%NetBSD.org@localhost>
date: Tue Mar 02 20:49:18 2010 +0000
description:
DTrace: Add CTF generation to the make framework. Only enabled when
MKDTRACE=yes.
diffstat:
share/mk/bsd.lib.mk | 38 +++++++++++++++++++++++++++++++++++++-
share/mk/bsd.own.mk | 6 +++++-
share/mk/bsd.prog.mk | 11 ++++++++++-
share/mk/bsd.sys.mk | 14 +++++++++++++-
share/mk/sys.mk | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
5 files changed, 112 insertions(+), 5 deletions(-)
diffs (truncated from 323 to 300 lines):
diff -r 97bd96406214 -r f5a6fb04ed7e share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk Tue Mar 02 20:47:01 2010 +0000
+++ b/share/mk/bsd.lib.mk Tue Mar 02 20:49:18 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.lib.mk,v 1.304 2010/02/22 12:33:22 njoly Exp $
+# $NetBSD: bsd.lib.mk,v 1.305 2010/03/02 20:49:18 darran Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.include <bsd.init.mk>
@@ -216,9 +216,18 @@
AFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
+.if defined(CTFCONVERT)
+.if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
+CTFFLAGS+= -g
+.endif
+.endif
+
.c.o:
${_MKTARGET_COMPILE}
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
${OBJCOPY} -x ${.TARGET}
.endif
@@ -226,6 +235,9 @@
.c.po:
${_MKTARGET_COMPILE}
${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
${OBJCOPY} -X ${.TARGET}
.endif
@@ -269,6 +281,9 @@
.f.o:
${_MKTARGET_COMPILE}
${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.if !defined(FOPTS) || empty(FOPTS:M*-g*)
${OBJCOPY} -x ${.TARGET}
.endif
@@ -276,6 +291,9 @@
.f.po:
${_MKTARGET_COMPILE}
${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.if !defined(FOPTS) || empty(FOPTS:M*-g*)
${OBJCOPY} -X ${.TARGET}
.endif
@@ -298,6 +316,9 @@
.m.o:
${_MKTARGET_COMPILE}
${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
${OBJCOPY} -x ${.TARGET}
.endif
@@ -305,6 +326,9 @@
.m.po:
${_MKTARGET_COMPILE}
${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
${OBJCOPY} -X ${.TARGET}
.endif
@@ -326,21 +350,33 @@
.s.o:
${_MKTARGET_COMPILE}
${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
${OBJCOPY} -x ${.TARGET}
.S.o:
${_MKTARGET_COMPILE}
${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
${OBJCOPY} -x ${.TARGET}
.s.po:
${_MKTARGET_COMPILE}
${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
${OBJCOPY} -X ${.TARGET}
.S.po:
${_MKTARGET_COMPILE}
${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
${OBJCOPY} -X ${.TARGET}
.s.go:
diff -r 97bd96406214 -r f5a6fb04ed7e share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk Tue Mar 02 20:47:01 2010 +0000
+++ b/share/mk/bsd.own.mk Tue Mar 02 20:49:18 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.own.mk,v 1.619 2010/02/27 22:42:54 haad Exp $
+# $NetBSD: bsd.own.mk,v 1.620 2010/03/02 20:49:18 darran Exp $
# This needs to be before bsd.init.mk
.if defined(BSD_MK_COMPAT_FILE)
@@ -236,6 +236,8 @@
TOOL_CONFIG= ${TOOLDIR}/bin/${_TOOL_PREFIX}config
TOOL_CRUNCHGEN= MAKE=${.MAKE:Q} ${TOOLDIR}/bin/${_TOOL_PREFIX}crunchgen
TOOL_CTAGS= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctags
+TOOL_CTFCONVERT= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctfconvert
+TOOL_CTFMERGE= ${TOOLDIR}/bin/${_TOOL_PREFIX}ctfmerge
TOOL_DB= ${TOOLDIR}/bin/${_TOOL_PREFIX}db
TOOL_DISKLABEL= ${TOOLDIR}/bin/nbdisklabel-${MAKEWRAPPERMACHINE}
TOOL_EQN= ${TOOLDIR}/bin/${_TOOL_PREFIX}eqn
@@ -311,6 +313,8 @@
TOOL_CONFIG= config
TOOL_CRUNCHGEN= crunchgen
TOOL_CTAGS= ctags
+TOOL_CTFCONVERT= ctfconvert
+TOOL_CTFMERGE= ctfmerge
TOOL_DB= db
TOOL_DISKLABEL= disklabel
TOOL_EQN= eqn
diff -r 97bd96406214 -r f5a6fb04ed7e share/mk/bsd.prog.mk
--- a/share/mk/bsd.prog.mk Tue Mar 02 20:47:01 2010 +0000
+++ b/share/mk/bsd.prog.mk Tue Mar 02 20:49:18 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prog.mk,v 1.246 2009/12/14 08:51:16 mrg Exp $
+# $NetBSD: bsd.prog.mk,v 1.247 2010/03/02 20:49:18 darran Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.ifndef HOSTPROG
@@ -63,6 +63,12 @@
OBJCFLAGS+= ${OBJCOPTS}
MKDEP_SUFFIXES?= .o .ln
+# CTF preserve debug symbols
+.if defined(MKDTRACE) && (${MKDTRACE} != "no") && (${CFLAGS:M-g} != "")
+CTFFLAGS+= -g
+CTFMFLAGS+= -g
+.endif
+
# ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
.if ${OBJECT_FMT} == "ELF"
.ifndef LIBCRTBEGIN
@@ -299,6 +305,9 @@
${OBJS.${_P}} ${_LDADD.${_P}} \
${DESTDIR:D-L${_GCC_LIBGCCDIR}} \
${_PROGLDOPTS}
+.if defined(CTFMERGE)
+ ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}}
+.endif
.if defined(PAXCTL_FLAGS.${_P})
${PAXCTL} ${PAXCTL_FLAGS.${_P}} ${.TARGET}
.endif
diff -r 97bd96406214 -r f5a6fb04ed7e share/mk/bsd.sys.mk
--- a/share/mk/bsd.sys.mk Tue Mar 02 20:47:01 2010 +0000
+++ b/share/mk/bsd.sys.mk Tue Mar 02 20:49:18 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.sys.mk,v 1.189 2009/12/15 04:03:55 mrg Exp $
+# $NetBSD: bsd.sys.mk,v 1.190 2010/03/02 20:49:18 darran Exp $
#
# Build definitions used for NetBSD source tree builds.
@@ -154,6 +154,9 @@
.c.o:
${_MKTARGET_COMPILE}
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.c.ln:
${_MKTARGET_COMPILE}
@@ -173,6 +176,9 @@
.m.o:
${_MKTARGET_COMPILE}
${COMPILE.m} ${OBJCOPTS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
# Host-compiled C objects
# The intermediate step is necessary for Sun CC, which objects to calling
@@ -192,10 +198,16 @@
.s.o:
${_MKTARGET_COMPILE}
${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.S.o:
${_MKTARGET_COMPILE}
${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
# Lex
LFLAGS+= ${LPREFIX.${.IMPSRC:T}:D-P${LPREFIX.${.IMPSRC:T}}}
diff -r 97bd96406214 -r f5a6fb04ed7e share/mk/sys.mk
--- a/share/mk/sys.mk Tue Mar 02 20:47:01 2010 +0000
+++ b/share/mk/sys.mk Tue Mar 02 20:49:18 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: sys.mk,v 1.99 2008/09/07 15:54:52 kent Exp $
+# $NetBSD: sys.mk,v 1.100 2010/03/02 20:49:18 darran Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run NetBSD.
@@ -48,6 +48,22 @@
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
+# C Type Format data is required for DTrace
+# XXX TBD VERSION is not defined
+CTFFLAGS ?= -L VERSION
+CTFMFLAGS ?= -t -L VERSION
+
+.if defined(MKDTRACE) && ${MKDTRACE} != "no"
+CTFCONVERT ?= ${TOOL_CTFCONVERT}
+CTFMERGE ?= ${TOOL_CTFMERGE}
+.if defined(CFLAGS) && (${CFLAGS:M-g} != "")
+CTFFLAGS += -g
+CTFMFLAGS += -g
+.else
+CFLAGS += -g
+.endif
+.endif
+
CXX?= c++
CXXFLAGS?= ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu99}
@@ -113,8 +129,14 @@
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.c.o:
${COMPILE.c} ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
@@ -146,8 +168,14 @@
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.F.o:
${COMPILE.F} ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
@@ -165,8 +193,14 @@
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.p.o:
${COMPILE.p} ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o
@@ -175,16 +209,28 @@
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
Home |
Main Index |
Thread Index |
Old Index