newlib: include fixes for newlib-nano
This commit is contained in:
parent
42c4460daf
commit
db6cb1ac65
@ -21,6 +21,13 @@ export LINKFLAGS += -lc
|
|||||||
|
|
||||||
# Search for Newlib include directories
|
# Search for Newlib include directories
|
||||||
|
|
||||||
|
# Try to search for newlib in the standard search path of the compiler for includes
|
||||||
|
ifeq (,$(NEWLIB_INCLUDE_DIR))
|
||||||
|
COMPILER_INCLUDE_PATHS := $(shell $(PREFIX)gcc -v -x c -E /dev/null 2>&1 | grep '^\s' | tr -d '\n')
|
||||||
|
NEWLIB_INCLUDE_DIR := $(firstword $(dir $(wildcard $(addsuffix /newlib.h, $(COMPILER_INCLUDE_PATHS)))))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (,$(NEWLIB_INCLUDE_DIR))
|
||||||
# Since Clang is not installed as a separate instance for each crossdev target
|
# Since Clang is not installed as a separate instance for each crossdev target
|
||||||
# we need to tell it where to look for platform specific includes (Newlib
|
# we need to tell it where to look for platform specific includes (Newlib
|
||||||
# headers instead of Linux/Glibc headers.)
|
# headers instead of Linux/Glibc headers.)
|
||||||
@ -45,7 +52,8 @@ NEWLIB_INCLUDE_PATTERNS ?= \
|
|||||||
# the patterns above. We use the -isystem gcc/clang argument to add the include
|
# the patterns above. We use the -isystem gcc/clang argument to add the include
|
||||||
# directories as system include directories, which means they will not be
|
# directories as system include directories, which means they will not be
|
||||||
# searched until after all the project specific include directories (-I/path)
|
# searched until after all the project specific include directories (-I/path)
|
||||||
NEWLIB_INCLUDE_DIR ?= $(firstword $(wildcard $(NEWLIB_INCLUDE_PATTERNS)))
|
NEWLIB_INCLUDE_DIR ?= $(firstword $(dir $(wildcard $(addsuffix /newlib.h, $(NEWLIB_INCLUDE_PATTERNS)))))
|
||||||
|
endif
|
||||||
|
|
||||||
# If nothing was found we will try to fall back to searching for a cross-gcc in
|
# If nothing was found we will try to fall back to searching for a cross-gcc in
|
||||||
# the current PATH and use a relative path for the includes
|
# the current PATH and use a relative path for the includes
|
||||||
@ -64,7 +72,9 @@ ifeq ($(TOOLCHAIN),llvm)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (1,$(USE_NEWLIB_NANO))
|
ifeq (1,$(USE_NEWLIB_NANO))
|
||||||
NEWLIB_NANO_INCLUDE_DIR ?= $(NEWLIB_INCLUDE_DIR)/newlib-nano
|
NEWLIB_NANO_INCLUDE_DIR ?= $(firstword $(wildcard $(NEWLIB_INCLUDE_DIR)newlib-nano \
|
||||||
|
$(NEWLIB_INCLUDE_DIR)newlib/nano \
|
||||||
|
$(NEWLIB_INCLUDE_DIR)nano))
|
||||||
# newlib-nano overrides newlib.h and its include dir should therefore go before
|
# newlib-nano overrides newlib.h and its include dir should therefore go before
|
||||||
# the regular system include dirs.
|
# the regular system include dirs.
|
||||||
INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) $(INCLUDES)
|
INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) $(INCLUDES)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user