diff --git a/sys/newlib/Makefile.include b/sys/newlib/Makefile.include index 5e425fc67f463bb5cd7be7aa2cdb98e6a6f1db0c..94e526e0db23a429cc451b8a5657610962b0def3 100644 --- a/sys/newlib/Makefile.include +++ b/sys/newlib/Makefile.include @@ -17,7 +17,6 @@ endif export LINKFLAGS += -lc -lnosys -ifeq (1,$(USE_NEWLIB_NANO)) # Search for Newlib include directories # Since Clang is not installed as a separate instance for each crossdev target @@ -51,10 +50,14 @@ NEWLIB_INCLUDE_DIR ?= $(firstword $(wildcard $(NEWLIB_INCLUDE_PATTERNS))) ifeq (,$(NEWLIB_INCLUDE_DIR)) NEWLIB_INCLUDE_DIR := $(abspath $(wildcard $(dir $(shell which $(PREFIX)gcc))../$(TARGET_ARCH)/include)) endif + +NEWLIB_INCLUDES := -isystem $(NEWLIB_INCLUDE_DIR) + +ifeq (1,$(USE_NEWLIB_NANO)) NEWLIB_NANO_INCLUDE_DIR ?= $(NEWLIB_INCLUDE_DIR)/nano # newlib-nano overrides newlib.h and its include dir should therefore go before # the regular newlib include dir. - NEWLIB_INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) + NEWLIB_INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) $(NEWLIB_INCLUDES) endif # Newlib includes should go before GCC includes.