From 1c2c0e4707a8e2e73378adcd0704ca8e2ef8e088 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Tue, 25 Jan 2022 16:11:30 +0800 Subject: [PATCH] arch/Toolchain.defs: Simplify the builtin library addition for EXTRA_LIBS Signed-off-by: Xiang Xiao --- arch/arm/src/arm/Toolchain.defs | 15 +++------------ arch/arm/src/armv6-m/Toolchain.defs | 15 +++------------ arch/arm/src/armv7-a/Toolchain.defs | 15 +++------------ arch/arm/src/armv7-m/Toolchain.defs | 15 +++------------ arch/arm/src/armv7-r/Toolchain.defs | 15 +++------------ arch/arm/src/armv8-m/Toolchain.defs | 15 +++------------ arch/avr/src/avr/Toolchain.defs | 15 +++------------ arch/avr/src/avr32/Toolchain.defs | 15 +++------------ arch/hc/src/Makefile | 15 +++------------ arch/mips/src/mips32/Toolchain.defs | 15 +++------------ arch/misoc/src/lm32/Toolchain.defs | 15 +++------------ arch/misoc/src/minerva/Toolchain.defs | 15 +++------------ arch/or1k/src/mor1kx/Toolchain.defs | 15 +++------------ arch/renesas/src/Makefile | 12 ++---------- arch/risc-v/src/common/Toolchain.defs | 15 +++------------ arch/x86/src/Makefile | 15 +++------------ arch/x86_64/src/Makefile | 15 +++------------ arch/xtensa/src/lx6/Toolchain.defs | 15 +++------------ arch/xtensa/src/lx7/Toolchain.defs | 15 +++------------ 19 files changed, 56 insertions(+), 226 deletions(-) diff --git a/arch/arm/src/arm/Toolchain.defs b/arch/arm/src/arm/Toolchain.defs index 5be37b14ae..4a714f1dce 100644 --- a/arch/arm/src/arm/Toolchain.defs +++ b/arch/arm/src/arm/Toolchain.defs @@ -103,21 +103,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/arm/src/armv6-m/Toolchain.defs b/arch/arm/src/armv6-m/Toolchain.defs index 1e66e7edf0..876d7fdf64 100644 --- a/arch/arm/src/armv6-m/Toolchain.defs +++ b/arch/arm/src/armv6-m/Toolchain.defs @@ -95,21 +95,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/arm/src/armv7-a/Toolchain.defs b/arch/arm/src/armv7-a/Toolchain.defs index a45e77bcd2..09cebafd12 100644 --- a/arch/arm/src/armv7-a/Toolchain.defs +++ b/arch/arm/src/armv7-a/Toolchain.defs @@ -121,21 +121,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/arm/src/armv7-m/Toolchain.defs b/arch/arm/src/armv7-m/Toolchain.defs index ba6a58e8ea..de00011605 100644 --- a/arch/arm/src/armv7-m/Toolchain.defs +++ b/arch/arm/src/armv7-m/Toolchain.defs @@ -154,21 +154,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/arm/src/armv7-r/Toolchain.defs b/arch/arm/src/armv7-r/Toolchain.defs index 249a38952b..0c4834f1c5 100644 --- a/arch/arm/src/armv7-r/Toolchain.defs +++ b/arch/arm/src/armv7-r/Toolchain.defs @@ -103,21 +103,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/arm/src/armv8-m/Toolchain.defs b/arch/arm/src/armv8-m/Toolchain.defs index 7121e9991a..805a751a47 100644 --- a/arch/arm/src/armv8-m/Toolchain.defs +++ b/arch/arm/src/armv8-m/Toolchain.defs @@ -153,21 +153,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/avr/src/avr/Toolchain.defs b/arch/avr/src/avr/Toolchain.defs index 049032aaf8..8e11c31f74 100644 --- a/arch/avr/src/avr/Toolchain.defs +++ b/arch/avr/src/avr/Toolchain.defs @@ -126,21 +126,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/avr/src/avr32/Toolchain.defs b/arch/avr/src/avr32/Toolchain.defs index 62728dc75e..b277d6a896 100644 --- a/arch/avr/src/avr32/Toolchain.defs +++ b/arch/avr/src/avr32/Toolchain.defs @@ -50,21 +50,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/hc/src/Makefile b/arch/hc/src/Makefile index 366459e30d..1ff59a3799 100644 --- a/arch/hc/src/Makefile +++ b/arch/hc/src/Makefile @@ -87,23 +87,14 @@ endif # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif VPATH = chip:common:$(ARCH_SUBDIR) diff --git a/arch/mips/src/mips32/Toolchain.defs b/arch/mips/src/mips32/Toolchain.defs index 3e95cd9797..712c3c4a6d 100644 --- a/arch/mips/src/mips32/Toolchain.defs +++ b/arch/mips/src/mips32/Toolchain.defs @@ -279,21 +279,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/misoc/src/lm32/Toolchain.defs b/arch/misoc/src/lm32/Toolchain.defs index 34e7f67141..5333d347a3 100644 --- a/arch/misoc/src/lm32/Toolchain.defs +++ b/arch/misoc/src/lm32/Toolchain.defs @@ -87,21 +87,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/misoc/src/minerva/Toolchain.defs b/arch/misoc/src/minerva/Toolchain.defs index 4b66b0dd4d..79448674ff 100644 --- a/arch/misoc/src/minerva/Toolchain.defs +++ b/arch/misoc/src/minerva/Toolchain.defs @@ -41,21 +41,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/or1k/src/mor1kx/Toolchain.defs b/arch/or1k/src/mor1kx/Toolchain.defs index f7adbc0428..8a509e2653 100644 --- a/arch/or1k/src/mor1kx/Toolchain.defs +++ b/arch/or1k/src/mor1kx/Toolchain.defs @@ -68,21 +68,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/renesas/src/Makefile b/arch/renesas/src/Makefile index b5e735de91..bb7b4f4a1a 100644 --- a/arch/renesas/src/Makefile +++ b/arch/renesas/src/Makefile @@ -84,19 +84,11 @@ EXTRA_LIBS += -lgcc EXTRA_LIBPATHS += -L""${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}"" ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif VPATH = chip:common diff --git a/arch/risc-v/src/common/Toolchain.defs b/arch/risc-v/src/common/Toolchain.defs index c2192edd4d..ca62e9f607 100644 --- a/arch/risc-v/src/common/Toolchain.defs +++ b/arch/risc-v/src/common/Toolchain.defs @@ -129,21 +129,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/x86/src/Makefile b/arch/x86/src/Makefile index b498f70178..a3556953f2 100644 --- a/arch/x86/src/Makefile +++ b/arch/x86/src/Makefile @@ -84,23 +84,14 @@ endif # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif VPATH = chip:common:$(ARCH_SUBDIR) diff --git a/arch/x86_64/src/Makefile b/arch/x86_64/src/Makefile index 61dce0debc..3eb9ed5e5f 100644 --- a/arch/x86_64/src/Makefile +++ b/arch/x86_64/src/Makefile @@ -86,23 +86,14 @@ endif # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif VPATH = chip:common:$(ARCH_SUBDIR) diff --git a/arch/xtensa/src/lx6/Toolchain.defs b/arch/xtensa/src/lx6/Toolchain.defs index a8f32ae750..80c82d7811 100644 --- a/arch/xtensa/src/lx6/Toolchain.defs +++ b/arch/xtensa/src/lx6/Toolchain.defs @@ -79,21 +79,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif diff --git a/arch/xtensa/src/lx7/Toolchain.defs b/arch/xtensa/src/lx7/Toolchain.defs index b7eb6b11d2..705fa1c557 100644 --- a/arch/xtensa/src/lx7/Toolchain.defs +++ b/arch/xtensa/src/lx7/Toolchain.defs @@ -79,21 +79,12 @@ OBJDUMP = $(CROSSDEV)objdump # Add the builtin library -EXTRA_LIBS += -lgcc -EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name`"}" +EXTRA_LIBS := ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcc.a} ifneq ($(CONFIG_LIBM),y) - LIBM_PATH = "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a`"}" - - # Check if libm is provided by the compiler - - ifneq ($(LIBM_PATH),".") - EXTRA_LIBS += -lm - EXTRA_LIBPATHS += -L $(LIBM_PATH) - endif + EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif ifeq ($(CONFIG_LIBSUPCXX),y) - EXTRA_LIBS += -lsupc++ - EXTRA_LIBPATHS += -L "${shell dirname "`$(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a`"}" + EXTRA_LIBS += ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a} endif