From c1daea292a82d943c3fd48e877b908f3d1a40505 Mon Sep 17 00:00:00 2001
From: "Peter A. Jonsson" <jonsson.peter.a@gmail.com>
Date: Tue, 29 Mar 2022 14:52:46 +0200
Subject: [PATCH] nrf: fail when missing $(NRFJPROG)

Replace the echo "ERROR: .." with
a call to $(error) to ensure make
fails with a non-zero return value.
---
 arch/cpu/nrf/Makefile.nrf           | 4 ++--
 arch/cpu/nrf52840/Makefile.nrf52840 | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/cpu/nrf/Makefile.nrf b/arch/cpu/nrf/Makefile.nrf
index 0a6190a234..5109f94125 100644
--- a/arch/cpu/nrf/Makefile.nrf
+++ b/arch/cpu/nrf/Makefile.nrf
@@ -86,7 +86,7 @@ endif
 
 %.upload: $(OUT_HEX)
 ifeq (, $(shell which $(NRFJPROG)))
-	@echo "ERROR: Could not find nrfjprog, please install it first"
+	$(error Could not find nrfjprog "$(NRFJPROG)", please install it)
 else
 	$(NRFJPROG) $(NRFJPROG_OPTIONS) $(NRFJPROG_FLAGS) --sectorerase --program $<
 	$(NRFJPROG) $(NRFJPROG_OPTIONS) $(NRFJPROG_FLAGS) --reset
@@ -114,7 +114,7 @@ nrf-upload-sequence: $(foreach SNR, $(NRF_SNRS), nrf-upload-snr.$(SNR))
 
 %.upload-all: $(OUT_HEX)
 ifeq (, $(shell which $(NRFJPROG)))
-	@echo "ERROR: Could not find nrfjprog, please install it first"
+	$(error Could not find nrfjprog "$(NRFJPROG)", please install it)
 else
 	$(MAKE) HEX_FILE=$< -j $(NUMPAR) nrf-upload-sequence
 endif
diff --git a/arch/cpu/nrf52840/Makefile.nrf52840 b/arch/cpu/nrf52840/Makefile.nrf52840
index 0c620a8a8b..14196d299e 100644
--- a/arch/cpu/nrf52840/Makefile.nrf52840
+++ b/arch/cpu/nrf52840/Makefile.nrf52840
@@ -122,7 +122,7 @@ endif
 
 %.upload: $(OUT_HEX)
 ifeq (, $(shell which $(NRFJPROG)))
-	@echo "ERROR: Could not find nrfjprog, please install it first"
+	$(error Could not find nrfjprog "$(NRFJPROG)", please install it)
 else
 	$(NRFJPROG) -f nrf52 $(NRFJPROG_FLAGS) --sectorerase --program $<
 	$(NRFJPROG) -f nrf52 $(NRFJPROG_FLAGS) --reset
@@ -150,7 +150,7 @@ nrf-upload-sequence: $(foreach SNR, $(NRF_SNRS), nrf-upload-snr.$(SNR))
 
 %.upload-all: $(OUT_HEX)
 ifeq (, $(shell which $(NRFJPROG)))
-	@echo "ERROR: Could not find nrfjprog, please install it first"
+	$(error Could not find nrfjprog "$(NRFJPROG)", please install it)
 else
 	$(MAKE) HEX_FILE=$< -j $(NUMPAR) nrf-upload-sequence
 endif
-- 
GitLab