From 88aaa623641753c1b9eb164b9b1114e9c2c0700c Mon Sep 17 00:00:00 2001
From: Toon Stegen <tstegen@nalys-group.com>
Date: Fri, 4 May 2018 15:58:09 +0200
Subject: [PATCH] newlib-nano: add include directory

The newlib-nano include directory can be named either newlib-nano or
nano, so we should make sure it is added in both cases.
---
 makefiles/libc/newlib.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/makefiles/libc/newlib.mk b/makefiles/libc/newlib.mk
index d02b1a8fa0..5b9c305ba2 100644
--- a/makefiles/libc/newlib.mk
+++ b/makefiles/libc/newlib.mk
@@ -64,7 +64,8 @@ ifeq ($(TOOLCHAIN),llvm)
 endif
 
 ifeq (1,$(USE_NEWLIB_NANO))
-  NEWLIB_NANO_INCLUDE_DIR ?= $(NEWLIB_INCLUDE_DIR)/newlib-nano
+  # newlib-nano include directory is called either newlib-nano or nano. Use the one we find first.
+  NEWLIB_NANO_INCLUDE_DIR ?= $(firstword $(wildcard $(addprefix $(NEWLIB_INCLUDE_DIR)/, newlib-nano nano)))
   # newlib-nano overrides newlib.h and its include dir should therefore go before
   # the regular system include dirs.
   INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) $(INCLUDES)
-- 
GitLab