aboutsummaryrefslogtreecommitdiff
path: root/Common.mk
diff options
context:
space:
mode:
authorPieter du Preez <pdupreez@gmail.com>2018-09-13 23:44:12 +0200
committerPieter du Preez <pdupreez@gmail.com>2018-09-13 23:44:12 +0200
commit2442dafb4fa8a7f0c5212a0d0f6e3fbafb986b29 (patch)
treeb086cad84443f94ac5df42a05a784b28c209420e /Common.mk
parent22ca63614d05c8b8037cb037279ee666b5ede8c2 (diff)
Moved the PARSE_BOARD macro from Arduino.mk to Common.mk.
There seems to be 3 different macros to parse the boards.txt file. This patch moves the PARSE_BOARD macro from Arduino.mk to Common.mk. The PARSE_OPENCM and PARSE_TEENSY macros in Teensy.mk and OpenCM.mk were removed and the common PARSE_BOARD is now being called from everywhere. Advantages of this fix are: 1. Less code, i.e. no redundant parse macros. 2. A single standardized algorithm to parse the boards.txt file.
Diffstat (limited to 'Common.mk')
-rw-r--r--Common.mk5
1 files changed, 5 insertions, 0 deletions
diff --git a/Common.mk b/Common.mk
index 5f30fba..6209b03 100644
--- a/Common.mk
+++ b/Common.mk
@@ -5,6 +5,11 @@ COMMON_INCLUDED = TRUE
# (directory and optional filename) exists
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)
+endif
+
# Run a shell script if it exists. Stops make on error.
runscript_if_exists = \
$(if $(wildcard $(1)), \