From 3f08f7484d6473cd150e50713fa5514f6d4bab11 Mon Sep 17 00:00:00 2001 From: tobik Date: Wed, 29 Nov 2017 11:06:11 +0000 Subject: Mk/Uses/cargo.mk: Respect CPUTYPE C and C++ code can be built targeting newer CPUs if user defined CPUTYPE in make.conf. Let's opt-in for Rust as well. PR: 223939 Submitted by: jbeich --- Mk/Uses/cargo.mk | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Mk') diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk index 87d1d9b22e69..e3439579639f 100644 --- a/Mk/Uses/cargo.mk +++ b/Mk/Uses/cargo.mk @@ -72,6 +72,13 @@ CARGO_ENV+= \ RUSTDOC=${LOCALBASE}/bin/rustdoc \ RUSTFLAGS="${RUSTFLAGS}" +# Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk +.if ${ARCH} == amd64 || ${ARCH} == i386 +RUSTFLAGS+= ${CFLAGS:M-march=*:S/-march=/-C target-cpu=/} +.else +RUSTFLAGS+= ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/} +.endif + # Helper to shorten cargo calls. CARGO_CARGO_RUN= \ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${CARGO_ENV} \ -- cgit