aboutsummaryrefslogtreecommitdiff
path: root/lang/rust/rustc_environment.mk
diff options
context:
space:
mode:
Diffstat (limited to 'lang/rust/rustc_environment.mk')
-rw-r--r--lang/rust/rustc_environment.mk30
1 files changed, 30 insertions, 0 deletions
diff --git a/lang/rust/rustc_environment.mk b/lang/rust/rustc_environment.mk
new file mode 100644
index 0000000..db0e350
--- /dev/null
+++ b/lang/rust/rustc_environment.mk
@@ -0,0 +1,30 @@
+-include $(TOPDIR)/package/feeds/packages/rust/rustc_targets.mk
+
+# These RUSTFLAGS are common across all TARGETs
+RUSTFLAGS += \
+ -C linker=$(TOOLCHAIN_DIR)/bin/$(TARGET_CC_NOCACHE) \
+ -C ar=$(TOOLCHAIN_DIR)/bin/$(TARGET_AR) \
+ -C target-cpu=$(RUSTC_CPU_TYPE)
+
+ifneq ($(RUST_TARGET_FEATURES),)
+RUSTFLAGS += -C target-feature=$(RUST_TARGET_FEATURES)
+endif
+
+# Common Build Flags
+CARGO_BUILD_FLAGS = \
+ RUSTFLAGS="$(RUSTFLAGS)" \
+ CARGO_HOME="$(CARGO_HOME)"
+
+# This adds the rust environmental variables to Make calls
+# MAKE_FLAGS += $(RUST_BUILD_FLAGS)
+
+define RustPackage/Cargo/Update
+ cd $(PKG_BUILD_DIR) && \
+ $(CARGO_BUILD_FLAGS) cargo update $(1)
+endef
+
+define RustPackage/Cargo/Compile
+ cd $(PKG_BUILD_DIR) && \
+ $(CARGO_BUILD_FLAGS) cargo build -v --release \
+ --target $(RUSTC_TARGET_ARCH) $(1)
+endef