- fix WITH_CTF when specified in /etc/src.conf [1]

- CTFCONVERT_CMD=... is a hack (should be defined to empty string instead):
make(1) should be taught to ignore empty commands silently in compat mode
(as it does in !compat mode, GNU make also silently ignores empty commands)
and to skip printing empty commands in !compat mode
- config(8) should generate ${NORMAL_CTFCONVERT} invocation without '@':
this will allow to simplify kern.pre.mk even more and lessen the number
of shell invocations during kernel build when CTF is turned off
- WITH_CTF can now be converted to usual MK_CTF=yes/no infrastructure

Pointy hat to:	fjoe [1]
This commit is contained in:
Max Khon 2011-11-29 16:34:44 +00:00
parent cf1911a9ad
commit 78e7e3ecb5
8 changed files with 45 additions and 126 deletions

View File

@ -33,15 +33,10 @@ CFLAGS+= -DNDEBUG
NO_WERROR=
.endif
# Enable CTF conversion on request.
.if defined(WITH_CTF)
.undef NO_CTF
.endif
.if defined(DEBUG_FLAGS)
CFLAGS+= ${DEBUG_FLAGS}
.if !defined(NO_CTF) && (${DEBUG_FLAGS:M-g} != "")
.if defined(WITH_CTF) && (${DEBUG_FLAGS:M-g} != "")
CTFFLAGS+= -g
.endif
.endif
@ -69,21 +64,15 @@ PO_FLAG=-pg
.c.o:
${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
${CTFCONVERT_CMD}
.c.po:
${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.c.So:
${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.cc.o:
${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@ -96,47 +85,33 @@ PO_FLAG=-pg
.f.po:
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.f.So:
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.s.po .s.So:
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.asm.po:
${CC} -x assembler-with-cpp -DPROF ${PO_CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.asm.So:
${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.S.po:
${CC} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.S.So:
${CC} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
all: objwarn
@ -211,7 +186,7 @@ ${SHLIB_NAME}: ${SOBJS}
-o ${.TARGET} -Wl,-soname,${SONAME} \
`NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
.endif
.if !defined(NO_CTF)
.if defined(WITH_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
.endif
.endif

View File

@ -189,6 +189,12 @@ STRIP?= -s
COMPRESS_CMD?= gzip -cn
COMPRESS_EXT?= .gz
.if defined(WITH_CTF)
CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.else
CTFCONVERT_CMD= ...
.endif
.if !defined(_WITHOUT_SRCCONF)
#
# Define MK_* variables (which are either "yes" or "no") for users

View File

@ -15,16 +15,11 @@ CFLAGS+= -DNDEBUG
NO_WERROR=
.endif
# Enable CTF conversion on request.
.if defined(WITH_CTF)
.undef NO_CTF
.endif
.if defined(DEBUG_FLAGS)
CFLAGS+=${DEBUG_FLAGS}
CXXFLAGS+=${DEBUG_FLAGS}
.if !defined(NO_CTF) && (${DEBUG_FLAGS:M-g} != "")
.if defined(WITH_CTF) && (${DEBUG_FLAGS:M-g} != "")
CTFFLAGS+= -g
.endif
.endif
@ -60,7 +55,7 @@ ${PROG}: ${OBJS}
.else
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.endif
.if !defined(NO_CTF)
.if defined(WITH_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
.endif
@ -90,7 +85,7 @@ ${PROG}: ${OBJS}
.else
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.endif
.if !defined(NO_CTF)
.if defined(WITH_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
.endif
.endif

View File

@ -59,12 +59,6 @@ CFLAGS += -fno-strict-aliasing
.endif
PO_CFLAGS ?= ${CFLAGS}
# Turn CTF conversion off by default for now. This default could be
# changed later if DTrace becomes popular.
.if !defined(WITH_CTF)
NO_CTF = 1
.endif
# C Type Format data is required for DTrace
CTFFLAGS ?= -L VERSION
@ -158,15 +152,11 @@ YFLAGS ?= -d
# SINGLE SUFFIX RULES
.c:
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.f:
${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.sh:
cp -f ${.IMPSRC} ${.TARGET}
@ -176,33 +166,25 @@ YFLAGS ?= -d
.c.o:
${CC} ${CFLAGS} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.f.o:
${FC} ${FFLAGS} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.y.o:
${YACC} ${YFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} -c y.tab.c
rm -f y.tab.c
mv y.tab.o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.l.o:
${LEX} ${LFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} -c lex.yy.c
rm -f lex.yy.c
mv lex.yy.o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.y.c:
${YACC} ${YFLAGS} ${.IMPSRC}
@ -240,15 +222,11 @@ YFLAGS ?= -d
.c:
${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.c.o:
${CC} ${CFLAGS} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.cc .cpp .cxx .C:
${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
@ -258,15 +236,11 @@ YFLAGS ?= -d
.m.o:
${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.p.o:
${PC} ${PFLAGS} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.e .r .F .f:
${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
@ -277,38 +251,28 @@ YFLAGS ?= -d
.S.o:
${CC} ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.asm.o:
${CC} -x assembler-with-cpp ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.s.o:
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
# XXX not -j safe
.y.o:
${YACC} ${YFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
rm -f y.tab.c
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.l.o:
${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
rm -f ${.PREFIX}.tmp.c
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
# XXX not -j safe
.y.c:
@ -320,34 +284,26 @@ YFLAGS ?= -d
.s.out .c.out .o.out:
${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.f.out .F.out .r.out .e.out:
${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
${LDLIBS} -o ${.TARGET}
rm -f ${.PREFIX}.o
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
# XXX not -j safe
.y.out:
${YACC} ${YFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
rm -f y.tab.c
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
.l.out:
${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
rm -f ${.PREFIX}.tmp.c
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
${CTFCONVERT_CMD}
# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef.
__MAKE_CONF?=/etc/make.conf

View File

@ -126,10 +126,3 @@ CFLAGS+= -ffreestanding
${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
CFLAGS+= -fstack-protector
.endif
#
# Enable CTF conversion on request
#
.if defined(WITH_CTF)
.undef NO_CTF
.endif

View File

@ -94,7 +94,7 @@ ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
@rm -f ${.TARGET}
@echo linking ${.TARGET}
${SYSTEM_LD}
.if !defined(NO_CTF)
.if defined(WITH_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJS} vers.o
.endif
.if !defined(DEBUG)
@ -249,9 +249,7 @@ kernel-reinstall:
config.o env.o hints.o vers.o vnode_if.o:
${NORMAL_C}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
@${NORMAL_CTFCONVERT}
config.ln env.ln hints.ln vers.ln vnode_if.ln:
${NORMAL_LINT}

View File

@ -123,8 +123,9 @@ 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(NO_CTF)
NORMAL_CTFCONVERT= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.if defined(WITH_CTF)
CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
NORMAL_CTFCONVERT= ${ECHO} ${CTFCONVERT_CMD} && ${CTFCONVERT_CMD}
.else
NORMAL_CTFCONVERT= :
.endif

View File

@ -72,11 +72,6 @@ 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 <bsd.init.mk>
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S