From d28ee9a25ed504ebf4cdbfc13b6aed00ea766cc9 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 4 Jan 2017 12:36:59 +1100 Subject: [PATCH] build system: Account for Windows behaviour of make wildcard for some dirs See github #166 --- make/project.mk | 15 ++++++++++++--- tools/windows/eclipse_make.sh | 5 +++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/make/project.mk b/make/project.mk index 02ef7bb174..04015a8a8c 100644 --- a/make/project.mk +++ b/make/project.mk @@ -49,14 +49,23 @@ endif # make IDF_PATH a "real" absolute path # * works around the case where a shell character is embedded in the environment variable value. # * changes Windows-style C:/blah/ paths to MSYS/Cygwin style /c/blah -export IDF_PATH:=$(realpath $(wildcard $(IDF_PATH))) +ifeq ("$(OS)","Windows_NT") +# On Windows MSYS2, make wildcard function returns empty string for paths of form /xyz +# where /xyz is a directory inside the MSYS root - so we don't use it. +SANITISED_IDF_PATH:=$(realpath $(IDF_PATH)) +else +SANITISED_IDF_PATH:=$(realpath $(wildcard $(IDF_PATH))) +endif + +export IDF_PATH := $(SANITISED_IDF_PATH) ifndef IDF_PATH $(error IDF_PATH variable is not set to a valid directory.) endif -ifneq ("$(IDF_PATH)","$(realpath $(wildcard $(IDF_PATH)))") -# due to the way make manages variables, this is hard to account for +ifneq ("$(IDF_PATH)","$(SANITISED_IDF_PATH)") +# implies IDF_PATH was overriden on make command line. +# Due to the way make manages variables, this is hard to account for # # if you see this error, do the shell expansion in the shell ie # make IDF_PATH=~/blah not make IDF_PATH="~/blah" diff --git a/tools/windows/eclipse_make.sh b/tools/windows/eclipse_make.sh index 200d798ffa..848705fba4 100755 --- a/tools/windows/eclipse_make.sh +++ b/tools/windows/eclipse_make.sh @@ -4,6 +4,7 @@ # Eclipse's output parser expects to see output of the form C:/dir/dir/file but our Make # process uses MinGW paths of the form /c/dir/dir/file. So parse these out... # -# (regexp deliberate only matches after a space character to try and avoid false-positives.) +# A little hacky as it looks for any single character of form /X/something. +# echo "Running make in $(pwd)" -make $@ V=1 | sed -E "s@ /([a-z])/(.+)/@ \1:/\2/@g" | sed -E "s@-I/([a-z])/(.+)/@-I\1:/\2/@g" | sed -E "s@-L/([a-z])/(.+)/@-L\1:/\2/@g" +make $@ V=1 | sed -E "s@/([a-z])/([^/+])@\1:/\2@g"