Page MenuHomeFreeBSD

Makefile: Fix several issues with bmake upgrade
ClosedPublic

Authored by jrtc27 on Tue, Jan 28, 7:01 PM.

Details

Summary

Firstly, if NEED_MAKE_UPGRADE isn't set, we shouldn't use whatever
bootstrapped bmake happens to be lying around. We're not going to re-run
the bmake target, so won't make sure it's up-to-date, and thus it could
be some ancient unsupported version. We can still, however, optimise
setting SUB_MAKE when the file exists, so long as it's guarded by
NEED_MAKE_UPGRADE.

Secondly, make kernel-toolchain should also bootstrap bmake if needed,
since it's supposed to be the subset of buildworld needed for building a
kernel.

Finally, if there is a stale bootstrapped bmake lying around that isn't
needed, delete it, since it will only cause confusion, and as far as I
can tell nothing else will clean it up, not even cleandir twice. So as
to ensure nobody's doing anything crazy with MYMAKE that would cause us
to delete something unexpected, or that would change behaviour by no
longer checking exists(${MYMAKE}) and using that regardless of version
checks, emit an error if the definition in use is not our own.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Tue, Jan 28, 7:33 PM

This looks good to me but lets give @sjg some time to weigh in

Only thing I'm at all nervous about is removing stale bmake.. but it's recoverable if in error, so I'm not that nervous.

sjg added inline comments.
Makefile
466

Do you want to add a check that MYMAKE is actually what you think it should be before doing rm -r on something important? eg && ${MYMAME:M${OBJROOT}make*} != ""

Makefile
466

It does feel a bit circular, no? At some point you have to trust that things have been set correctly, and yours still falls down if OBJROOT is somehow screwed up. If it would make you happier I could do:

MYMAKEDIR=${OBJROOT}make.${MACHINE}
MYMAKE=${MYMAKEDIR}/bmake

and use ${MYMAKEDIR} instead of ${MYMAKE:H} here and in the other uses below. But I'm not really sure what that actually buys us.

Makefile
466

I was thinking more of the case make whatever MYMAKE=/usr/bin/make removing /usr/bin might be unfortunate ;-) but they will only do that once.

Makefile
466

If that's your concern I could check empty(.MAKEOVERRIDES:MMYMAKE) and either skip this step or emit an error that you shouldn't do that? (Which do you think is best?)

Makefile
466

Doesn't catch src.conf though I guess. Do we really expect anyone to be doing this?

Makefile
466

How about .elif exists(${MYMAKE:H}) && ${MYMAKE} != /usr/bin/make then

Emit an error if MYMAKE is being messed with in any way

This revision now requires review to proceed.Wed, Jan 29, 6:37 PM
This revision is now accepted and ready to land.Wed, Jan 29, 7:04 PM