From 96d094af13dab67709a252a39da164bde4d637e0 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Wed, 22 May 2019 12:09:35 +0000 Subject: [PATCH] mk/genlink-config: provide LIBNAME in devices autogeneration This makes the generic rules workk happily regardless of whether the linkerscript generation is being used or not. Notably, in the examples repo, use of the linker script autogeneration was retriggering library builds as LIBNAME was unset and therefore the libraries lib.a couldn't be found. --- mk/genlink-config.mk | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mk/genlink-config.mk b/mk/genlink-config.mk index 6935ec9b..d2970b4c 100644 --- a/mk/genlink-config.mk +++ b/mk/genlink-config.mk @@ -55,17 +55,18 @@ endif # only append to LDFLAGS if the library file exists to not break builds # where those are provided by different means ifneq (,$(wildcard $(OPENCM3_DIR)/lib/libopencm3_$(genlink_family).a)) -LDLIBS += -lopencm3_$(genlink_family) -LIBDEPS += $(OPENCM3_DIR)/lib/libopencm3_$(genlink_family).a +LIBNAME = opencm3_$(genlink_family) else ifneq (,$(wildcard $(OPENCM3_DIR)/lib/libopencm3_$(genlink_subfamily).a)) -LDLIBS += -lopencm3_$(genlink_subfamily) -LIBDEPS += $(OPENCM3_DIR)/lib/libopencm3_$(genlink_subfamily).a +LIBNAME = opencm3_$(genlink_subfamily) else $(warning $(OPENCM3_DIR)/lib/libopencm3_$(genlink_family).a library variant for the selected device does not exist.) endif endif +LDLIBS += -l$(LIBNAME) +LIBDEPS += $(OPENCM3_DIR)/lib/lib$(LIBNAME) + # only append to LDLIBS if the directory exists ifneq (,$(wildcard $(OPENCM3_DIR)/lib)) LDFLAGS += -L$(OPENCM3_DIR)/lib