You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/05/21 16:43:51 UTC

[incubator-nuttx-apps] 02/02: build: Replace all -I to INCDIR

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit ea135b89c69b083dd5fa39e71938a8809c263f2c
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed May 20 16:29:35 2020 +0800

    build: Replace all -I to INCDIR
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 canutils/libcanard/Makefile           |  3 ++-
 examples/canard/Makefile              |  2 +-
 examples/elf/tests/struct/Makefile    |  2 --
 examples/embedlog/Makefile            |  1 -
 examples/embedlog/embedlog_main.c     | 16 ++++++++--------
 examples/ini_dumper/Makefile          |  1 -
 examples/ini_dumper/ini_dumper_main.c |  8 ++++----
 examples/nxflat/tests/struct/Makefile |  2 --
 examples/powermonitor/Makefile        |  2 --
 examples/pty_test/Makefile            |  1 -
 import/Make.defs                      | 11 +++++------
 netutils/cjson/Makefile               |  3 ++-
 system/embedlog/Makefile              |  2 +-
 system/psmq/Makefile                  |  4 ++--
 testing/unity/Makefile                |  3 ++-
 15 files changed, 27 insertions(+), 34 deletions(-)

diff --git a/canutils/libcanard/Makefile b/canutils/libcanard/Makefile
index 40ab403..984015a 100644
--- a/canutils/libcanard/Makefile
+++ b/canutils/libcanard/Makefile
@@ -48,7 +48,8 @@ LIBCANARD_DRVDIR = $(LIBCANARD_SRCDIR)$(DELIM)drivers$(DELIM)nuttx
 
 APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)canutils
 
-CFLAGS += -std=c99 -I$(APPS_INCDIR) -DCANARD_ASSERT=DEBUGASSERT
+CFLAGS += -std=c99 -DCANARD_ASSERT=DEBUGASSERT
+CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPS_INCDIR)}
 
 CSRCS = $(LIBCANARD_SRCDIR)$(DELIM)canard.c $(LIBCANARD_DRVDIR)$(DELIM)canard_nuttx.c
 
diff --git a/examples/canard/Makefile b/examples/canard/Makefile
index d46a85f..cdee49d 100644
--- a/examples/canard/Makefile
+++ b/examples/canard/Makefile
@@ -40,7 +40,7 @@ PRIORITY = SCHED_PRIORITY_DEFAULT
 STACKSIZE = $(CONFIG_EXAMPLES_LIBCANARD_STACKSIZE)
 MODULE = $(CONFIG_EXAMPLES_LIBCANARD)
 
-CFLAGS += -I$(APPDIR)/include/canutils
+CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)/include/canutils}
 MAINSRC = canard_main.c
 
 include $(APPDIR)/Application.mk
diff --git a/examples/elf/tests/struct/Makefile b/examples/elf/tests/struct/Makefile
index 3d398c5..d90e927 100644
--- a/examples/elf/tests/struct/Makefile
+++ b/examples/elf/tests/struct/Makefile
@@ -35,8 +35,6 @@
 
 include $(TOPDIR)/Make.defs
 
-CELFFLAGS += -I.
-
 ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
 NUTTXLIB = "${shell cygpath -w $(TOPDIR)$(DELIM)staging}"
 else
diff --git a/examples/embedlog/Makefile b/examples/embedlog/Makefile
index c9a4123..027c574 100644
--- a/examples/embedlog/Makefile
+++ b/examples/embedlog/Makefile
@@ -45,6 +45,5 @@ MODULE = $(CONFIG_EXAMPLES_EMBEDLOG)
 # embedlog Example
 
 MAINSRC = embedlog_main.c
-CFLAGS += -I$(APPDIR)/include/system
 
 include $(APPDIR)/Application.mk
diff --git a/examples/embedlog/embedlog_main.c b/examples/embedlog/embedlog_main.c
index 53d730a..2851151 100644
--- a/examples/embedlog/embedlog_main.c
+++ b/examples/embedlog/embedlog_main.c
@@ -37,7 +37,7 @@
  * Included Files
  ****************************************************************************/
 
-#include <embedlog.h>
+#include <system/embedlog.h>
 #include <errno.h>
 #include <nuttx/config.h>
 #include <stdio.h>
@@ -80,7 +80,7 @@ static struct el_options g_el;
  *
  * Description:
  *   Presents how to use options and how it's rendered. This assumes all
- *   options are enabled in compile time. If any of the options is not enabled
+ *   options are enabled in compile time. If any of the options isn't enabled
  *   in compile time, setting it will have no effect and logs will vary.
  *
  * Input Parameters:
