Fix NuttX build under Cygwin

after NuttX 9.1.0+ upgrade #15139
This commit is contained in:
Matthias Grob 2020-10-23 14:48:45 +02:00 committed by David Sidrane
parent d8a03d04a7
commit 4378254182
1 changed files with 30 additions and 9 deletions

View File

@ -33,19 +33,45 @@
#
############################################################################
# Set flags for the NuttX build system for Cygwin
# They are already used by Config.mk
ifneq (, $(findstring CYGWIN, $(shell uname)))
CONFIG_HOST_CYGWIN := y
CONFIG_WINDOWS_CYGWIN := y
CONFIG_CYGWIN_WINTOOL := y
endif
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
# Replace each space separated word in the string that contains "cygdrive"
# with the windows path and escaped backslashes
# e.g. [hello -I /cygdrive/c -I/cygdrive/c] -> [hello -I C:\\ ]
define cygwin_to_windows_paths
$(subst \,\\,$(foreach word,$(1),$(shell \
if [[ "$(word)" == *"cygdrive"* ]]; then \
cygpath -w "$(word)"; \
else \
echo $(word); \
fi \
)))
endef
CINCPATH := $(shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include)
CXXINCPATH := $(shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include$(DELIM)cxx)
ARCHINCLUDES += $(CINCPATH)
ARCHXXINCLUDES += $(CINCPATH) $(CXXINCPATH)
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.ld
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "$(shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.ld)"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.ld
ifeq ($(CONFIG_BOARD_USE_PROBES),y)
ARCHINCLUDES += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src/$(CONFIG_ARCH_CHIP) -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src/common
ARCHXXINCLUDES += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src/$(CONFIG_ARCH_CHIP) -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src/common
endif
ifneq (, $(findstring CYGWIN, $(shell uname)))
ARCHINCLUDES := $(call cygwin_to_windows_paths,$(ARCHINCLUDES))
ARCHXXINCLUDES := $(call cygwin_to_windows_paths,$(ARCHXXINCLUDES))
endif
CC = ${CMAKE_C_COMPILER}
@ -61,11 +87,6 @@ OBJDUMP = ${CMAKE_OBJDUMP}
ARCHCCVERSION = $(shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q')
ARCHCCMAJOR = $(shell echo $(ARCHCCVERSION) | cut -d'.' -f1)
ifeq ($(CONFIG_BOARD_USE_PROBES),y)
ARCHINCLUDES += -I$(TOPDIR)/arch/$(CONFIG_ARCH)/src/$(CONFIG_ARCH_CHIP) -I$(TOPDIR)/arch/$(CONFIG_ARCH)/src/common
ARCHXXINCLUDES += -I$(TOPDIR)/arch/$(CONFIG_ARCH)/src/$(CONFIG_ARCH_CHIP) -I$(TOPDIR)/arch/$(CONFIG_ARCH)/src/common
endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
MAXOPTIMIZATION = $(CONFIG_DEBUG_OPTLEVEL)
else