aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Common.mk12
-rw-r--r--Sam.mk2
-rw-r--r--arduino-mk-vars.md16
3 files changed, 23 insertions, 7 deletions
diff --git a/Common.mk b/Common.mk
index 65dc126..d111336 100644
--- a/Common.mk
+++ b/Common.mk
@@ -8,8 +8,8 @@ dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
PARSE_BOARD = $(shell if [ -f $(BOARDS_TXT) ]; \
then \
- $(GREP) -Ev '^\#' $(BOARDS_TXT) | \
- $(GREP) -E "^[ \t]*$(1).$(2)=" | \
+ $(GREP_CMD) -Ev '^\#' $(BOARDS_TXT) | \
+ $(GREP_CMD) -E "^[ \t]*$(1).$(2)=" | \
cut -d = -f 2- | \
cut -d : -f 2; \
fi)
@@ -48,20 +48,20 @@ $(call arduino_output,$(call ardmk_include) Configuration:)
ifeq ($(OS),Windows_NT)
CURRENT_OS = WINDOWS
- GREP := grep
+ GREP_CMD := grep
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CURRENT_OS = LINUX
- GREP := grep
+ GREP_CMD := grep
endif
ifeq ($(UNAME_S),Darwin)
CURRENT_OS = MAC
ifeq (, $(shell which ggrep))
echo $(info Using macOS BSD grep, please install GNU grep to avoid warnings)
- GREP := grep
+ GREP_CMD := grep
else
- GREP := ggrep
+ GREP_CMD := ggrep
endif
endif
endif
diff --git a/Sam.mk b/Sam.mk
index 2aa3078..cc588a1 100644
--- a/Sam.mk
+++ b/Sam.mk
@@ -414,7 +414,7 @@ CFLAGS_STD += -std=gnu11
CPPFLAGS += -DMD -D$(USB_TYPE) '-DUSB_PRODUCT=$(USB_PRODUCT)' '-DUSB_MANUFACTURER=$(USB_MANUFACTURER)'
# Get extra define flags from boards.txt
-EXFLAGS := $(shell echo $(call PARSE_BOARD,$(BOARD_TAG),build.extra_flags) | $(GREP) -oE '(-D)\w+')
+EXFLAGS := $(shell echo $(call PARSE_BOARD,$(BOARD_TAG),build.extra_flags) | $(GREP_CMD) -oE '(-D)\w+')
# Strip only defines from extra flags as boards file appends user {build.usb}
CPPFLAGS += $(EXFLAGS)
diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md
index e0b8618..746066b 100644
--- a/arduino-mk-vars.md
+++ b/arduino-mk-vars.md
@@ -150,6 +150,22 @@ PYTHON_CMD = /usr/bin/python3
----
+### GREP_CMD
+
+**Description:**
+
+Path to GNU grep binary. Only added for macOS, which has BSD grep by default but results in some parsing warnings. macOS users should install GNU grep using Homebrew.
+
+**Example:**
+
+```Makefile
+GREP_CMD = /bin/grep
+```
+
+**Requirement:** *Optional*
+
+----
+
## Arduino IDE variables
### ARDUINO_DIR