Fix cross-building further.
Introduce ${TARGET} defaulting to ${MACHINE} which should be set to whatever your target ${MACHINE} is, and use that with world-related stages. That is, to build pc98 on alpha, one now needs to set both TARGET_ARCH=i386 and TARGET=pc98. The scope of ${TARGET} is limited to Makefile.inc1 and cross-tools. In particular, this change was tested to fix: 1. Cross building of "alpha" on i386. The breakage was introduced by rev. 1.10 to sbin/i386/Makefile (missing <machine/cronyx.h>). 2. Descending into machine-specific subdirs for a different arch. Previously, sbin/i386 and usr.sbin/boot0cfg were descended into when cross-building "alpha" or pc98 on i386. 3. Fixes pc98 cross-building which was horribly broken, caused by not setting MACHINE correctly (most ${MACHINE} == pc98 checking Makefiles put -DPC98 to CFLAGS).
This commit is contained in:
parent
0751407193
commit
444ff633bf
@ -121,6 +121,7 @@ SUPFLAGS+= -h ${SUPHOST}
|
||||
|
||||
MAKEOBJDIRPREFIX?= /usr/obj
|
||||
TARGET_ARCH?= ${MACHINE_ARCH}
|
||||
TARGET?= ${MACHINE}
|
||||
.if make(buildworld)
|
||||
BUILD_ARCH!= sysctl -n hw.machine_arch
|
||||
.if ${MACHINE_ARCH} != ${BUILD_ARCH}
|
||||
@ -166,6 +167,7 @@ INSTALLTMP= ${TMPDIR}/install.${TMPPID}
|
||||
# Common environment for world related stages
|
||||
CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
|
||||
MACHINE_ARCH=${TARGET_ARCH} \
|
||||
MACHINE=${TARGET} \
|
||||
COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
|
||||
LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
|
||||
OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
|
||||
@ -359,13 +361,13 @@ distribworld:
|
||||
#
|
||||
# Which kernels to build and/or install is specified by setting
|
||||
# KERNCONF. If not defined a GENERIC kernel is built/installed.
|
||||
# Only the existing (depending MACHINE) config files are used
|
||||
# Only the existing (depending TARGET) config files are used
|
||||
# for building kernels and only the first of these is designated
|
||||
# as the one being installed.
|
||||
#
|
||||
# Note that we have to use MACHINE instead of TARGET_ARCH when
|
||||
# Note that we have to use TARGET instead of TARGET_ARCH when
|
||||
# we're in kernel-land. Since only TARGET_ARCH is (expected) to
|
||||
# be set to cross-build, we have to make sure MACHINE is set
|
||||
# be set to cross-build, we have to make sure TARGET is set
|
||||
# properly.
|
||||
|
||||
.if !defined(KERNCONF) && defined(KERNEL)
|
||||
@ -376,15 +378,15 @@ KERNCONF?= GENERIC
|
||||
.endif
|
||||
INSTKERNNAME?= kernel
|
||||
|
||||
# The only exotic TARGET_ARCH/MACHINE combination valid at this
|
||||
# time is i386/pc98. In all other cases set MACHINE equal to
|
||||
# The only exotic TARGET_ARCH/TARGET combination valid at this
|
||||
# time is i386/pc98. In all other cases set TARGET equal to
|
||||
# TARGET_ARCH.
|
||||
.if ${TARGET_ARCH} != "i386" || ${MACHINE} != "pc98"
|
||||
MACHINE= ${TARGET_ARCH}
|
||||
.if ${TARGET_ARCH} != "i386" || ${TARGET} != "pc98"
|
||||
TARGET= ${TARGET_ARCH}
|
||||
.endif
|
||||
|
||||
KRNLSRCDIR= ${.CURDIR}/sys
|
||||
KRNLCONFDIR= ${KRNLSRCDIR}/${MACHINE}/conf
|
||||
KRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf
|
||||
KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR}
|
||||
KERNCONFDIR?= ${KRNLCONFDIR}
|
||||
|
||||
@ -430,17 +432,17 @@ buildkernel:
|
||||
.endif
|
||||
.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
|
||||
cd ${KRNLOBJDIR}/${_kernel}; \
|
||||
${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} clean
|
||||
${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} clean
|
||||
.endif
|
||||
cd ${KRNLOBJDIR}/${_kernel}; \
|
||||
MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \
|
||||
${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile
|
||||
.if !defined(NO_KERNELDEPEND)
|
||||
cd ${KRNLOBJDIR}/${_kernel}; \
|
||||
${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} depend
|
||||
${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
|
||||
.endif
|
||||
cd ${KRNLOBJDIR}/${_kernel}; \
|
||||
${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} all
|
||||
${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
|
||||
@echo "--------------------------------------------------------------"
|
||||
@ -453,10 +455,10 @@ buildkernel:
|
||||
#
|
||||
installkernel:
|
||||
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
|
||||
${CROSSENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} install
|
||||
${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} install
|
||||
reinstallkernel:
|
||||
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
|
||||
${CROSSENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} reinstall
|
||||
${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} reinstall
|
||||
|
||||
#
|
||||
# kernel
|
||||
|
Loading…
Reference in New Issue
Block a user