Bug 1578254 - Trick Make into running rust targets earlier again. r=nalexander

One of the things bug 1567616 did was to change how .cargo/config is
preprocessed, from it happening during configure to it happening during
the build. And to make things happen properly, dependencies were added
on the rust targets to ensure the .cargo/config file is created before
they run.

Unfortunately, that changed the order in which Make would run all the
targets while recursing for the compile tier, when the file doesn't
exist first. So instead of starting the compile tier with rust targets,
it would start with most C++, then do rust... which we know to make
builds slower overall because of the need to wait for those rust builds
to finish which C++ has all been dealt with already, and lacking
parallelism during the rust build.

So we force .cargo/config to be generated during export (which it is not
already because OBJDIR_PP_FILES are currently dealt with during misc).
That makes Make still run the rust targets early during the compile
tier.

And while here, we extend the if block in recurse.mk that excludes all
the top-level recursion dependencies when running from subdirectories.

Differential Revision: https://phabricator.services.mozilla.com/D44992

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-09-06 22:58:03 +00:00
parent d3fcf65767
commit d9362c0f85

View file

@ -191,12 +191,19 @@ endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk)
toolkit/library/target: widget/gtk/mozgtk/gtk3/target
endif
endif
# Most things are built during compile (target/host), but some things happen during export
# Those need to depend on config/export for system wrappers.
$(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/host: config/export
# Rust targets need $topobjdir/.cargo/config to be preprocessed first. Ideally,
# we'd only set it as a dependency of the rust targets, but unfortunately, that
# pushes Make to execute them much later than we'd like them to be when the file
# doesn't exist prior to Make running. So we also set it as a dependency of
# export, which ensures it exists before recursing the rust targets, tricking
# Make into keeping them early.
$(rust_targets): $(DEPTH)/.cargo/config
export:: $(DEPTH)/.cargo/config
# When building gtest as part of the build (LINK_GTEST_DURING_COMPILE),
# force the build system to get to it first, so that it can be linked
@ -206,3 +213,4 @@ $(rust_targets): $(DEPTH)/.cargo/config
ifneq (,$(filter toolkit/library/gtest/rust/target,$(compile_targets)))
toolkit/library/rust/target: toolkit/library/gtest/rust/target
endif
endif