From 62d23d66a2f9326235022bfd8711c62e015c0bc8 Mon Sep 17 00:00:00 2001 From: Pieter du Preez Date: Sat, 15 Sep 2018 14:31:39 +0200 Subject: Moved the BOARDS_TXT section and stop if BOARDS_TXT is not a file. The section of Arduino.mk that calculates BOARDS_TXT was moved to just before the point where it gets used for the first time (a call to PARSE_BOARD). An error gets generated if BOARDS_TXT is not pointing to a valid file, directly after the BOARDS_TXT calculation. In addition, the PARSE_BOARD macro will now be bypassed if the BOARDS_TXT variable points to a non-existing file. If a user makefile uses PARSE_BOARD before including Arduino.mk, and the BOARDS_TXT is wrong, the error will only be caught in the Arduino.mk file, which is probably acceptable. --- Common.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Common.mk') diff --git a/Common.mk b/Common.mk index 6209b03..c5f2bc2 100644 --- a/Common.mk +++ b/Common.mk @@ -7,7 +7,13 @@ dir_if_exists = $(if $(wildcard $(1)$(2)),$(1)) ifndef PARSE_BOARD # result = $(call READ_BOARD_TXT, 'boardname', 'parameter') -PARSE_BOARD = $(shell grep -Ev '^\#' $(BOARDS_TXT) | grep -E "^[ \t]*$(1).$(2)=" | cut -d = -f 2 | cut -d : -f 2) +PARSE_BOARD = $(shell if [ -f $(BOARDS_TXT) ]; \ +then \ + grep -Ev '^\#' $(BOARDS_TXT) | \ + grep -E "^[ \t]*$(1).$(2)=" | \ + cut -d = -f 2 | \ + cut -d : -f 2; \ +fi) endif # Run a shell script if it exists. Stops make on error. -- cgit v1.2.3