Undesirable bmake behavior

Simon J. Gerraty sjg at juniper.net
Sun Jun 2 05:11:24 UTC 2013


>today I got confronted with this little curiosity from bmake. I have
>built and installed the world, and after reboot I ran 'make delete-old'
>as root to get rid of accumulated stale files. This is what I got back:
>
>>>> Removing old files (only deletes safe to delete libs)
>....
>>>> Old files removed
>>>> Removing old directories
>>>> Old directories removed
>To remove old libraries run '/usr/obj/usr/src/make.amd64/make
>delete-old-libs'.
>
>It turns out that somehow running make in src tree finds and tries to
>run a copy from .OBJDIR, if one is present, unconditionally now. I do

This simply what src/Makefile says to do, and AFAIK it has been that way
for ages.

Since delete-old is in TGTS it gets run via:

#
# Handle the user-driven targets, using the source relative mk files.
#

${TGTS}:
        ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}


and

$ make -dV -V _MAKE
PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
$ make -dV -V BINMAKE
`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo
${MAKE}; fi`  -m ${.CURDIR}/share/mk
$ make -V _MAKE
PATH=/sbin:/bin:/usr/sbin:/usr/bin `if [ -x
/var/obj/current/b/sjg/work/FreeBSD/current/src/make.amd64/make ]; then
echo /var/obj/current/b/sjg/work/FreeBSD/current/src/make.amd64/make;
else echo make; fi`  -m /b/sjg/work/FreeBSD/current/src/share/mk -f
Makefile.inc1 TARGET=amd64 TARGET_ARCH=amd64
$

Now you may be right that that's a bad idea, but it isn't anything new.

--sjg



More information about the freebsd-current mailing list