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<blank>.a couldn't be found.
This commit is contained in:
Karl Palsson 2019-05-22 12:09:35 +00:00
parent 5853678003
commit 96d094af13
1 changed files with 5 additions and 4 deletions

View File

@ -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