From 628117478e11a271251518795fd1085e5031787c Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 26 Mar 2022 18:40:22 -0700 Subject: [PATCH] Use := syntax for when we call $(shell) in our makefiles. https://blog.melski.net/2010/11/15/shell-commands-in-gnu-make/ "In short: not using := assignment can cause your makefile to invoke the shell far more often than you realize, which can be a performance problem, and leave you with unpredictable build results. Always use := assignment with $(shell)." --- Makefile | 4 ++-- etc/makefiles/arduino-cli.mk | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8ea631cf..2a936352 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ cpplint: bin/cpplint.py --quiet --filter=-whitespace,-legal/copyright,-build/include,-readability/namespace,-runtime/references --recursive --extensions=cpp,h,ino src examples -SHELL_FILES = $(shell if [ -d bin ]; then egrep -n -r -l "(env (ba)?sh)|(/bin/(ba)?sh)" bin; fi) +SHELL_FILES := $(shell if [ -d bin ]; then egrep -n -r -l "(env (ba)?sh)|(/bin/(ba)?sh)" bin; fi) shellcheck: @if [ -d "bin" ]; then \ @@ -118,7 +118,7 @@ shellcheck: fi -SMOKE_SKETCHES=$(sort $(shell if [ -d ./examples ]; then find ./examples -type f -name \*ino | xargs -n 1 dirname; fi)) +SMOKE_SKETCHES := $(sort $(shell if [ -d ./examples ]; then find ./examples -type f -name \*ino | xargs -n 1 dirname; fi)) smoke-sketches: $(SMOKE_SKETCHES) @echo "Smoke-tested all the sketches" diff --git a/etc/makefiles/arduino-cli.mk b/etc/makefiles/arduino-cli.mk index 68ea4ecc..ac8ffbd7 100644 --- a/etc/makefiles/arduino-cli.mk +++ b/etc/makefiles/arduino-cli.mk @@ -62,7 +62,7 @@ arduino_env = ARDUINO_DIRECTORIES_USER=$(ARDUINO_DIRECTORIES_USER) \ ifeq ($(ARDUINO_CLI_PATH),) -system_arduino_cli ?= $(shell command -v arduino-cli || true) +system_arduino_cli := $(shell command -v arduino-cli || true) ifeq ($(system_arduino_cli),) export ARDUINO_CLI_PATH ?= $(KALEIDOSCOPE_BIN_DIR)/arduino-cli @@ -104,11 +104,11 @@ _arduino_props := $(shell ${ARDUINO_CLI} compile $(fqbn_arg) --show-properties _arduino_prop = $(subst $1=,,$(subst 🔥, ,$(filter $1=%,$(_arduino_props)))) -_arduino_version = $(shell ${ARDUINO_CLI} version | sed 's/.*Version: \([0-9][0-9\.]*\).*/\1/') +_arduino_version := $(shell ${ARDUINO_CLI} version | sed 's/.*Version: \([0-9][0-9\.]*\).*/\1/') export ARDUINO_CLI_VERSION ?= $(_arduino_version) -_arduino_build_property_flag = $(shell echo -e "0.14\n${ARDUINO_CLI_VERSION}" | sort -C -t. -k1,1n -k2,2n && echo "YES") +_arduino_build_property_flag := $(shell echo -e "0.14\n${ARDUINO_CLI_VERSION}" | sort -C -t. -k1,1n -k2,2n && echo "YES") ARDUINO_BUILD_PROP_FLAG := --build-properties ifeq ($(_arduino_build_property_flag),YES)