mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/Makefile.include.llvm: Use libstdc++ headers for C++ support
This commit is contained in:
parent
6deac1d64e
commit
e4ad8d6beb
@ -17,7 +17,39 @@ export DBG = $(GDBPREFIX)gdb
|
||||
# LLVM lacks a binutils strip tool as well...
|
||||
#export STRIP = $(LLVMPREFIX)strip
|
||||
|
||||
# Clang on Linux uses GCC's C++ headers and libstdc++ (installed with GCC)
|
||||
# Ubuntu and Debian use /etc/alternatives/gcc-$(TARGET_ARCH)-include/c++/$(GCC_VERSION)
|
||||
# Arch uses /usr/$(TARGET_ARCH)/include/c++/$(GCC_VERSION)
|
||||
# Gentoo uses /usr/lib/gcc/$(TARGET_ARCH)/$(GCC_VERSION)/include/g++-v5
|
||||
GCC_CXX_INCLUDE_PATTERNS ?= \
|
||||
/etc/alternatives/gcc-$(TARGET_ARCH)-include/c++/*/ \
|
||||
/usr/$(TARGET_ARCH)/include/c++/*/ \
|
||||
/usr/lib/gcc/$(TARGET_ARCH)/*/include/g++-v5 \
|
||||
#
|
||||
|
||||
# Try to find the proper multilib directory using GCC, this may fail if a cross-
|
||||
# GCC is not installed.
|
||||
ifeq ($(GCC_MULTI_DIR),)
|
||||
GCC_MULTI_DIR := $(shell $(PREFIX)gcc -print-multi-directory $(CFLAGS) 2>/dev/null)
|
||||
endif
|
||||
|
||||
# Tell clang to cross compile
|
||||
export CFLAGS += -target $(TARGET_ARCH)
|
||||
export CXXFLAGS += -target $(TARGET_ARCH)
|
||||
export LINKFLAGS += -target $(TARGET_ARCH)
|
||||
|
||||
# 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)
|
||||
# We sort the list of found directories and take the last one, it will likely be
|
||||
# the most recent GCC version. This avoids using old headers left over from
|
||||
# previous tool chain installations.
|
||||
GCC_CXX_INCLUDES ?= \
|
||||
$(addprefix \
|
||||
-isystem $(lastword $(sort \
|
||||
$(foreach pat, $(GCC_CXX_INCLUDE_PATTERNS), $(wildcard $(pat))))), \
|
||||
/. /$(TARGET_ARCH)/$(GCC_MULTI_DIR) /backward \
|
||||
)
|
||||
|
||||
export INCLUDES += $(GCC_CXX_INCLUDES)
|
||||
|
Loading…
Reference in New Issue
Block a user