[PATCH] KVM: selftests: Depend on kernel headers when making selftests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a makefile dependency for the kernel headers when building KVM
selftests. As the selftests do depend on the kernel headers, needing
to do things such as build selftests for a different architecture
requires rebuilding the headers. That is an extra annoying manual step
that should be handled by make.

Signed-off-by: Colton Lewis <coltonlewis@xxxxxxxxxx>
---

This change has been sitting in my local git repo as a stach for a
long time to make it easier to build selftests for multiple
architectures and I just realized I never sent it upstream. I don't
know if this is the best way to accomplish the goal, but it was the
only obvious one I found.

 tools/testing/selftests/kvm/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index 1750f91dd936..857c6f78e4da 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -221,12 +221,16 @@ LIBKVM_OBJS = $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) $(LIBKVM_STRING_OBJ)
 EXTRA_CLEAN += $(LIBKVM_OBJS) cscope.*

 x := $(shell mkdir -p $(sort $(dir $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ))))
-$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c
+$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c headers
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@

 $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@

+PHONY += headers
+headers:
+	$(MAKE) -C $(top_srcdir) headers
+
 # Compile the string overrides as freestanding to prevent the compiler from
 # generating self-referential code, e.g. without "freestanding" the compiler may
 # "optimize" memcmp() by invoking memcmp(), thus causing infinite recursion.
--
2.39.2.637.g21b0678d19-goog



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux