From d899b823ccbed0fda97b6fe945a360ebcce9bb81 Mon Sep 17 00:00:00 2001 From: Cam Hutchison Date: Wed, 10 May 2023 07:29:43 +1000 Subject: [PATCH] build: Scope RUST_VERSION var to single target Scope the `RUST_VERSION` variable to the single `rustup-install-target-toolchain` target that needs it. Setting it at the top-level causes a strange interaction between the top-level Makefile and the one in `build.assets/` that causes `make fix-imports` (and presumably any other target that chains to `build.assets/Makefile` and uses `RUST_VERSION`) to get an empty `RUST_VERSION`. We use `:=` when setting `RUST_VERSION` otherwise the same problem is present but just for the `rustup-install-target-toolchain` target. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 586a74b8132f4..6e830040538ad 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,6 @@ TARBINS = $(addprefix teleport/,$(BINS)) CHECK_CARGO := $(shell cargo --version 2>/dev/null) CHECK_RUST := $(shell rustc --version 2>/dev/null) -RUST_VERSION ?= $(shell make --no-print-directory -C build.assets print-rust-version) RUST_TARGET_ARCH ?= $(CARGO_TARGET_$(OS)_$(ARCH)) # Have cargo use sparse crates.io protocol: @@ -1323,6 +1322,7 @@ docker-ui: # defined in build.assets/Makefile. It assumes that `rustup` is already # installed for managing the rust toolchain. .PHONY: rustup-install-target-toolchain +rustup-install-target-toolchain: RUST_VERSION := $(shell $(MAKE) --no-print-directory -C build.assets print-rust-version) rustup-install-target-toolchain: rustup override set $(RUST_VERSION) rustup target add $(RUST_TARGET_ARCH)