diff options
| author | Pieter du Preez <pdupreez@gmail.com> | 2018-09-15 14:31:39 +0200 |
|---|---|---|
| committer | Pieter du Preez <pdupreez@gmail.com> | 2018-09-15 14:31:39 +0200 |
| commit | 62d23d66a2f9326235022bfd8711c62e015c0bc8 (patch) | |
| tree | 28371db5c558406a4718c23b9110707ff131c5cd /Common.mk | |
| parent | e44540043edb15c0ab7eab2a8d0cb3241933ce8e (diff) | |
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.
Diffstat (limited to 'Common.mk')
| -rw-r--r-- | Common.mk | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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. |
