Fix Cygwin build with Windows native toolchain

PR #1450 broke the Cygwin build.  Refer to Issue #1672.

The use of of logic like:

    EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a}}"

fails when the Toolchain $(CC) is a native Windows toolchain.  That is because the returned path is a Windows-style patch which cannot be handled by the make 'dir' command.  Commit 4910d43ab0 reorganized a lot of definitions and replaced the correct code with the use of the limit make 'dir' command.  The original code used the Bash dirname command which does not suffer from this limitation; it can handle both POSIX and Windows paths.

This was verified using the stm32f4discover:nsh toolchain with the Windows native ARM Embedded toolchain.  That toolchain returns:

    arm-none-eabi-gcc --print-file-name=libgcc.a
    c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/libgcc.a
This commit is contained in:
Gregory Nutt 2020-08-31 12:35:21 -06:00 committed by Xiang Xiao
parent 91b52c38f9
commit 55a9172bc2
15 changed files with 45 additions and 45 deletions

View File

@ -98,14 +98,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}} EXTRA_LIBPATHS += -L ${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} EXTRA_LIBPATHS += -L ${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += lsupc++ EXTRA_LIBS += lsupc++
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}} EXTRA_LIBPATHS += -L ${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}
endif endif

View File

@ -93,14 +93,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -116,14 +116,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -153,14 +153,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -98,14 +98,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -141,14 +141,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -148,14 +148,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -66,14 +66,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -272,14 +272,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}} EXTRA_LIBPATHS += -L ${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} EXTRA_LIBPATHS += -L ${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += lsupc++ EXTRA_LIBS += lsupc++
EXTRA_LIBPATHS += -L ${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}} EXTRA_LIBPATHS += -L ${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}
endif endif

View File

@ -103,14 +103,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -57,14 +57,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -83,14 +83,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -115,14 +115,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -96,14 +96,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif

View File

@ -70,14 +70,14 @@ OBJDUMP = $(CROSSDEV)objdump
# Add the builtin library # Add the builtin library
EXTRA_LIBS += -lgcc EXTRA_LIBS += -lgcc
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"
ifneq ($(CONFIG_LIBM),y) ifneq ($(CONFIG_LIBM),y)
EXTRA_LIBS += -lm EXTRA_LIBS += -lm
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}"
endif endif
ifeq ($(CONFIG_CXX_LIBSUPCXX),y) ifeq ($(CONFIG_CXX_LIBSUPCXX),y)
EXTRA_LIBS += -lsupc++ EXTRA_LIBS += -lsupc++
EXTRA_LIBPATHS += -L "${dir ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}}" EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}"
endif endif