Date: Fri, 27 Oct 2017 09:23:29 +0300 From: =?UTF-8?Q?Eddy_Petri=C8=99or?= <eddy.petrisor@gmail.com> To: freebsd-toolchain@freebsd.org, freebsd-arm@freebsd.org Subject: lib/clan/llvm.build.mk: Shouldn't BUILD_TRIPLE definition rely host 'cc -dumpmachine'? Message-ID: <CAK0XTWczya8vg_sQZPqz-ZyYZRMq1v6p%2Bjs90S%2BjaDHxo2=1gA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hello,
I am trying to make the FreeBSD code base build from a Linux host and
found this bit which defines BUILD_TRIPLE in a way which to my
untrained eyes look like overengineering.
.if ${TARGET_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
TARGET_ABI= -gnueabihf
.elif ${TARGET_ARCH:Marm*}
TARGET_ABI= -gnueabi
.else
TARGET_ABI=
.endif
VENDOR= unknown
OS_VERSION= freebsd12.0
TARGET_TRIPLE?=
${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI}
BUILD_TRIPLE?=
${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}
To support a Linux host I made these changes that is using 'cc
-dumpmachine' to get the correct BUILD_TRIPLE, but I am wondering if
it shouldn't be OK for building on a FreeBSD host
.if ${TARGET_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
TARGET_ABI= -gnueabihf
.elif ${TARGET_ARCH:Marm*}
TARGET_ABI= -gnueabi
.else
TARGET_ABI=
.endif
VENDOR= unknown
OS_VERSION= freebsd12.0
+BUILD_OS!= uname -s
+
TARGET_TRIPLE?=
${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI}
+.if ${BUILD_OS} == FreeBSD
BUILD_TRIPLE?=
${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}
+.else
+HOST_CC_DUMPMACHINE!= cc -dumpmachine
+BUILD_TRIPLE?= ${HOST_CC_DUMPMACHINE}
+.endif
What do you think, should the code be instead:
.if ${TARGET_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
TARGET_ABI= -gnueabihf
.elif ${TARGET_ARCH:Marm*}
TARGET_ABI= -gnueabi
.else
TARGET_ABI=
.endif
VENDOR= unknown
OS_VERSION= freebsd12.0
TARGET_TRIPLE?=
${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI}
+HOST_CC_DUMPMACHINE!= cc -dumpmachine
+BUILD_TRIPLE?= ${HOST_CC_DUMPMACHINE}
--
Eddy Petrișor
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAK0XTWczya8vg_sQZPqz-ZyYZRMq1v6p%2Bjs90S%2BjaDHxo2=1gA>
