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