Re: World broken in stage 1.1

From: Ruslan Ermilov <ru_at_freebsd.org>
Date: Wed, 11 Aug 2004 12:32:13 +0300
On Wed, Aug 11, 2004 at 11:12:53AM +0200, Thomas Nystrom wrote:
> Ruslan Ermilov wrote:
> > 
> > Trying to set MAKEOBJDIRPREFIX in /etc/make.conf and attempting to buildworld
> > RELENG_4 on a 4.x machine similarly fails right away.
> > 
> > The reason I'm writing this email is that I'm really interested in
> > reproducing the case where it could have possible worked before.  Any help
> > on your side would be highly appreciated.
> > 
> > The only case that I know of this could have worked (tested) is if make(1)
> > was instructed to prefer the MAKEOBJDIRPREFIX environment variable over a
> > global one, with ``make -E MAKEOBJDIRPREFIX''.  Then setting MAKEOBJDIRPREFIX
> > in /etc/make.conf works.
> 
> I have been using 'MAKEOBJDIRPREFIX?= /home/obj' (or similair) in
> /etc/make.conf for quite a long time now. NOTE: it must be '?='. I have
> used it on both 4.x and 5.x (latest 5.2.1-R).
> 
Yes, setting MAKEOBJDIRPREFIX?= in /etc/make.conf will work for
"make buildworld", BUT FOR BUILDWORLD ONLY, because Makefile.inc1
will reset MAKEOBJDIRPREFIX in environment (as expected by make(1))
for all buildworld substages, correcting the user's mistake.  In
other words, it happens to magically work for a buildworld (and
other world-related targets).

OTOH, a plain "make" somewhere with MAKEOBJDIRPREFIX set both in
environment (where make(1) expects to find it) and in /etc/make.conf
will break.  Compare:

Good:

# rm -rf /home/ru/obj
# pwd
/tmp/x
# env MAKEOBJDIRPREFIX=/home/ru/obj make -f bsd.prog.mk whereobj
/tmp/x
# env MAKEOBJDIRPREFIX=/home/ru/obj make -f bsd.prog.mk obj
/home/ru/obj/tmp/x created for /tmp/x
# env MAKEOBJDIRPREFIX=/home/ru/obj make -f bsd.prog.mk whereobj
/home/ru/obj/tmp/x

Bad:

# rm -rf /home/ru/obj
# grep MAKEOBJDIRPREFIX /etc/make.conf 
MAKEOBJDIRPREFIX?=      /home/ru/obj
# make -f bsd.prog.mk whereobj
/tmp/x
# make -f bsd.prog.mk obj
/home/ru/obj/tmp/x created for /tmp/x
# make -f bsd.prog.mk whereobj
/tmp/x

The "whereobj" target just prints the idea of the make(1)'s
object directory (where object files get created, also the
current working directory before make(1) starts to produce
something).

MAKEOBJDIRPREFIX in /etc/make.conf, in any form, is a strict
"no no"!  Fix it now, or you will get a ton of troubles some
day.


Cheers,
-- 
Ruslan Ermilov
ru_at_FreeBSD.org
FreeBSD committer

Received on Wed Aug 11 2004 - 07:33:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:05 UTC