All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: selftests: Depend on kernel headers when making selftests
@ 2023-02-20 20:35 Colton Lewis
  2023-02-22 17:49 ` Sean Christopherson
  2023-02-22 17:59 ` Shuah Khan
  0 siblings, 2 replies; 3+ messages in thread
From: Colton Lewis @ 2023-02-20 20:35 UTC (permalink / raw)
  To: Paolo Bonzini, Shuah Khan, Sean Christopherson, Marc Zyngier,
	David Matlack, Oliver Upton, Vitaly Kuznetsov, Ben Gardon
  Cc: kvm, Colton Lewis

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@google.com>
---

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-22 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-20 20:35 [PATCH] KVM: selftests: Depend on kernel headers when making selftests Colton Lewis
2023-02-22 17:49 ` Sean Christopherson
2023-02-22 17:59 ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.