Bug 1293253 - part 1 - modify existing Rust library build rules to be explicitly about libraries; r=chmanchester
authorNathan Froyd <froydnj@mozilla.com>
Mon, 28 Nov 2016 11:20:39 -0500
changeset 324478 03549e92001dda90199b2cbab7f1985b61e8fa07
parent 324477 d8a41d4c6215cb13f2a62675486f97c140d96deb
child 324479 779d75b98fc5b19a8e45a82ad357f0ecbedcdcd9
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerschmanchester
bugs1293253
milestone53.0a1
Bug 1293253 - part 1 - modify existing Rust library build rules to be explicitly about libraries; r=chmanchester In preparation for a world where we have cargo building binaries too, the existing rules should be renamed to reflect their library associations. The lone Cargo invocation should be updated to explicitly build libraries only, so libraries and binaries in the same directory will work correctly. Fixup a leftover comment from a previous set of changes while we're here.
config/rules.mk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -942,22 +942,22 @@ ifndef MOZ_OPTIMIZE
 rustflags_override = RUSTFLAGS='-C opt-level=0'
 endif
 
 # Assume any system libraries rustc links against are already in the target's LIBS.
 #
 # We need to run cargo unconditionally, because cargo is the only thing that
 # has full visibility into how changes in Rust sources might affect the final
 # build.
-force-cargo-build:
+force-cargo-library-build:
 	$(REPORT_BUILD)
-	env $(rustflags_override) CARGO_TARGET_DIR=. RUSTC=$(RUSTC) $(CARGO) build $(cargo_build_flags) --
+	env $(rustflags_override) CARGO_TARGET_DIR=. RUSTC=$(RUSTC) $(CARGO) build --lib $(cargo_build_flags) --
 
-$(RUST_LIBRARY_FILE): force-cargo-build
-endif # CARGO_FILE
+$(RUST_LIBRARY_FILE): force-cargo-library-build
+endif # RUST_LIBRARY_FILE
 endif # MOZ_RUST
 
 $(SOBJS):
 	$(REPORT_BUILD)
 	$(AS) -o $@ $(DEFINES) $(ASFLAGS) $($(notdir $<)_FLAGS) $(LOCAL_INCLUDES) -c $<
 
 $(CPPOBJS):
 	$(REPORT_BUILD_VERBOSE)