From f805d30aeafb6aef34a116206b8ab8d7889ce0d8 Mon Sep 17 00:00:00 2001 From: Jake Carter Date: Mon, 13 Mar 2023 13:40:23 -0500 Subject: [PATCH] Fix ln_args parsing bug on MSYS2 (#479) --- .../Device/Maxim/MAX32520/Source/GCC/gcc.mk | 18 +++++++++++++++++- .../Device/Maxim/MAX32570/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32572/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32650/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32655/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32660/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32662/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32665/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32670/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32672/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32675/Source/GCC/gcc.mk | 16 ++++++++++++++-- .../Device/Maxim/MAX32680/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX32690/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX78000/Source/GCC/gcc.mk | 17 ++++++++++++++++- .../Device/Maxim/MAX78002/Source/GCC/gcc.mk | 17 ++++++++++++++++- 15 files changed, 239 insertions(+), 16 deletions(-) diff --git a/Libraries/CMSIS/Device/Maxim/MAX32520/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32520/Source/GCC/gcc.mk index 25943b6eb8..cba418c5c1 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32520/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32520/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -224,7 +229,18 @@ endif # Add the include file paths to AFLAGS and CFLAGS. AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif + ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32570/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32570/Source/GCC/gcc.mk index ef632eed91..96578b4aa9 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32570/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32570/Source/GCC/gcc.mk @@ -95,10 +95,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -276,7 +281,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32572/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32572/Source/GCC/gcc.mk index 9dae395acd..6adb8b1e10 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32572/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32572/Source/GCC/gcc.mk @@ -95,10 +95,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -259,7 +264,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32650/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32650/Source/GCC/gcc.mk index 66bc7e5c8b..6780ef2eac 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32650/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32650/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -261,7 +266,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32655/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32655/Source/GCC/gcc.mk index 180ebbe29a..51ef160485 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32655/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32655/Source/GCC/gcc.mk @@ -95,10 +95,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -261,7 +266,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32660/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32660/Source/GCC/gcc.mk index 77393da722..37bb57b42a 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32660/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32660/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -261,7 +266,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32662/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32662/Source/GCC/gcc.mk index 77393da722..37bb57b42a 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32662/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32662/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -261,7 +266,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/gcc.mk index f3394ef3c5..a914245e49 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/gcc.mk @@ -95,10 +95,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -251,7 +256,17 @@ endif # Add the include file paths to AFLAGS and CFLAGS. AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32670/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32670/Source/GCC/gcc.mk index 573572eb6f..cfc2bb2881 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32670/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32670/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -258,7 +263,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32672/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32672/Source/GCC/gcc.mk index 573572eb6f..cfc2bb2881 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32672/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32672/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -258,7 +263,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32675/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32675/Source/GCC/gcc.mk index 573572eb6f..93d37319c4 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32675/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32675/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -258,7 +263,14 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} -LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) +CYGWIN=True +endif + +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32680/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32680/Source/GCC/gcc.mk index 180ebbe29a..51ef160485 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32680/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32680/Source/GCC/gcc.mk @@ -95,10 +95,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -261,7 +266,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX32690/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX32690/Source/GCC/gcc.mk index f6be980c63..b7a477e8f1 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX32690/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX32690/Source/GCC/gcc.mk @@ -95,10 +95,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -261,7 +266,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX78000/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX78000/Source/GCC/gcc.mk index 573572eb6f..cfc2bb2881 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX78000/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX78000/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -258,7 +263,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file. diff --git a/Libraries/CMSIS/Device/Maxim/MAX78002/Source/GCC/gcc.mk b/Libraries/CMSIS/Device/Maxim/MAX78002/Source/GCC/gcc.mk index 573572eb6f..cfc2bb2881 100644 --- a/Libraries/CMSIS/Device/Maxim/MAX78002/Source/GCC/gcc.mk +++ b/Libraries/CMSIS/Device/Maxim/MAX78002/Source/GCC/gcc.mk @@ -92,10 +92,15 @@ endif # auto-generated dependencies. Also if this is Cygwin, file paths for ARM GCC # will be converted from /cygdrive/c to C:. ################################################################################ -ifneq ($(findstring CYGWIN, ${shell uname -s}), ) +UNAME := $(shell uname -s) +ifneq ($(findstring CYGWIN, $(UNAME)), ) CYGWIN=True endif +ifneq ($(findstring MSYS, $(UNAME)), ) +MSYS=True +endif + # Get the prefix for the tools to use. ifeq "$(TOOL_DIR)" "" PREFIX=arm-none-eabi @@ -258,7 +263,17 @@ endif AFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} CXXFLAGS+=${patsubst %,-I%,$(call fixpath,$(IPATH))} +ifneq ($(MSYS),) +# 2-27-2023: This workaround was added to resolve a linker bug introduced +# when we started using ln_args.txt. The GCC linker expects C:/-like paths +# on Windows if arguments are passed in from a text file. However, ln_args +# is parsed through a regex that misses the edge case -L/C/Path/... because +# of the leading "-L". We use cygpath here to handle that edge case before +# parsing ln_args.txt. +LDFLAGS+=${patsubst %,-L%,$(shell cygpath -m $(LIBPATH))} +else LDFLAGS+=${patsubst %,-L%,$(call fixpath,$(LIBPATH))} +endif ################################################################################ # The rule for building the object file from each C source file.