build system: Fix Windows case when IDF_PATH contains colons (ie C:/)

Closes github #166 https://github.com/espressif/esp-idf/issues/166
This commit is contained in:
Angus Gratton
2016-12-22 10:31:20 +11:00
parent 9d8e110202
commit de8ecdd3c1

View File

@@ -44,15 +44,16 @@ $(warning "esp-idf build system only supports GNU Make versions 3.81 or newer. Y
endif endif
endif endif
# make IDF_PATH an absolute path # make IDF_PATH a "real" absolute path
# (works around the case where a shell character is embedded in the environment variable value.) # * works around the case where a shell character is embedded in the environment variable value.
export IDF_PATH:=$(wildcard $(IDF_PATH)) # * changes Windows-style C:/blah/ paths to MSYS/Cygwin style /c/blah
export IDF_PATH:=$(realpath $(wildcard $(IDF_PATH)))
ifndef IDF_PATH ifndef IDF_PATH
$(error IDF_PATH variable is not set to a valid directory.) $(error IDF_PATH variable is not set to a valid directory.)
endif endif
ifneq ("$(IDF_PATH)","$(wildcard $(IDF_PATH))") ifneq ("$(IDF_PATH)","$(realpath $(wildcard $(IDF_PATH)))")
# due to the way make manages variables, this is hard to account for # 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 # if you see this error, do the shell expansion in the shell ie
@@ -60,6 +61,10 @@ ifneq ("$(IDF_PATH)","$(wildcard $(IDF_PATH))")
$(error If IDF_PATH is overriden on command line, it must be an absolute path with no embedded shell special characters) $(error If IDF_PATH is overriden on command line, it must be an absolute path with no embedded shell special characters)
endif endif
ifneq ("$(IDF_PATH)","$(subst :,,$(IDF_PATH))")
$(error IDF_PATH cannot contain colons. If overriding IDF_PATH on Windows, use Cygwin-style /c/dir instead of C:/dir)
endif
# disable built-in make rules, makes debugging saner # disable built-in make rules, makes debugging saner
MAKEFLAGS_OLD := $(MAKEFLAGS) MAKEFLAGS_OLD := $(MAKEFLAGS)
MAKEFLAGS +=-rR MAKEFLAGS +=-rR