From 0ebe2bbd8f6f35d9123e4ba1e1b25e36b588364b Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 13 Jul 2020 22:24:59 +0000 Subject: [PATCH] Bug 1652448 - Use the same codegen-units numbers on host and target rust builds. r=firefox-build-system-reviewers,rstewart Otherwise, crates that are shared between host and target are always rebuilt because of the difference in rust flags. Differential Revision: https://phabricator.services.mozilla.com/D83412 --- config/makefiles/rust.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk index daed503eb6e9..82182ffdf30f 100644 --- a/config/makefiles/rust.mk +++ b/config/makefiles/rust.mk @@ -189,18 +189,18 @@ $(target_rust_nonltoable): RUSTFLAGS:=$(rustflags_override) $(rustflags_sancov) TARGET_RECIPES := $(target_rust_ltoable) $(target_rust_nonltoable) -# If this is a release build we want rustc to generate one codegen unit per -# crate. This results in better optimization and less code duplication at the -# cost of longer compile times. -ifndef DEVELOPER_OPTIONS -$(TARGET_RECIPES): RUSTFLAGS += -C codegen-units=1 -endif - HOST_RECIPES := \ $(foreach a,library program,$(foreach b,build check,force-cargo-host-$(a)-$(b))) $(HOST_RECIPES): RUSTFLAGS:=$(rustflags_override) +# If this is a release build we want rustc to generate one codegen unit per +# crate. This results in better optimization and less code duplication at the +# cost of longer compile times. +ifndef DEVELOPER_OPTIONS +$(TARGET_RECIPES) $(HOST_RECIPES): RUSTFLAGS += -C codegen-units=1 +endif + cargo_env = $(subst -,_,$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))) # We use the + prefix to pass down the jobserver fds to cargo, but we