From 11ef5ac1b3199c8b8fa9fea04f93e93c14f6b3ba Mon Sep 17 00:00:00 2001
From: Gregory Nutt <gnutt@nuttx.org>
Date: Thu, 21 Jul 2016 11:35:13 -0600
Subject: [PATCH] (1) Make.defs set the include path in CFLAGS, but not in
 CXXFLAGS, (2) canutils/libuavcan/Makefile should not use explication /
 delimiters.  It should not use -I.  I should use DELIM: command not found and
 nuttx/tools/incdir.sh

---
 Make.defs                   |  4 +++-
 canutils/libuavcan/Makefile | 14 ++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Make.defs b/Make.defs
index 866d1eb46..52436ce9a 100644
--- a/Make.defs
+++ b/Make.defs
@@ -70,4 +70,6 @@ endif
 
 # Standard include path
 
-CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"}
+CFLAGS   += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"}
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"}
+
diff --git a/canutils/libuavcan/Makefile b/canutils/libuavcan/Makefile
index b1d52eac7..a910b2d8f 100644
--- a/canutils/libuavcan/Makefile
+++ b/canutils/libuavcan/Makefile
@@ -35,7 +35,7 @@
 
 -include $(TOPDIR)/.config
 -include $(TOPDIR)/Make.defs
-include $(APPDIR)/Make.defs
+include $(APPDIR)$(DELIM)Make.defs
 
 WGET = wget
 UNPACK = unzip
@@ -59,14 +59,16 @@ PYUAVCAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBUAVCAN_PYUAVCAN_VERSION)
 PYUAVCAN_UNPACKNAME = pyuavcan-$(PYUAVCAN_VERSION)
 PYUAVCAN_PACKNAME = $(PYUAVCAN_UNPACKNAME)$(PACKEXT)
 
--include libuavcan/libuavcan/include.mk
--include libuavcan/libuavcan_drivers/stm32/driver/include.mk
+-include libuavcan$(DELIM)libuavcan$(DELIM)include.mk
+-include libuavcan$(DELIM)libuavcan_drivers$(DELIM)stm32$(DELIM)driver$(DELIM)include.mk
 
 CXXSRCS = platform_stm32.cpp $(LIBUAVCAN_SRC) $(LIBUAVCAN_STM32_SRC)
 
-CXXFLAGS += -I$(LIBUAVCAN_INC) -I$(LIBUAVCAN_STM32_INC) -Idsdlc_generated
-CXXFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)common
-CXXFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)stm32
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(LIBUAVCAN_INC)"}
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(LIBUAVCAN_STM32_INC)"}
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" dsdlc_generated}
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(TOPDIR)$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)common"}
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(TOPDIR)$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)stm32"}
 
 CXXFLAGS += -D__KERNEL__
 CXXFLAGS += -DUAVCAN_STM32_NUTTX=1