genlink: provide LIBDEPS for libopencm3 itself
If $(OPENCM3_DIR)/lib/libopencm3_*.a exists, it will be linked in.
If we do that, we should also add it to the deps.
That way a newer *.a will result in a relink.
To use this, you should add a dependency to $(LIBDEPS) where you are
using $(LDFLAGS) and $(LDLIBS) now.
eg, old (wouldn't relink if the library changed)
$(PROJECT).elf: $(OBJS) $(LDSCRIPT)
@printf " LD\t$@\n"
$(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
new (will relink when the library changes)
$(PROJECT).elf: $(OBJS) $(LDSCRIPT) $(LIBDEPS)
@printf " LD\t$@\n"
$(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
Tested-by: Karl Palsson <karlp@tweak.net.au>
Originally tracked via: https://github.com/libopencm3/libopencm3/pull/887
This commit is contained in:
committed by
Karl Palsson
parent
f4bbe7c5bb
commit
d14033c744
@@ -56,9 +56,11 @@ endif
|
|||||||
# where those are provided by different means
|
# where those are provided by different means
|
||||||
ifneq (,$(wildcard $(OPENCM3_DIR)/lib/libopencm3_$(genlink_family).a))
|
ifneq (,$(wildcard $(OPENCM3_DIR)/lib/libopencm3_$(genlink_family).a))
|
||||||
LDLIBS += -lopencm3_$(genlink_family)
|
LDLIBS += -lopencm3_$(genlink_family)
|
||||||
|
LIBDEPS += $(OPENCM3_DIR)/lib/libopencm3_$(genlink_family).a
|
||||||
else
|
else
|
||||||
ifneq (,$(wildcard $(OPENCM3_DIR)/lib/libopencm3_$(genlink_subfamily).a))
|
ifneq (,$(wildcard $(OPENCM3_DIR)/lib/libopencm3_$(genlink_subfamily).a))
|
||||||
LDLIBS += -lopencm3_$(genlink_subfamily)
|
LDLIBS += -lopencm3_$(genlink_subfamily)
|
||||||
|
LIBDEPS += $(OPENCM3_DIR)/lib/libopencm3_$(genlink_subfamily).a
|
||||||
else
|
else
|
||||||
$(warning $(OPENCM3_DIR)/lib/libopencm3_$(genlink_family).a library variant for the selected device does not exist.)
|
$(warning $(OPENCM3_DIR)/lib/libopencm3_$(genlink_family).a library variant for the selected device does not exist.)
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user