Index: sys/conf/kern.pre.mk =================================================================== --- sys/conf/kern.pre.mk (revision 260701) +++ sys/conf/kern.pre.mk (working copy) @@ -6,6 +6,21 @@ .include .include +# Make sure our TARGET/TARGET_ARCH is compatible +.if defined(TARGET_ARCH) +__T=${TARGET_ARCH} +.else +__T!= uname -p +.endif +.if defined(TARGET) +__TT=${TARGET} +.else +__TT!=uname -m +.endif +.if ${__TT} != ${MACHINE} || ${__T} != ${MACHINE_ARCH} +.error Invalid combination, trying to build kernel ${MACHINE}/${MACHINE_ARCH} using ${__TT}/${__T} +.endif + # backwards compat option for older systems. MACHINE_CPUARCH?=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}