tools/Makefile.host: Fix several errors for native build

1. Can't pipe uname stderr output to /dev/null.  /dev/null does not exist in the Windows native enviornment.
2. Don't test if CONFIG_WINDOWS_NATIVE is defined.  Tht leads to a "chicken'n'egg" problem:  We need to build configure.c in order to configure the system, but we can't get the CONFIG_WINDOWS_NATIVE until after the system is configured.
3. The default name of the MinGW GCC compiler is mingw32-gcc.exe, not mingw-gcc.exe
This commit is contained in:
Gregory Nutt 2020-01-17 12:47:05 -06:00 committed by Alan Carvalho de Assis
parent 3e230ca9eb
commit 8b884a027f

View File

@ -43,18 +43,18 @@ include ${TOPDIR}/tools/Config.mk
# 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
HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"}
HOSTOS = ${shell uname -o || echo "Other"}
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
ifeq ($(HOSTOS),MinGW)
# In the Windows native environment, the MinGW GCC compiler is assumed
# In the Windows native environment, the MinGW GCC compiler is used
HOSTCC ?= mingw-gcc.exe
HOSTCC ?= mingw32-gcc.exe
HOSTCFLAGS ?= -O2 -Wall -Wstrict-prototypes -Wshadow -I. -DCONFIG_WINDOWS_NATIVE=y
else
# GCC is assumed in the POSIX environment (Linux or Cygwin).
# GCC is assumed in all other POSIX environments (Linux, Cygwin, MSYS2).
# strtok_r is used in some tools, but does not seem to be available in
# the MinGW environment.