Part 3/3 of unbreaking cross releases:

When we call "distributeworld" as part of "make release", we set
MACHINE and MACHINE_ARCH to point to TARGET and TARGET_ARCH; this
confused src/Makefile's idea of what ${MAKEPATH}, and consequently
${MAKE}, is (well, it still confuses ${MAKEPATH}, but see below).

To overcome this problem, we now take the following approach:

- We preserve the make(1)'s idea of its argv[0], ${MAKE}.
- We check to see if ${MAKE} passes the regression tests.
- If it does, we use it.  Otherwise, we build and use an
  up-to-date make(1).

This fix is still not quite right, in a situation where a single
/usr/obj is shared between different architecture machines, but
it is less critical and I hope to fix that soon.
This commit is contained in:
Ruslan Ermilov 2003-01-29 10:00:42 +00:00
parent 55ee3f14e3
commit 76499f1539

View File

@ -102,17 +102,19 @@ BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
.ORDER: buildkernel installkernel
.ORDER: buildkernel reinstallkernel
PATH= /sbin:/bin:/usr/sbin:/usr/bin
MAKEOBJDIRPREFIX?= /usr/obj
MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE_ARCH}
PATH= ${MAKEPATH}:/sbin:/bin:/usr/sbin:/usr/bin
MAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
_MAKE= PATH=${PATH} \
`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
-m ${.CURDIR}/share/mk -f Makefile.inc1
#
# Handle the user-driven targets, using the source relative mk files.
#
${TGTS} ${BITGTS}: upgrade_checks
@cd ${.CURDIR}; \
${MAKE} ${.TARGET}
${_MAKE} ${.TARGET}
# Set a reasonable default
.MAIN: all
@ -133,16 +135,16 @@ world: upgrade_checks
@echo "--------------------------------------------------------------"
@echo ">>> Making 'pre-world' target"
@echo "--------------------------------------------------------------"
@cd ${.CURDIR}; ${MAKE} pre-world
@cd ${.CURDIR}; ${_MAKE} pre-world
.endif
@cd ${.CURDIR}; ${MAKE} buildworld
@cd ${.CURDIR}; ${MAKE} -B installworld
@cd ${.CURDIR}; ${_MAKE} buildworld
@cd ${.CURDIR}; ${_MAKE} -B installworld
.if target(post-world)
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Making 'post-world' target"
@echo "--------------------------------------------------------------"
@cd ${.CURDIR}; ${MAKE} post-world
@cd ${.CURDIR}; ${_MAKE} post-world
.endif
@echo
@echo "--------------------------------------------------------------"
@ -161,9 +163,11 @@ kernel: buildkernel installkernel
# for building the world.
#
upgrade_checks:
@(cd ${.CURDIR}/tools/regression/usr.bin/make && \
PATH=${PATH} make 2>/dev/null) || \
(cd ${.CURDIR} && make make)
@if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \
PATH=${PATH} ${MAKE} 2>/dev/null); \
then \
(cd ${.CURDIR} && make make); \
fi
#
# Upgrade make(1) to the current version using the installed
@ -203,7 +207,7 @@ upgrade: aout-to-elf
${UPGRADE} : upgrade_checks
@cd ${.CURDIR}; \
${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
${_MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
universe: