[PATCH 03/18] selftests/liveupdate: Build objects in $(OUTPUT)
From: David Matlack
Date: Tue Dec 01 2026 - 19:40:18 EST
Build the objects of the test programs in $(OUTPUT), next to the
programs, rather than in the source directory.
The programs depend on %.o, which is relative to the source directory,
so make builds the objects there with its implicit rule even when
building with O= or OUTPUT=. Make the programs depend on
$(OUTPUT)/%.o instead, and add an explicit rule for it that also
creates the object's directory, so that programs can live in
subdirectories.
Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
---
tools/testing/selftests/liveupdate/Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/liveupdate/Makefile b/tools/testing/selftests/liveupdate/Makefile
index 634211c66652..31517a07f531 100644
--- a/tools/testing/selftests/liveupdate/Makefile
+++ b/tools/testing/selftests/liveupdate/Makefile
@@ -23,7 +23,11 @@ TEST_DEP_FILES := $(patsubst %.o, %.d, $(LIBLIVEUPDATE_O))
TEST_DEP_FILES += $(patsubst %.o, %.d, $(TEST_O))
-include $(TEST_DEP_FILES)
-$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/%: %.o $(LIBLIVEUPDATE_O)
+$(TEST_O): $(OUTPUT)/%.o: %.c
+ $(Q)mkdir -p $(@D)
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+
+$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/%: $(OUTPUT)/%.o $(LIBLIVEUPDATE_O)
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LIBLIVEUPDATE_O) $(LDLIBS) -o $@
EXTRA_CLEAN += $(TEST_O)
--
2.56.1.911.g883d8bcb20-goog