Skip to contentSkip to conversation

testcases.mk: Fix LTPLIBS build rule

PATCH New Cyril Hrubis 1 participant 1 message Jun 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testcases.mk: Fix LTPLIBS build rule

The current code that attempts to rebuild libraries a test is depending on is broken for more than one library since the "$^" is a list of all prerequisities.

This fixes the problem by adding a proper pattern rule.

I've also added the libraries to the .PHONY target so that we attempt to rebuild them regardless of the library archive existence since we do not know the prerequisities of the library archive in the testcase directory we cannot tell if some of the sources has been changed so the safest course of action is to attempt the rebuild every time.

---
 include/mk/testcases.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/mk/testcases.mk +5 -1
index 684655fbf..bb22be82e 100644
@@ -48,8 +48,12 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach
 
 MAKE_DEPS += $(LTPLIBS_FILES)
 
+.PHONY: $(LTPLIBS_FILES)
+
 $(LTPLIBS_FILES): $(LTPLIBS_DIRS)
-	$(MAKE) -C "$^" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all
+
+$(LTPLIBS_FILES): %:
+	$(MAKE) -C "$(dir $@)" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$(dir $@))/Makefile" all
 
 LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
 
Signature · 1 line
2.26.2