From 76499f1539799ff3150668ad4abcd7951ba58053 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Wed, 29 Jan 2003 10:00:42 +0000 Subject: 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. --- Makefile | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6b4e50a0c01b..ae2b32e350dd 100644 --- a/Makefile +++ b/Makefile @@ -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: -- cgit v1.2.3