From 26e34cd6f2471f04ba097001a215caed12a8574a Mon Sep 17 00:00:00 2001 From: John Whittington Date: Tue, 4 Aug 2020 11:51:35 +0200 Subject: detect and use GNU grep on macOS --- Common.mk | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Common.mk') diff --git a/Common.mk b/Common.mk index 0c1f92c..27d2135 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) -Ev '^\#' $(BOARDS_TXT) | \ + $(GREP) -E "^[ \t]*$(1).$(2)=" | \ cut -d = -f 2- | \ cut -d : -f 2; \ fi) @@ -45,15 +45,24 @@ $(call arduino_output,$(call ardmk_include) Configuration:) ######################################################################## # # Detect OS + ifeq ($(OS),Windows_NT) CURRENT_OS = WINDOWS + GREP := grep else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) CURRENT_OS = LINUX + GREP := 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 + else + GREP := ggrep + endif endif endif $(call show_config_variable,CURRENT_OS,[AUTODETECTED]) -- cgit v1.2.3