Conditionalize ctfconvert/ctfmerge runs on make level (.if/.endif) instead

of executing a shell on every object or executable/library file.

This shaves off more than 30,000 shell invocations during buildworld.
This commit is contained in:
fjoe 2011-11-29 08:38:47 +00:00
parent 58cb09352f
commit 009670e1b3
6 changed files with 107 additions and 99 deletions

View File

@ -75,15 +75,15 @@ PO_FLAG=-pg
.c.po:
${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.c.So:
${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.cc.o:
${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@ -96,47 +96,47 @@ PO_FLAG=-pg
.f.po:
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.f.So:
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.s.po .s.So:
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.asm.po:
${CC} -x assembler-with-cpp -DPROF ${PO_CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.asm.So:
${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \
-c ${.IMPSRC} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.S.po:
${CC} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.S.So:
${CC} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
all: objwarn
@ -211,9 +211,9 @@ ${SHLIB_NAME}: ${SOBJS}
-o ${.TARGET} -Wl,-soname,${SONAME} \
`NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
.endif
@[ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} && \
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS})
.if !defined(NO_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
.endif
.endif
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"

View File

@ -60,9 +60,9 @@ ${PROG}: ${OBJS}
.else
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.endif
@[ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} && \
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS})
.if !defined(NO_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
.endif
.else # !defined(SRCS)
@ -90,9 +90,9 @@ ${PROG}: ${OBJS}
.else
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
.endif
@[ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} && \
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS})
.if !defined(NO_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
.endif
.endif
.endif

View File

@ -158,15 +158,15 @@ YFLAGS ?= -d
# SINGLE SUFFIX RULES
.c:
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.f:
${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.sh:
cp -f ${.IMPSRC} ${.TARGET}
@ -176,33 +176,33 @@ YFLAGS ?= -d
.c.o:
${CC} ${CFLAGS} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.f.o:
${FC} ${FFLAGS} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.y.o:
${YACC} ${YFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} -c y.tab.c
rm -f y.tab.c
mv y.tab.o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.l.o:
${LEX} ${LFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} -c lex.yy.c
rm -f lex.yy.c
mv lex.yy.o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.y.c:
${YACC} ${YFLAGS} ${.IMPSRC}
@ -240,15 +240,15 @@ YFLAGS ?= -d
.c:
${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.c.o:
${CC} ${CFLAGS} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.cc .cpp .cxx .C:
${CXX} ${CXXFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
@ -258,15 +258,15 @@ YFLAGS ?= -d
.m.o:
${OBJC} ${OBJCFLAGS} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.p.o:
${PC} ${PFLAGS} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.e .r .F .f:
${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} \
@ -277,38 +277,38 @@ YFLAGS ?= -d
.S.o:
${CC} ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.asm.o:
${CC} -x assembler-with-cpp ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.s.o:
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
# XXX not -j safe
.y.o:
${YACC} ${YFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
rm -f y.tab.c
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.l.o:
${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET}
rm -f ${.PREFIX}.tmp.c
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
# XXX not -j safe
.y.c:
@ -320,34 +320,34 @@ YFLAGS ?= -d
.s.out .c.out .o.out:
${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.f.out .F.out .r.out .e.out:
${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \
${LDLIBS} -o ${.TARGET}
rm -f ${.PREFIX}.o
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
# XXX not -j safe
.y.out:
${YACC} ${YFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
rm -f y.tab.c
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
.l.out:
${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
rm -f ${.PREFIX}.tmp.c
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
(${ECHO} ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET})
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
# FreeBSD build pollution. Hide it in the non-POSIX part of the ifdef.
__MAKE_CONF?=/etc/make.conf

View File

@ -94,7 +94,9 @@ ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
@rm -f ${.TARGET}
@echo linking ${.TARGET}
${SYSTEM_LD}
@${SYSTEM_CTFMERGE}
.if !defined(NO_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJS} vers.o
.endif
.if !defined(DEBUG)
${OBJCOPY} --strip-debug ${.TARGET}
.endif
@ -247,7 +249,9 @@ kernel-reinstall:
config.o env.o hints.o vers.o vnode_if.o:
${NORMAL_C}
@[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.if !defined(NO_CTF)
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.endif
config.ln env.ln hints.ln vers.ln vnode_if.ln:
${NORMAL_LINT}

View File

@ -123,8 +123,11 @@ 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
NORMAL_CTFCONVERT= [ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.if !defined(NO_CTF)
NORMAL_CTFCONVERT= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
.else
NORMAL_CTFCONVERT= :
.endif
NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
@ -142,7 +145,6 @@ SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
SYSTEM_OBJS+= hack.So
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

View File

@ -206,7 +206,9 @@ ${KMOD}.kld: ${OBJS}
${FULLPROG}: ${OBJS}
.endif
${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
@[ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
.if !defined(NO_CTF)
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
.endif
.if defined(EXPORT_SYMS)
.if ${EXPORT_SYMS} != YES
.if ${EXPORT_SYMS} == NO