Fix bug in universe where if upgrade_checks wants a new make,

it gets built 16 times in parallel in the same location.
While we are at it, until we finish getting rid of fmake,
be explicit about the make we want to use, thus avoid the problem
of the temp make being the wrong version.

Reviewed by:	obrien
This commit is contained in:
Simon J. Gerraty
2013-07-24 17:55:08 +00:00
parent 8ff6ca1e08
commit 4234b97720
+43 -18
View File
@@ -130,11 +130,34 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ .error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
(in make.conf(5)) or command-line variable. (in make.conf(5)) or command-line variable.
.endif .endif
MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
BINMAKE= \ # We often need to use the tree's version of make to build it.
`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ # Choices add to complexity though.
# We cannot blindly use a make which may not be the one we want
# so be exlicit - until all choice is removed.
.if !defined(WITHOUT_BMAKE)
WANT_MAKE= bmake
.else
WANT_MAKE= fmake
.endif
MYMAKE= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
.if defined(.PARSEDIR)
HAVE_MAKE= bmake
.else
HAVE_MAKE= fmake
.endif
.if exists(${MYMAKE})
SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
.elif ${WANT_MAKE} != ${HAVE_MAKE} || ${WANT_MAKE} != "bmake"
# It may not exist yet but we may cause it to.
# In the case of fmake, upgrade_checks may cause a newer version to be built.
SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
-m ${.CURDIR}/share/mk -m ${.CURDIR}/share/mk
_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} .else
SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
.endif
_MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
# Guess machine architecture from machine type, and vice versa. # Guess machine architecture from machine type, and vice versa.
.if !defined(TARGET_ARCH) && defined(TARGET) .if !defined(TARGET_ARCH) && defined(TARGET)
@@ -291,11 +314,13 @@ kernel: buildkernel installkernel
# Perform a few tests to determine if the installed tools are adequate # Perform a few tests to determine if the installed tools are adequate
# for building the world. # for building the world.
# #
# Note: if we ever need to care about the version of bmake, simply testing
# MAKE_VERSION against a required version should suffice.
#
upgrade_checks: upgrade_checks:
.if !defined(.PARSEDIR) .if ${HAVE_MAKE} != ${WANT_MAKE}
.if !defined(WITHOUT_BMAKE) @(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
(cd ${.CURDIR} && ${MAKE} bmake) .elif ${WANT_MAKE} == "fmake"
.else
@if ! (cd ${.CURDIR}/tools/build/make_check && \ @if ! (cd ${.CURDIR}/tools/build/make_check && \
PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \ PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
@@ -303,14 +328,13 @@ upgrade_checks:
(cd ${.CURDIR} && ${MAKE} make); \ (cd ${.CURDIR} && ${MAKE} make); \
fi fi
.endif .endif
.endif
# #
# Upgrade make(1) to the current version using the installed # Upgrade make(1) to the current version using the installed
# headers, libraries and tools. Also, allow the location of # headers, libraries and tools. Also, allow the location of
# the system bsdmake-like utility to be overridden. # the system bsdmake-like utility to be overridden.
# #
MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ MMAKEENV= MAKEOBJDIRPREFIX=${MYMAKE:H} \
DESTDIR= \ DESTDIR= \
INSTALL="sh ${.CURDIR}/tools/install.sh" INSTALL="sh ${.CURDIR}/tools/install.sh"
MMAKE= ${MMAKEENV} ${MAKE} \ MMAKE= ${MMAKEENV} ${MAKE} \
@@ -327,7 +351,7 @@ make bmake: .PHONY
${MMAKE} obj && \ ${MMAKE} obj && \
${MMAKE} depend && \ ${MMAKE} depend && \
${MMAKE} all && \ ${MMAKE} all && \
${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= PROGNAME=${MYMAKE:T}
tinderbox: tinderbox:
@cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
@@ -377,7 +401,8 @@ MAKEFAIL=tee -a ${FAILFILE}
MAKEFAIL=cat MAKEFAIL=cat
.endif .endif
universe: universe_prologue upgrade_checks universe_prologue: upgrade_checks
universe: universe_prologue
universe_prologue: universe_prologue:
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> make universe started on ${STARTTIME}" @echo ">>> make universe started on ${STARTTIME}"
@@ -387,9 +412,9 @@ universe_prologue:
.endif .endif
.for target in ${TARGETS} .for target in ${TARGETS}
universe: universe_${target} universe: universe_${target}
.ORDER: universe_prologue upgrade_checks universe_${target} universe_epilogue universe_epilogue: universe_${target}
universe_${target}: universe_${target}_prologue universe_${target}: universe_${target}_prologue
universe_${target}_prologue: universe_${target}_prologue: universe_prologue
@echo ">> ${target} started on `LC_ALL=C date`" @echo ">> ${target} started on `LC_ALL=C date`"
.if !defined(MAKE_JUST_KERNELS) .if !defined(MAKE_JUST_KERNELS)
.for target_arch in ${TARGET_ARCHES_${target}} .for target_arch in ${TARGET_ARCHES_${target}}
@@ -397,7 +422,7 @@ universe_${target}: universe_${target}_${target_arch}
universe_${target}_${target_arch}: universe_${target}_prologue universe_${target}_${target_arch}: universe_${target}_prologue
@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`" @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \ ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
TARGET=${target} \ TARGET=${target} \
TARGET_ARCH=${target_arch} \ TARGET_ARCH=${target_arch} \
> _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \ > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
@@ -418,11 +443,11 @@ universe_${target}: universe_${target}_kernels
universe_${target}_kernels: universe_${target}_prologue universe_${target}_kernels: universe_${target}_prologue
.if exists(${KERNSRCDIR}/${target}/conf/NOTES) .if exists(${KERNSRCDIR}/${target}/conf/NOTES)
@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \ @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ ${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
(echo "${target} 'make LINT' failed," \ (echo "${target} 'make LINT' failed," \
"check _.${target}.makeLINT for details"| ${MAKEFAIL})) "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
.endif .endif
@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \ @cd ${.CURDIR} && ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
universe_kernels universe_kernels
.endif .endif
@echo ">> ${target} completed on `LC_ALL=C date`" @echo ">> ${target} completed on `LC_ALL=C date`"
@@ -445,7 +470,7 @@ TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
universe_kernconfs: universe_kernconf_${TARGET}_${kernel} universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
universe_kernconf_${TARGET}_${kernel}: universe_kernconf_${TARGET}_${kernel}:
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
${MAKE} ${JFLAG} buildkernel \ ${SUB_MAKE} ${JFLAG} buildkernel \
TARGET=${TARGET} \ TARGET=${TARGET} \
TARGET_ARCH=${TARGET_ARCH_${kernel}} \ TARGET_ARCH=${TARGET_ARCH_${kernel}} \
KERNCONF=${kernel} \ KERNCONF=${kernel} \