mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Stash work for adding runtime coverage support to bsd.lib.mk
The initial work uses static libraries instead of dynamic libraries, for parity with pico-style libraries. I suspect this approach is slightly flawed, but I wanted to stash the WiP, just in case.
This commit is contained in:
parent
bb1073be2b
commit
2a9e60bc7f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/runtime-coverage/; revision=320396
@ -76,9 +76,9 @@ CTFFLAGS+= -g
|
||||
|
||||
.include <bsd.libnames.mk>
|
||||
|
||||
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
|
||||
# prefer .s to a .c, add .covo and .po, remove stuff not used in the BSD libraries
|
||||
# .pico used for PIC object files
|
||||
.SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
|
||||
.SUFFIXES: .out .o .bc .covo .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
|
||||
|
||||
.if !defined(PICFLAG)
|
||||
.if ${MACHINE_CPUARCH} == "sparc64"
|
||||
@ -88,8 +88,14 @@ PICFLAG=-fpic
|
||||
.endif
|
||||
.endif
|
||||
|
||||
COV_FLAG=--coverage -g
|
||||
|
||||
PO_FLAG=-pg
|
||||
|
||||
.c.covo:
|
||||
${CC} ${COV_FLAG} ${STATIC_CFLAGS} ${COV_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
${CTFCONVERT_CMD}
|
||||
|
||||
.c.po:
|
||||
${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
${CTFCONVERT_CMD}
|
||||
@ -98,6 +104,9 @@ PO_FLAG=-pg
|
||||
${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
${CTFCONVERT_CMD}
|
||||
|
||||
.cc.covo .C.covo .cpp.covo .cxx.covo:
|
||||
${CXX} ${COV_FLAG} ${STATIC_CXXFLAGS} ${COV_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
|
||||
.cc.po .C.po .cpp.po .cxx.po:
|
||||
${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
|
||||
@ -112,10 +121,15 @@ PO_FLAG=-pg
|
||||
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
||||
${CTFCONVERT_CMD}
|
||||
|
||||
.s.po .s.pico:
|
||||
.s.covo .s.po .s.pico:
|
||||
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
|
||||
${CTFCONVERT_CMD}
|
||||
|
||||
.asm.covo:
|
||||
${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DCOV ${COV_CFLAGS} \
|
||||
${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
${CTFCONVERT_CMD}
|
||||
|
||||
.asm.po:
|
||||
${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DPROF ${PO_CFLAGS} \
|
||||
${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
@ -126,6 +140,11 @@ PO_FLAG=-pg
|
||||
${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
||||
${CTFCONVERT_CMD}
|
||||
|
||||
.S.covo:
|
||||
${CC:N${CCACHE_BIN}} -DCOV ${COV_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \
|
||||
-o ${.TARGET}
|
||||
${CTFCONVERT_CMD}
|
||||
|
||||
.S.po:
|
||||
${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \
|
||||
-o ${.TARGET}
|
||||
@ -185,6 +204,22 @@ lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS}
|
||||
|
||||
.if !defined(INTERNALLIB)
|
||||
|
||||
.if ${MK_COVERAGE} != "no" && defined(LIB) && !empty(LIB)
|
||||
_LIBS+= lib${LIB_PRIVATE}${LIB}_c.a
|
||||
COV_OBJS+= ${OBJS:.o=.covo} ${STATICOBJS:.o=.covo}
|
||||
DEPENDOBJS+= ${COV_OBJS}
|
||||
CLEANFILES+= ${COV_OBJS}
|
||||
# XXX (ngie): tighten this down
|
||||
CLEANFILES+= *.gcda *.gcno
|
||||
|
||||
lib${LIB_PRIVATE}${LIB}_c.a: ${COV_OBJS}
|
||||
@${ECHO} building coverage instrumented ${LIB} library
|
||||
@rm -f ${.TARGET}
|
||||
${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \
|
||||
${LORDER} ${COV_OBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD}
|
||||
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
|
||||
.endif
|
||||
|
||||
.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
|
||||
_LIBS+= lib${LIB_PRIVATE}${LIB}_p.a
|
||||
POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
|
||||
|
Loading…
Reference in New Issue
Block a user