Index: Makefile =================================================================== --- Makefile +++ Makefile @@ -307,6 +307,13 @@ NXB_TARGET_ARCH=${NXB_TARGET_ARCH} .endif +.if ${_TARGET} == "x86_64" +# Some version of bmake (e.g. Linux and Mac when built with the default flags) +# will report MACHINE as x86_64 +_TARGET:="amd64" +_TARGET_ARCH:="amd64" +.endif + .if make(print-dir) .SILENT: .endif Index: Makefile.inc1 =================================================================== --- Makefile.inc1 +++ Makefile.inc1 @@ -447,6 +447,10 @@ .endif .if make(buildworld) BUILD_ARCH!= uname -p +.if ${BUILD_ARCH} == "x86_64" || (${BUILD_ARCH} == "i386" && ${.MAKE.OS} == "Darwin") +# Allow crossbuilding from Linux/MacOS where uname -p will print x86_64/i386 +BUILD_ARCH:=amd64 +.endif .if ${MACHINE_ARCH} != ${BUILD_ARCH} .error To cross-build, set TARGET_ARCH. .endif Index: include/Makefile =================================================================== --- include/Makefile +++ include/Makefile @@ -395,6 +395,10 @@ # we need MACHINE et al set correctly HOST_MACHINE!= uname -m HOST_MACHINE_ARCH!= uname -p +.if ${HOST_MACHINE} == "x86_64" +HOST_MACHINE:=amd64 +HOST_MACHINE_ARCH:=amd64 +.endif MACHINE:= ${HOST_MACHINE} MACHINE_ARCH:= ${HOST_MACHINE_ARCH} .endif Index: share/mk/src.sys.env.mk =================================================================== --- share/mk/src.sys.env.mk +++ share/mk/src.sys.env.mk @@ -54,6 +54,13 @@ .export MAKESYSPATH .endif +.if ${MACHINE} == "x86_64" +MACHINE:=amd64 +MACHINE_ARCH:=amd64 +.export MACHINE +.export MACHINE_ARCH +.endif + .if ${RELDIR:U} == "." && ${.MAKE.LEVEL} == 0 .sinclude "${.CURDIR}/Makefile.sys.inc" .endif