From 7113a1e138c71a3303c44a49e9f1ff047e1455b8 Mon Sep 17 00:00:00 2001 From: Rahix Date: Sat, 25 Jul 2020 21:55:25 +0200 Subject: [PATCH] make: Allow overriding rustup toolchain Allow overriding the rustup toolchain used for rustfmt by invoking make like this: make RUSTUP_TOOLCHAIN=nightly-2020-07-12 This will (hopefully) help when working with nightly versions where rustfmt is unavailable. Signed-off-by: Rahix --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 01dd363..a8527fa 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ all: deps chips CHIPS := atmega1280 atmega8 atmega328p atmega32u4 atmega64 attiny85 +RUSTUP_TOOLCHAIN ?= nightly + PATCHES := $(foreach chip, $(CHIPS), $(wildcard patch/$(chip).yaml)) DEPS := $(foreach patch, $(PATCHES), $(patsubst patch/%.yaml, .deps/%.d, $(patch))) @@ -41,7 +43,7 @@ src/devices/%/mod.rs: src/devices/%/mod.full.rs @RUST_LOG=WARN form -i $< -o $(@D) >/dev/null @rm $< @mv $(@D)/lib.rs $@ - @RUSTUP_TOOLCHAIN=nightly rustfmt $@ + @RUSTUP_TOOLCHAIN=$(RUSTUP_TOOLCHAIN) rustfmt $@ @# Remove the `extern crate` lines @sed -i'' -e "1,7d" $@ @# Remove DEVICE_PERIPHERALS declaration and replace it with a reference -- 2.49.0