summaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.lib.mk
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2008-05-22 01:14:43 +0000
committerjb <jb@FreeBSD.org>2008-05-22 01:14:43 +0000
commite7efc3c9a875554aeacd100eae3306050953dc7f (patch)
tree76a60c04b54ee709c597673e197c327f112e6cfe /share/mk/bsd.lib.mk
parent01b0c45f12c09e73a4706595556e44c81b3e938f (diff)
downloadFreeBSD-src-e7efc3c9a875554aeacd100eae3306050953dc7f.zip
FreeBSD-src-e7efc3c9a875554aeacd100eae3306050953dc7f.tar.gz
Add support for the Compact C Type (CTF) conversions throughout FreeBSD's
system makefiles. Note that the CTF conversion defaults to off. We may choose to change this default later if DTrace proves popular and people are prepared to wear the compilation performance impact of compiling with debug symbols all the time. Setting NO_CTF in the make args or user environment turns off CTF conversion. Even if we choose to default CTF generation to on later, we still need NO_CTF so that the buildworld process can bootstrap the tools without needlessly generating CTF data for temporary tools. Setting WITH_CTF in the make args or user environment (and _NOT_ in /etc/make.conf) is the only way to enable CTF data conversion. Nore that this can't be implemented the same way that the WITH_ and WITHOUT_ stuff is implemented throughout the buildworld because the CTF conversion needs to work when building a simple object without a Makefile, using the default rules in sys.mk. Typing 'make test.o' with no makefile and just a source file test.c should work. Also, typing 'make WITH_CTF=1 test.o without a makefile and just a source file test.c should work and produce an object with a CTF elf section. Typing 'make WITH_CTF=1 CFLAGS=-g test.o' without a makefile and just a source file test.c should produce an object with both a CTF elf section and the debug elf sections. In the FreeBSD build where more .mk files are used than just sys.mk which is included my make by default, the use of DEBUG_FLAGS is the correct way to enable a debug build. The important thing to note here is that it is the DEBUG_FLAGS setting that prevents libraries and programs from being stripped on installation. So, for the addition of CTF data conversion, setting DEBUG_FLAGS to contain -g, without NO_CTF, will cause the ctfconvert and ctfmerge build programs to be executed also with the -g arg so that debug symbols are retained rather than being removed after the CTF data elf section has been added. Add DTrace libraries to the list of libnames.
Diffstat (limited to 'share/mk/bsd.lib.mk')
-rw-r--r--share/mk/bsd.lib.mk40
1 files changed, 40 insertions, 0 deletions
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 41cd556..741c9cb 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -35,6 +35,10 @@ NO_WERROR=
.if defined(DEBUG_FLAGS)
CFLAGS+= ${DEBUG_FLAGS}
+
+.if !defined(NO_CTF) && (${DEBUG_FLAGS:M-g} != "")
+CTFFLAGS+= -g
+.endif
.endif
.if !defined(DEBUG_FLAGS)
@@ -64,9 +68,15 @@ PO_FLAG=-pg
.c.po:
${CC} ${PO_FLAG} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.c.So:
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.cc.po .C.po .cpp.po .cxx.po:
${CXX} ${PO_FLAG} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@@ -76,31 +86,58 @@ PO_FLAG=-pg
.f.po:
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.f.So:
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.m.po:
${OBJC} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.m.So:
${OBJC} ${PICFLAG} -DPIC ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.s.po .s.So:
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.asm.po:
${CC} -x assembler-with-cpp -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.asm.So:
${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.S.po:
${CC} -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
.S.So:
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+.if defined(CTFCONVERT)
+ ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+.endif
all: objwarn
@@ -171,6 +208,9 @@ ${SHLIB_NAME}: ${SOBJS}
-o ${.TARGET} -Wl,-soname,${SONAME} \
`NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
.endif
+.if defined(CTFMERGE)
+ ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
+.endif
.endif
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
OpenPOWER on IntegriCloud