tools:fix build error of incdir in Windows native build

This commit is contained in:
zouboan 2022-11-05 18:10:18 +08:00 committed by Xiang Xiao
parent c8e4adad9f
commit def151869f
2 changed files with 11 additions and 7 deletions

View File

@ -62,7 +62,7 @@ endif
# Define HOSTCC on the make command line if it differs from these defaults # 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 # 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 # In the Windows native environment, the MinGW GCC compiler is used

View File

@ -21,8 +21,10 @@
/**************************************************************************** /****************************************************************************
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_WINDOWS_NATIVE
#include <sys/utsname.h> #include <sys/utsname.h>
#endif
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.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) static enum os_e get_os(char *ccname)
{ {
struct utsname buf; #ifdef CONFIG_WINDOWS_NATIVE
int ret;
/* Check for MinGW which implies a Windows native environment */ /* Check for MinGW which implies a Windows native environment */
if (strstr(ccname, "mingw") != NULL) if (strstr(ccname, "mingw") != NULL)
{ {
return OS_WINDOWS; return OS_WINDOWS;
} }
#else
struct utsname buf;
int ret;
/* Get the context names */ /* Get the context names */
ret = uname(&buf); ret = uname(&buf);
@ -165,8 +168,9 @@ static enum os_e get_os(char *ccname)
{ {
fprintf(stderr, "ERROR: Unknown operating system: %s\n", fprintf(stderr, "ERROR: Unknown operating system: %s\n",
buf.sysname); buf.sysname);
return OS_UNKNOWN;
} }
#endif
return OS_UNKNOWN;
} }
static enum compiler_e get_compiler(char *ccname, enum os_e os) static enum compiler_e get_compiler(char *ccname, enum os_e os)