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 From 207253abc6ec81112abf0a64a8bf68e227528d64 Mon Sep 17 00:00:00 2001 From: Simon John Date: Tue, 4 Aug 2020 23:19:49 +0100 Subject: Rebased python3 branch with some changes from tuna-f1sh@87d5241 --- Common.mk | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Common.mk') diff --git a/Common.mk b/Common.mk index 0c1f92c..d4fb9c1 100644 --- a/Common.mk +++ b/Common.mk @@ -98,3 +98,24 @@ ifeq ($(CURRENT_OS),WINDOWS) echo $(error On Windows, ARDUINO_DIR and other defines must use forward slash and not contain spaces, special characters or be cygdrive relative) endif endif + +######################################################################## +# System Python + +ifndef PYTHON_CMD + # try for Python 3 first + PYTHON_CMD := $(shell which python3 2> /dev/null) + ifdef PYTHON_CMD + $(call show_config_variable,PYTHON_CMD,[AUTODETECTED]) + else + # fall-back to any Python + PYTHON_CMD := $(shell which python 2> /dev/null) + ifdef PYTHON_CMD + $(call show_config_variable,PYTHON_CMD,[AUTODETECTED]) + else + echo $(error "Unable to find system Python! Utility scipts won't work. Override this error by defining PYTHON_CMD") + endif + endif +else + $(call show_config_variable,PYTHON_CMD,[USER]) +endif -- cgit v1.2.3 From 264f8f604a2c29b7bd66a1e0d11f263db7582702 Mon Sep 17 00:00:00 2001 From: John Whittington Date: Thu, 6 Aug 2020 09:38:07 +0200 Subject: Arduino IDE upto support version and SAMD builds process uses direct downloads. Might be better to move to distribution Arduino install + arduino-cli to install board support in future. --- Common.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Common.mk') diff --git a/Common.mk b/Common.mk index 5421b96..65dc126 100644 --- a/Common.mk +++ b/Common.mk @@ -78,7 +78,11 @@ ifneq ($(TEST),) MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR) endif - DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/arduino-1.0.6 + ifndef ARDUINO_IDE_DIR + ARDUINO_IDE_DIR := $(shell basename $(basename $(basename $(lastword $(wildcard $(DEPENDENCIES_DIR)/arduino*))))) + # ARDUINO_IDE_DIR := arduino + endif + DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/$(ARDUINO_IDE_DIR) ifeq ($(ARDUINO_DIR),) ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR) endif -- cgit v1.2.3 From 185a1e9e3527794a49451915009fb48d9e678080 Mon Sep 17 00:00:00 2001 From: John Whittington Date: Thu, 6 Aug 2020 12:38:03 +0200 Subject: document GREP_CMD --- Common.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Common.mk') 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 -- cgit v1.2.3 From bf319c49b7f7ff17e073422a3ba06a701e12f590 Mon Sep 17 00:00:00 2001 From: John Whittington Date: Thu, 6 Aug 2020 19:21:23 +0200 Subject: platform neutral examples and manual cherry-pick merge of https://github.com/alissa-huskey/Arduino-Makefile/tree/test_fixes --- Common.mk | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'Common.mk') diff --git a/Common.mk b/Common.mk index d111336..501f582 100644 --- a/Common.mk +++ b/Common.mk @@ -48,20 +48,20 @@ $(call arduino_output,$(call ardmk_include) Configuration:) ifeq ($(OS),Windows_NT) CURRENT_OS = WINDOWS - GREP_CMD := grep + GREP_CMD = grep else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) CURRENT_OS = LINUX - GREP_CMD := 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_CMD := grep + GREP_CMD = grep else - GREP_CMD := ggrep + GREP_CMD = ggrep endif endif endif @@ -73,14 +73,18 @@ $(call show_config_variable,CURRENT_OS,[AUTODETECTED]) ifneq ($(TEST),) DEPENDENCIES_DIR = /var/tmp/Arduino-Makefile-testing-dependencies - DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_DIR)/mpide-0023-linux64-20130817-test + DEPENDENCIES_MPIDE_DIR := $(shell find $(DEPENDENCIES_DIR) -name 'mpide-0023-*' -type d -exec ls -dt {} + | head -n 1) + ifeq ($(MPIDE_DIR),) MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR) endif ifndef ARDUINO_IDE_DIR - ARDUINO_IDE_DIR := $(shell basename $(basename $(basename $(lastword $(wildcard $(DEPENDENCIES_DIR)/arduino*))))) - # ARDUINO_IDE_DIR := arduino + ifeq ($(CURRENT_OS),MAC) + ARDUINO_IDE_DIR = Arduino.app/Contents/Resources/Java + else + ARDUINO_IDE_DIR := $(shell basename $(basename $(basename $(lastword $(wildcard $(DEPENDENCIES_DIR)/arduino*))))) + endif endif DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/$(ARDUINO_IDE_DIR) ifeq ($(ARDUINO_DIR),) -- cgit v1.2.3