@@ -284,7 +284,7 @@ static void el_print_file(const char *workdir)
     {
       if (errno == ENAMETOOLONG || errno == EINVAL)
         {
-          /* These are the only unrecoverable errors that embedlog may return,
+          /* These are the only unrecoverable errors embedlog may return,
            * any other error it actually a warning, telling user that file
            * could not have been opened now, but every el_print function with
            * output to file enabled, will try to reopen file. This of course
@@ -305,9 +305,9 @@ static void el_print_file(const char *workdir)
 
   el_oprint(OELI, "Now we enabled log rotation");
   el_oprint(OELI, "If log cannot fit in current file");
-  el_oprint(OELI, "it will be stored in new file");
-  el_oprint(OELI, "and if library creates EL_FROTATE_NUMBER files");
-  el_oprint(OELI, "oldest file will be deleted and new file will be created");
+  el_oprint(OELI, "it will be stored in new file and");
+  el_oprint(OELI, "if library creates EL_FROTATE_NUMBER files oldest");
+  el_oprint(OELI, "file will be deleted and new file will be created");
   el_oprint(OELI, "run this program multiple times and see how it works");
 }
 
@@ -331,8 +331,8 @@ int main(int argc, FAR char *argv[])
 
   el_oinit(&g_el);
 
-  el_oprint(OELI, "Right after init, embedlog will print to stderr with just "
-      "log level information - these are default settings.");
+  el_oprint(OELI, "Right after init, embedlog will print to stderr with "
+      "just log level information - these are default settings.");
 
   el_print_options();
   el_print_memory();
diff --git a/examples/ini_dumper/Makefile b/examples/ini_dumper/Makefile
index 877feff..b95c223 100644
--- a/examples/ini_dumper/Makefile
+++ b/examples/ini_dumper/Makefile
@@ -45,7 +45,6 @@ MODULE = $(CONFIG_EXAMPLES_INI_DUMPER)
 # ini_dumper Example
 
 MAINSRC = ini_dumper_main.c
-CFLAGS += -I$(APPDIR)/include/fsutils
 
 # needed to make compiler happy about wrong function pointers
 # different function pointer is used depending on that define
diff --git a/examples/ini_dumper/ini_dumper_main.c b/examples/ini_dumper/ini_dumper_main.c
index db90100..b1e9fc5 100644
--- a/examples/ini_dumper/ini_dumper_main.c
+++ b/examples/ini_dumper/ini_dumper_main.c
@@ -41,7 +41,7 @@
 
 #include <stdio.h>
 
-#include "fsutils/ini.h"
+#include <fsutils/ini.h>
 
 /****************************************************************************
  * Private Functions
@@ -83,12 +83,12 @@ int main(int argc, FAR char *argv[])
       return 1;
     }
 
-  printf("\n------ --------------- ------------- ---------------------------\n");
+  printf("------ --------------- ------------- -------------------------\n");
   printf(" line      section          key                 value\n");
-  printf("------ --------------- ------------- ---------------------------\n");
+  printf("------ --------------- ------------- -------------------------\n");
 
   ret = ini_parse(argv[1], ini_dump, NULL);
-  printf("------ --------------- ------------- ---------------------------\n");
+  printf("------ --------------- ------------- -------------------------\n");
   fprintf(stderr, "ini_parse() exited with %d\n", ret);
   return 0;
 }
diff --git a/examples/nxflat/tests/struct/Makefile b/examples/nxflat/tests/struct/Makefile
index 8188af7..b657cff 100644
--- a/examples/nxflat/tests/struct/Makefile
+++ b/examples/nxflat/tests/struct/Makefile
@@ -35,8 +35,6 @@
 
 include $(TOPDIR)/Make.defs
 
-CFLAGS			+= -I.
-
 BIN			= struct
 
 R1SRCS			= struct_main.c struct_dummy.c
diff --git a/examples/powermonitor/Makefile b/examples/powermonitor/Makefile
index 68dc417..9203430 100644
--- a/examples/powermonitor/Makefile
+++ b/examples/powermonitor/Makefile
@@ -41,6 +41,4 @@ MODULE = $(CONFIG_EXAMPLES_POWERMONITOR)
 
 MAINSRC = powermonitor_main.c
 
-CFLAGS += -I../../../nuttx/arch/arm/src -I../../../nuttx/arch/arm/src/common
-
 include $(APPDIR)/Application.mk
diff --git a/examples/pty_test/Makefile b/examples/pty_test/Makefile
index a0e5a2f..1c66823 100644
--- a/examples/pty_test/Makefile
+++ b/examples/pty_test/Makefile
@@ -44,7 +44,6 @@ MODULE = $(CONFIG_EXAMPLES_PTYTEST)
 
 # PTY Test! Example
 
-CFLAGS += -I$(APPDIR)/include
 MAINSRC = pty_test.c
 
 include $(APPDIR)/Application.mk
diff --git a/import/Make.defs b/import/Make.defs
index 7764b0a..4a87383 100644
--- a/import/Make.defs
+++ b/import/Make.defs
@@ -41,17 +41,16 @@ include $(TOPDIR)/scripts/Make.defs
 # Compiler
 
 ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
-  # Windows-native toolchains
-  ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}"
-  ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include$(DELIM)cxx}"
   ARCHCRT0OBJ = "${shell cygpath -w $(TOPDIR)$(DELIM)startup$(DELIM)crt0$(OBJEXT)}"
 else
-  # Linux/Cygwin-native toolchain
-  ARCHINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include
-  ARCHXXINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include -isystem $(TOPDIR)$(DELIM)include$(DELIM)cxx
   ARCHCRT0OBJ = $(TOPDIR)$(DELIM)startup$(DELIM)crt0$(OBJEXT)
 endif
 
+ARCHINCLUDES += ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include}
+
+ARCHXXINCLUDES += ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include}
+ARCHXXINCLUDES += ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include$(DELIM)cxx}
+
 ARCHCFLAGS += -fno-common -pipe
 ARCHCXXFLAGS += -fno-common -pipe
 
diff --git a/netutils/cjson/Makefile b/netutils/cjson/Makefile
index 9f68f46..755f411 100644
--- a/netutils/cjson/Makefile
+++ b/netutils/cjson/Makefile
@@ -56,7 +56,8 @@ CJSON_SRCDIR = $(CJSON_UNPACKNAME)
 
 APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)netutils
 
-CFLAGS += -I$(APPS_INCDIR) -DCJSON_INCLUDE_CONFIG_H
+CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPS_INCDIR)}
+CFLAGS += -DCJSON_INCLUDE_CONFIG_H
 
 CSRCS = $(CJSON_SRCDIR)$(DELIM)cJSON.c
 CSRCS += $(CJSON_SRCDIR)$(DELIM)cJSON_Utils.c
diff --git a/system/embedlog/Makefile b/system/embedlog/Makefile
index b2aae52..ad9eefe 100644
--- a/system/embedlog/Makefile
+++ b/system/embedlog/Makefile
@@ -48,7 +48,7 @@ EMBEDLOG_EXT = tar.gz
 EMBEDLOG_SOURCES = embedlog-$(EMBEDLOG_VERSION)
 EMBEDLOG_TARBALL = $(EMBEDLOG_SOURCES).$(EMBEDLOG_EXT)
 
-CFLAGS += -I$(APPDIR)/include/system
+CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)$(DELIM)include$(DELIM)system}
 
 CSRCS = embedlog/src/el-options.c \
 	embedlog/src/el-perror.c \
diff --git a/system/psmq/Makefile b/system/psmq/Makefile
index 2804439..bae3c3d 100644
--- a/system/psmq/Makefile
+++ b/system/psmq/Makefile
@@ -48,8 +48,8 @@ PSMQ_EXT = tar.gz
 PSMQ_SOURCES = psmq-$(PSMQ_VERSION)
 PSMQ_TARBALL = $(PSMQ_SOURCES).$(PSMQ_EXT)
 
-CFLAGS += -I$(APPDIR)/include/system
-CFLAGS += -I$(APPDIR)/system/psmq/$(PSMQ_SOURCES)
+CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)$(DELIM)include$(DELIM)system}
+CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)$(DELIM)system$(DELIM)psmq$(DELIM)$(PSMQ_SOURCES)}
 
 # mandatory source files to compile
 CSRCS = $(PSMQ_SOURCES)/lib/psmq.c \
diff --git a/testing/unity/Makefile b/testing/unity/Makefile
index 2bd0d2d..a7c4209 100644
--- a/testing/unity/Makefile
+++ b/testing/unity/Makefile
@@ -56,7 +56,8 @@ UNITY_SRCDIR = $(UNITY_UNPACKNAME)$(DELIM)src
 
 APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)testing
 
-CFLAGS += -I$(APPS_INCDIR) -DUNITY_INCLUDE_CONFIG_H
+CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPS_INCDIR)}
+CFLAGS += -DUNITY_INCLUDE_CONFIG_H
 
 CSRCS = $(UNITY_SRCDIR)$(DELIM)unity.c