The cgroup_util.o rule in libcgroup.mk lists the object directory as a normal prerequisite. The KVM selftests include libcgroup.mk, so for them that directory is their own $(OUTPUT)/lib. After any incremental KVM build that rebuilds an object there, the directory is newer than cgroup_util.o, and the next build recompiles cgroup_util.o and relinks every test. Make the directory an order-only prerequisite, as libvfio.mk does. Acked-by: Michal Koutný Signed-off-by: Fuad Tabba --- Notes: This was patch 2/2 of v2 [1]. Sean took patch 1 through kvm-x86 and asked for this one to go through the cgroup tree [2]. Changes since v2: - Collected Michal's Acked-by. - Rebased on cgroup/for-7.5. - Dropped the Fixes: tag, as the patch only saves a rebuild. [1] https://lore.kernel.org/all/20260922071945.693714-1-fuad.tabba@linux.dev/ [2] https://lore.kernel.org/all/avJqZzKX1ZVAMGr-@seanjc-mac.roam.internal/ tools/testing/selftests/cgroup/lib/libcgroup.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/cgroup/lib/libcgroup.mk b/tools/testing/selftests/cgroup/lib/libcgroup.mk index 7a73007204c39..bcf6fe2516223 100644 --- a/tools/testing/selftests/cgroup/lib/libcgroup.mk +++ b/tools/testing/selftests/cgroup/lib/libcgroup.mk @@ -13,7 +13,7 @@ EXTRA_HDRS := $(selfdir)/clone3/clone3_selftests.h $(LIBCGROUP_O_DIRS): mkdir -p $@ -$(LIBCGROUP_O): $(OUTPUT)/%.o : $(CGROUP_DIR)/%.c $(EXTRA_HDRS) $(LIBCGROUP_O_DIRS) +$(LIBCGROUP_O): $(OUTPUT)/%.o : $(CGROUP_DIR)/%.c $(EXTRA_HDRS) | $(LIBCGROUP_O_DIRS) $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ EXTRA_CLEAN += $(LIBCGROUP_O) base-commit: 80bf33fd523ee1df2d265d34970df670a44a2ccd -- 2.47.3