From a00cd9540d117e62edb8e1e35266d6d13c91975c Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Thu, 23 Aug 2018 18:19:10 +0000 Subject: [PATCH] Fix non-FreeBSD host lib32 build for TARGET=amd64 When building on non-FreeBSD systems we need to pass an explicit target triple to clang otherwise it will attempt to build with the host triple. This also has advantages when building on a FreeBSD host: we now tell clang that we are targeting at least FreeBSD 12.0 instead of an older version so it can enable newer features. Reviewed By: brooks (mentor) Approved By: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D16842 --- Makefile.libcompat | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.libcompat b/Makefile.libcompat index c2c729fdcfe1..b339567c08ed 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -14,6 +14,11 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 .else LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif +.if ${WANT_COMPILER_TYPE} == gcc || \ + (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) +.else +LIB32CPUFLAGS+= -target x86_64-unknown-freebsd12.0 +.endif LIB32CPUFLAGS+= -m32 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ MACHINE_CPU="i686 mmx sse sse2"