summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2003-01-29 10:00:42 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2003-01-29 10:00:42 +0000
commit76499f1539799ff3150668ad4abcd7951ba58053 (patch)
tree08d078621388096332bfb0efeb725c27e856290c /Makefile
parent55ee3f14e30d85f26de2099c96f98c3d704dcd7f (diff)
downloadsrc-test2-76499f1539799ff3150668ad4abcd7951ba58053.tar.gz
src-test2-76499f1539799ff3150668ad4abcd7951ba58053.zip
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.
Notes
Notes: svn path=/head/; revision=110035
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 16 insertions, 12 deletions
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: