2015-11-23 17:43:42 +01:00
|
|
|
UNDEF := $(BINDIR)newlib_syscalls_default/syscalls.o $(UNDEF)
|
2015-05-30 12:05:16 +02:00
|
|
|
|
|
|
|
# Search for Newlib include directories
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# headers instead of Linux/Glibc headers.)
|
|
|
|
# On GCC this is done when building the cross compiler toolchain so we do not
|
|
|
|
# actually need to specify the include paths for system includes.
|
|
|
|
# Ubuntu gcc-arm-embedded toolchain (https://launchpad.net/gcc-arm-embedded)
|
|
|
|
# places newlib headers in several places, but the primary source seem to be
|
|
|
|
# /etc/alternatives/gcc-arm-none-eabi-include
|
|
|
|
# Gentoo Linux crossdev place the newlib headers in /usr/arm-none-eabi/include
|
|
|
|
# Arch Linux also place the newlib headers in /usr/arm-none-eabi/include
|
|
|
|
# Ubuntu seem to put a copy of the newlib headers in the same place as
|
|
|
|
# Gentoo crossdev, but we prefer to look at /etc/alternatives first.
|
|
|
|
# On OSX, newlib includes are possibly located in
|
|
|
|
# /usr/local/opt/arm-none-eabi*/arm-none-eabi/include
|
|
|
|
NEWLIB_INCLUDE_PATTERNS ?= \
|
|
|
|
/etc/alternatives/gcc-$(TARGET_TRIPLE)-include \
|
|
|
|
/usr/$(TARGET_TRIPLE)/include \
|
|
|
|
/usr/local/opt/$(TARGET_TRIPLE)*/$(TARGET_TRIPLE)/include \
|
|
|
|
#
|
|
|
|
# Use the wildcard Makefile function to search for existing directories matching
|
|
|
|
# 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
|
|
|
|
# searched until after all the project specific include directories (-I/path)
|
|
|
|
NEWLIB_INCLUDES ?= \
|
|
|
|
$(foreach dir, \
|
|
|
|
$(foreach pat, $(NEWLIB_INCLUDE_PATTERNS), $(wildcard $(pat))), \
|
|
|
|
-isystem $(dir))
|
|
|
|
|
2016-01-19 14:45:21 +01:00
|
|
|
# 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
|
|
|
|
ifeq (,$(NEWLIB_INCLUDES))
|
|
|
|
NEWLIB_INCLUDES := $(addprefix -isystem ,$(wildcard $(dir $(shell which $(PREFIX)gcc))../$(TARGET_TRIPLE)/include))
|
|
|
|
endif
|
|
|
|
|
2016-01-21 08:28:39 +01:00
|
|
|
# Newlib includes should go before GCC includes.
|
|
|
|
export INCLUDES := $(NEWLIB_INCLUDES) $(INCLUDES)
|