Skip to content
Browse files

bsd.lib.mk: Prevent "profiling impossible" warning

The flag combination of "-pg" and "-ffunction-sections" do not mix.
GCC will emit the warning: "-ffunction-sections disabled; it makes
profiling impossible"

This simple modification to bsd.lib.mk will filter out
-ffunction-sections flag whenever it tries to build profile
objects.  The seemingly hundreds of warning in the world build
log are now gone.
  • Loading branch information...
1 parent ee1e51e commit 2ec8bbd1f0e7c4305e1d93e07156c26a7bf20989 @jrmarino jrmarino committed Sep 29, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 share/mk/bsd.lib.mk
View
10 share/mk/bsd.lib.mk
@@ -47,12 +47,14 @@ PICFLAG=-fpic
.endif
PO_FLAG=-pg
+PO_CFLAGS=${CFLAGS:N-ffunction-sections}
+PO_CXXFLAGS=${CXXFLAGS:N-ffunction-sections}
.c.o:
${CC} ${_${.IMPSRC:T}_FLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.c.po:
- ${CC} ${_${.IMPSRC:T}_FLAGS} ${PO_FLAG} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+ ${CC} ${_${.IMPSRC:T}_FLAGS} ${PO_FLAG} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.c.So:
${CC} ${_${.IMPSRC:T}_FLAGS} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@@ -61,7 +63,7 @@ PO_FLAG=-pg
${CXX} ${_${.IMPSRC:T}_FLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.cc.po .C.po .cpp.po .cxx.po:
- ${CXX} ${_${.IMPSRC:T}_FLAGS} ${PO_FLAG} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
+ ${CXX} ${_${.IMPSRC:T}_FLAGS} ${PO_FLAG} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.cc.So .C.So .cpp.So .cxx.So:
${CXX} ${_${.IMPSRC:T}_FLAGS} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
@@ -70,7 +72,7 @@ PO_FLAG=-pg
${FC} ${_${.IMPSRC:T}_FLAGS} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
.f.po:
- ${FC} ${_${.IMPSRC:T}_FLAGS} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
+ ${FC} ${_${.IMPSRC:T}_FLAGS} ${PO_FLAG} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
.f.So:
${FC} ${_${.IMPSRC:T}_FLAGS} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
@@ -79,7 +81,7 @@ PO_FLAG=-pg
${OBJC} ${_${.IMPSRC:T}_FLAGS} ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
.m.po:
- ${OBJC} ${_${.IMPSRC:T}_FLAGS} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET}
+ ${OBJC} ${_${.IMPSRC:T}_FLAGS} ${OBJCFLAGS} ${PO_FLAG} -c ${.IMPSRC} -o ${.TARGET}
.m.So:
${OBJC} ${_${.IMPSRC:T}_FLAGS} ${PICFLAG} -DPIC ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}

0 comments on commit 2ec8bbd

Please sign in to comment.
Something went wrong with that request. Please try again.