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 def151869f44138cb183d96f204475a7dded0933 Author: zouboan <[email protected]> AuthorDate: Sat Nov 5 18:10:18 2022 +0800 tools:fix build error of incdir in Windows native build --- tools/Config.mk | 2 +- tools/incdir.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/Config.mk b/tools/Config.mk index e05c85fa81..2466f1fbde 100644 --- a/tools/Config.mk +++ b/tools/Config.mk @@ -62,7 +62,7 @@ endif # Define HOSTCC on the make command line if it differs from these defaults # Define HOSTCFLAGS with -g on the make command line to build debug versions -ifeq ($(CONFIG_WINDOWS_MSYS),y) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) # In the Windows native environment, the MinGW GCC compiler is used diff --git a/tools/incdir.c b/tools/incdir.c index 585aa25599..b02269396f 100644 --- a/tools/incdir.c +++ b/tools/incdir.c @@ -21,8 +21,10 @@ /**************************************************************************** * Included Files ****************************************************************************/ - +#ifndef CONFIG_WINDOWS_NATIVE #include <sys/utsname.h> +#endif + #include <stdbool.h> #include <stdlib.h> #include <stdarg.h> @@ -115,16 +117,17 @@ static void show_help(const char *progname, int exitcode) static enum os_e get_os(char *ccname) { - struct utsname buf; - int ret; - +#ifdef CONFIG_WINDOWS_NATIVE /* Check for MinGW which implies a Windows native environment */ if (strstr(ccname, "mingw") != NULL) { return OS_WINDOWS; } - +#else + struct utsname buf; + int ret; + /* Get the context names */ ret = uname(&buf); @@ -165,8 +168,9 @@ static enum os_e get_os(char *ccname) { fprintf(stderr, "ERROR: Unknown operating system: %s\n", buf.sysname); - return OS_UNKNOWN; } +#endif + return OS_UNKNOWN; } static enum compiler_e get_compiler(char *ccname, enum os_e os)
