From e14ccde629ef57d3eb9b2e301b0789029e6ba32d Mon Sep 17 00:00:00 2001 From: netchild Date: Fri, 2 Apr 2010 06:55:31 +0000 Subject: WITH_CTF can now be specified in src.conf (not recommended, there are some problems with static executables), make.conf (would also affect ports which do not use GNU make and do not override the compile targets) or in the kernel config (via "makeoptions WITH_CTF=yes"). Additional (related) changes: - propagate WITH_CTF to module builds - do not add -g to the linker flags, it's a noop there anyway (at least according to the man page of ld) - do not add -g to CFLAGS unconditionally we need to have a look if it is really needed (IMO not) or if there is a way to add it only when WITH_CTF is used Note: ctfconvert / ctfmerge lines will not appear in the build output, to protect the innocent (those which do not build with WITH_CTF would see the shell-test and may think WITH_CTF is used). Reviewed by: imp, jhb, scottl (earlier version) Discussed on: arch@ --- sys/conf/kern.mk | 8 ++++++++ sys/conf/kern.post.mk | 12 ++++++------ sys/conf/kern.pre.mk | 11 ++--------- sys/conf/kmod.mk | 5 +++++ 4 files changed, 21 insertions(+), 15 deletions(-) (limited to 'sys') diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 0f5cd66..7e23a80 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -108,3 +108,11 @@ CFLAGS+= -restrict ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "mips" CFLAGS+= -fstack-protector .endif + +# +# Enable CTF conversation on request. +# +.if defined(WITH_CTF) +.undef NO_CTF +.endif + diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index f808c95..c5c9c34 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -19,6 +19,10 @@ MKMODULESENV+= KERNBUILDDIR="${.CURDIR}" SYSDIR="${SYSDIR}" MKMODULESENV+= CONF_CFLAGS="${CONF_CFLAGS}" .endif +.if defined(WITH_CTF) +MKMODULESENV+= WITH_CTF="${WITH_CTF}" +.endif + .MAIN: all .for target in all clean cleandepend cleandir clobber depend install \ @@ -90,9 +94,7 @@ ${FULLKERNEL}: ${SYSTEM_DEP} vers.o @rm -f ${.TARGET} @echo linking ${.TARGET} ${SYSTEM_LD} -.if defined(CTFMERGE) - ${SYSTEM_CTFMERGE} -.endif + @${SYSTEM_CTFMERGE} .if !defined(DEBUG) ${OBJCOPY} --strip-debug ${.TARGET} .endif @@ -240,9 +242,7 @@ kernel-reinstall: config.o env.o hints.o vers.o vnode_if.o: ${NORMAL_C} -.if defined(CTFCONVERT) - ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.endif + @[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} config.ln env.ln hints.ln vers.ln vnode_if.ln: ${NORMAL_LINT} diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index ee74a9e..39a045a 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -128,11 +128,7 @@ NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \ ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c -.if defined(CTFCONVERT) -NORMAL_CTFCONVERT= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.else -NORMAL_CTFCONVERT= -.endif +NORMAL_CTFCONVERT= [ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} @@ -142,10 +138,7 @@ SYSTEM_DEP= Makefile ${SYSTEM_OBJS} SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS} SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o} SYSTEM_OBJS+= hack.So -.if defined(CTFMERGE) -SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJS} vers.o -LD+= -g -.endif +SYSTEM_CTFMERGE= [ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJS} vers.o SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} \ -warn-common -export-dynamic -dynamic-linker /red/herring \ -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 2cd7509..526eec7 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -69,6 +69,11 @@ OBJCOPY?= objcopy .error "Do not use KMODDEPS on 5.0+; use MODULE_VERSION/MODULE_DEPEND" .endif +# Enable CTF conversion on request. +.if defined(WITH_CTF) +.undef NO_CTF +.endif + .include .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S -- cgit v1.1