From d61de8cf4d0ca35da52643eec74d6dda121b99ea Mon Sep 17 00:00:00 2001 From: jperkin Date: Thu, 17 Mar 2016 16:02:23 +0000 Subject: Since the MACHINE_ARCH cleanup, the bootstrap for i386-on-x86_64 Linux has been broken due to NATIVE_MACHINE_ARCH no longer being set to x86_64. Fix this by introducing HOST_MACHINE_ARCH which refers to the underlying host architecture rather than bmake's native architecture, thus differentiating between cross-compiling and multilib. This is currently only set on Linux as the only OPSYS which currently requires such a test, but can be expanded to other OPSYS as necessary. --- mk/bsd.prefs.mk | 6 +++++- mk/platform/Linux.mk | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'mk') diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk index 7382adadd25..e5a1666ca78 100644 --- a/mk/bsd.prefs.mk +++ b/mk/bsd.prefs.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prefs.mk,v 1.381 2016/03/11 23:54:08 khorben Exp $ +# $NetBSD: bsd.prefs.mk,v 1.382 2016/03/17 16:02:23 jperkin Exp $ # # This file includes the mk.conf file, which contains the user settings. # @@ -221,6 +221,10 @@ LOWER_VENDOR?= ssd LOWER_VENDOR?= pc . endif LOWER_VENDOR?= unknown +. if !defined(HOST_MACHINE_ARCH) +HOST_MACHINE_ARCH!= ${UNAME} -m +MAKEFLAGS+= HOST_MACHINE_ARCH=${HOST_MACHINE_ARCH:Q} +. endif .elif ${OPSYS} == "OpenBSD" LOWER_OPSYS?= openbsd diff --git a/mk/platform/Linux.mk b/mk/platform/Linux.mk index 74605d96893..9e1e23757ac 100644 --- a/mk/platform/Linux.mk +++ b/mk/platform/Linux.mk @@ -1,4 +1,4 @@ -# $NetBSD: Linux.mk,v 1.65 2016/03/10 16:58:19 jperkin Exp $ +# $NetBSD: Linux.mk,v 1.66 2016/03/17 16:02:23 jperkin Exp $ # # Variable definitions for the Linux operating system. @@ -120,7 +120,7 @@ LIBABISUFFIX?= 64 # When building 32-bit packages on x86_64 GNU ld isn't smart enough to # figure out the target architecture based on the objects so we need to # explicitly set it. -.if ${NATIVE_MACHINE_ARCH} == "x86_64" && ${MACHINE_ARCH} == "i386" +.if ${HOST_MACHINE_ARCH} == "x86_64" && ${MACHINE_ARCH} == "i386" _WRAP_EXTRA_ARGS.LD+= -m elf_i386 CWRAPPERS_APPEND.ld+= -m elf_i386 .endif -- cgit v1.2.3