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

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

commit 12f57bd9b2f552ff6877da210c406110a7e4b02c
Author: zouboan <[email protected]>
AuthorDate: Sat Nov 5 18:19:01 2022 +0800

    tools:fix some error use of shell command in Windows native build
---
 Makefile       | 7 -------
 tools/Unix.mk  | 7 +++++++
 tools/Win.mk   | 9 ++++++++-
 tools/incdir.c | 3 ++-
 4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index d457d3b893..58ab2ab464 100644
--- a/Makefile
+++ b/Makefile
@@ -30,13 +30,6 @@ ifeq ($(wildcard .config),)
 else
 include .config
 
-# Build any necessary tools needed early in the build.
-# incdir - Is needed immediately by all Make.defs file.
-
-TOPDIR := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
-DUMMY  := ${shell $(MAKE) -C tools -f Makefile.host incdir \
-          INCDIR="$(TOPDIR)/tools/incdir.sh"}
-
 # Include the correct Makefile for the selected architecture.
 
 ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/tools/Unix.mk b/tools/Unix.mk
index 9660e0cc31..a7e03a22a0 100644
--- a/tools/Unix.mk
+++ b/tools/Unix.mk
@@ -19,6 +19,13 @@
 ############################################################################
 
 export TOPDIR := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
+
+# Build any necessary tools needed early in the build.
+# incdir - Is needed immediately by all Make.defs file.
+
+DUMMY  := ${shell $(MAKE) -C tools -f Makefile.host incdir \
+          INCDIR="$(TOPDIR)/tools/incdir.sh"}
+
 include $(TOPDIR)/Make.defs
 
 # GIT directory present
diff --git a/tools/Win.mk b/tools/Win.mk
index 857246f7fe..4cc65d3c59 100644
--- a/tools/Win.mk
+++ b/tools/Win.mk
@@ -21,6 +21,13 @@
 export SHELL=cmd
 
 export TOPDIR := ${shell echo %CD%}
+
+# Build any necessary tools needed early in the build.
+# incdir - Is needed immediately by all Make.defs file.
+
+DUMMY  := ${shell $(MAKE) -C tools -f Makefile.host incdir \
+          INCDIR="$(TOPDIR)\tools\incdir.bat"}
+
 include $(TOPDIR)\Make.defs
 -include $(TOPDIR)\.version
 
@@ -53,7 +60,7 @@ APPDIR := $(realpath ${shell if exist 
"$(CONFIG_APPS_DIR)\Makefile" echo $(CONFI
 # so that main Kconfig can find it. Otherwise, we redirect it to a dummy 
Kconfig
 # This is due to kconfig inability to do conditional inclusion.
 
-EXTERNALDIR := $(shell if [ -r $(TOPDIR)\external\Kconfig ]; then echo 
'external'; else echo 'dummy'; fi)
+EXTERNALDIR := ${shell if exist "$(TOPDIR)\external\Kconfig" (echo external) 
else (echo dummy)}
 
 # CONTEXTDIRS include directories that have special, one-time pre-build
 #   requirements.  Normally this includes things like auto-generation of
diff --git a/tools/incdir.c b/tools/incdir.c
index b02269396f..c5d6afa207 100644
--- a/tools/incdir.c
+++ b/tools/incdir.c
@@ -127,7 +127,7 @@ static enum os_e get_os(char *ccname)
 #else
   struct utsname buf;
   int ret;
-  
+
   /* Get the context names */
 
   ret = uname(&buf);
@@ -169,6 +169,7 @@ static enum os_e get_os(char *ccname)
       fprintf(stderr, "ERROR:  Unknown operating system: %s\n",
               buf.sysname);
     }
+
 #endif
   return OS_UNKNOWN;
 }

Reply via email to