According to the comment in lib/libc/gmon/Makefile.inc, mcount needs
special treatment since it cannot be compiled with profiling or pie.
When depend was removed as an independent target, this special case was
missed. Align it with the inference rules in bsd.lib.mk. This also
makes 'make clean' work correctly (it currently leaves mcount.po.d
behind).
Index: lib/libc/gmon/Makefile.inc
===================================================================
RCS file: /var/cvs/src/lib/libc/gmon/Makefile.inc,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.inc
--- lib/libc/gmon/Makefile.inc 30 Mar 2016 06:38:41 -0000 1.6
+++ lib/libc/gmon/Makefile.inc 19 Dec 2019 10:04:01 -0000
@@ -9,6 +9,7 @@ MAN+= moncontrol.3
# mcount cannot be compiled with profiling or pie
mcount.po:
@echo "${COMPILE.c} ${NOPIE_FLAGS} ${.IMPSRC} -o ${.TARGET}"
- @${COMPILE.c} ${NOPIE_FLAGS} ${.IMPSRC} -o ${.TARGET}.o
+ @${COMPILE.c} ${DFLAGS} ${NOPIE_FLAGS} ${.IMPSRC} -o ${.TARGET}.o
+ @-mv [email protected] $*.d
@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o