[PATCH 14/17] Fix build when objdir != srcdir

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Anthony Liguori
Date: Sunday, May 17, 2009 - 8:43 am

This requires adding the necessary bits to configure to create the directories
and symlinks for libkvm.  It also requires sticking KVM_CFLAGS in
config-host.mak to ensure that it gets the right set of includes for the
kernel headers.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

diff --git a/configure b/configure
index 04e072b..23ac0ef 100755
--- a/configure
+++ b/configure
@@ -499,7 +499,7 @@ if test "$werror" = "yes" ; then
 CFLAGS="$CFLAGS -Werror"
 fi
 
-CFLAGS="$CFLAGS -I$(readlink -f "kvm/libkvm")"
+CFLAGS="$CFLAGS -I$(readlink -f "$source_path/kvm/libkvm")"
 
 if test "$solaris" = "no" ; then
     if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
@@ -1580,6 +1580,11 @@ bsd)
 ;;
 esac
 
+# this is a temp hack needed for libkvm
+if test "$kvm" = "yes" ; then
+    echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
+fi
+
 tools=
 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
   tools="qemu-img\$(EXESUF) $tools"
@@ -1945,10 +1950,11 @@ done # for target in $targets
 
 # build tree in object directory if source path is different from current one
 if test "$source_path_used" = "yes" ; then
-    DIRS="tests tests/cris slirp audio"
+    DIRS="tests tests/cris slirp audio kvm/libkvm"
     FILES="Makefile tests/Makefile"
     FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
     FILES="$FILES tests/test-mmap.c"
+    FILES="$FILES kvm/libkvm/Makefile"
     for dir in $DIRS ; do
             mkdir -p $dir
     done
diff --git a/kvm/libkvm/Makefile b/kvm/libkvm/Makefile
index 727ce48..8de7eaf 100644
--- a/kvm/libkvm/Makefile
+++ b/kvm/libkvm/Makefile
@@ -1,5 +1,12 @@
 include ../../config-host.mak
-include config-$(ARCH).mak
+ifneq ($(VPATH),)
+srcdir=$(VPATH)/kvm/libkvm
+else
+srcdir=.
+endif
+
+include $(srcdir)/config-$(ARCH).mak
+
 
 # libkvm is not -Wredundant-decls friendly yet
 CFLAGS += -Wno-redundant-decls
@@ -18,6 +25,8 @@ LDFLAGS += $(CFLAGS)
 
 CXXFLAGS = $(autodepend-flags)
 
+VPATH:=$(VPATH)/kvm/libkvm
+
 autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d
 
 
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/17][REVIEW] Backport candidates for stable-0.10, Anthony Liguori, (Sun May 17, 8:43 am)
[PATCH 05/17] Stop/start cpus before/after devices, Anthony Liguori, (Sun May 17, 8:43 am)
[PATCH 06/17] Use statfs to determine size of huge pages, Anthony Liguori, (Sun May 17, 8:43 am)
[PATCH 07/17] Fixup 4GB+ memslot large page alignment, Anthony Liguori, (Sun May 17, 8:43 am)
[PATCH 08/17] Clear tap features on initialization, Anthony Liguori, (Sun May 17, 8:43 am)
[PATCH 09/17] Propagate errors on failed migration., Anthony Liguori, (Sun May 17, 8:43 am)
[PATCH 13/17] Increment version id for CPU save state, Anthony Liguori, (Sun May 17, 8:43 am)
[PATCH 14/17] Fix build when objdir != srcdir, Anthony Liguori, (Sun May 17, 8:43 am)
[PATCH 15/17] Fix loading extboot option rom, Anthony Liguori, (Sun May 17, 8:43 am)
Re: [PATCH 15/17] Fix loading extboot option rom, Avi Kivity, (Sun May 17, 10:06 am)
Re: [PATCH 0/17][REVIEW] Backport candidates for stable-0.10, Anthony Liguori, (Sun May 17, 4:32 pm)
Re: [PATCH 0/17][REVIEW] Backport candidates for stable-0.10, Anthony Liguori, (Sun May 17, 4:36 pm)
Re: [PATCH 06/17] Use statfs to determine size of huge pages, Anthony Liguori, (Mon May 18, 6:10 am)
Re: [PATCH 05/17] Stop/start cpus before/after devices, Marcelo Tosatti, (Mon May 18, 6:58 am)
Re: [PATCH 05/17] Stop/start cpus before/after devices, Anthony Liguori, (Mon May 18, 7:26 am)
Re: [PATCH 05/17] Stop/start cpus before/after devices, Marcelo Tosatti, (Mon May 18, 7:47 am)
Re: [PATCH 11/17] net: drop packet from tap device if all ..., Mark McLoughlin, (Tue May 19, 10:52 am)