Skip to contentSkip to conversation

Fix out-of-tree compiles

PATCH New Henrik Nordstrom 1 participant 1 message Apr 15, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix out-of-tree compiles

The attached small patch fixes some issues with out-of-tree compiles

- VPATH setup corrections/additions to allow generated headers to be
found

- configure changes to set both source and objects paths to simplify
VPATH logics. Part of this change I am not 100% sure you are happy with as it is somewhat shell dependent (uses $PWD to find current directory).

- Fix installation of distribued files (BIOS etc). These live in the
source tree, not the object tree.

Regards
Henrik

Index: Makefile
===================================================================
RCS file: /cvsroot/qemu/qemu/Makefile,v
retrieving revision 1.82

Makefile +13 -8
diff -u -r1.82 Makefile
@@ -4,6 +4,10 @@
 ifdef CONFIG_DARWIN
 CFLAGS+= -mdynamic-no-pic
 endif
+ifneq ($(SRC_PATH), $(OBJ_PATH))
+VPATH=$(OBJ_PATH):$(SRC_PATH)
+CFLAGS+=-I.
+endif
 LDFLAGS=-g
 LIBS=
 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
@@ -53,18 +57,19 @@
 	mkdir -p "$(bindir)"
 	install -m 755 -s $(TOOLS) "$(bindir)"
 	mkdir -p "$(datadir)"
-	install -m 644 pc-bios/bios.bin pc-bios/vgabios.bin \
-                       pc-bios/vgabios-cirrus.bin \
-                       pc-bios/ppc_rom.bin \
-                       pc-bios/proll.elf \
-                       pc-bios/linux_boot.bin "$(datadir)"
+	install -m 644 $(SRC_PATH)/pc-bios/bios.bin \
+                       $(SRC_PATH)/pc-bios/vgabios.bin \
+                       $(SRC_PATH)/pc-bios/vgabios-cirrus.bin \
+                       $(SRC_PATH)/pc-bios/ppc_rom.bin \
+                       $(SRC_PATH)/pc-bios/proll.elf \
+                       $(SRC_PATH)/pc-bios/linux_boot.bin "$(datadir)"
 	mkdir -p "$(docdir)"
 	install -m 644 qemu-doc.html  qemu-tech.html "$(docdir)"
 ifndef CONFIG_WIN32
 	mkdir -p "$(mandir)/man1"
 	install qemu.1 qemu-img.1 "$(mandir)/man1"
 	mkdir -p "$(datadir)/keymaps"
-	install -m 644 $(addprefix keymaps/,$(KEYMAPS)) "$(datadir)/keymaps"
+	install -m 644 $(addprefix $(SRC_PATH)/keymaps/,$(KEYMAPS)) "$(datadir)/keymaps"
 endif
 	for d in $(TARGET_DIRS); do \
 	$(MAKE) -C $$d $@ || exit 1 ; \
@@ -85,11 +90,11 @@
 	texi2html -monolithic -number $<
 
 qemu.1: qemu-doc.texi
-	./texi2pod.pl $< qemu.pod
+	$(SRC_PATH)/texi2pod.pl $< qemu.pod
 	pod2man --section=1 --center=" " --release=" " qemu.pod > $@
 
 qemu-img.1: qemu-img.texi
-	./texi2pod.pl $< qemu-img.pod
+	$(SRC_PATH)/texi2pod.pl $< qemu-img.pod
 	pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
 
 FILE=qemu-$(shell cat VERSION)

Index: Makefile.target
===================================================================
RCS file: /cvsroot/qemu/qemu/Makefile.target,v
retrieving revision 1.63

Makefile.target +2 -2
diff -u -r1.63 Makefile.target
@@ -8,8 +8,8 @@
 TARGET_BASE_ARCH:=sparc
 endif
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
-VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
-DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
+VPATH=$(OBJ_PATH):$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
+DEFINES=-I. -I$(TARGET_PATH) -I$(OBJ_PATH) -I$(SRC_PATH)
 ifdef CONFIG_USER_ONLY
 VPATH+=:$(SRC_PATH)/linux-user
 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)

Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.61

configure +7 -8
diff -u -r1.61 configure
@@ -125,13 +125,10 @@
 # find source path
 # XXX: we assume an absolute path is given when launching configure, 
 # except in './configure' case.
-source_path=${0%configure}
-source_path=${source_path%/}
-source_path_used="yes"
-if test -z "$source_path" -o "$source_path" = "." ; then
-    source_path=`pwd`
-    source_path_used="no"
-fi
+build_path=$PWD
+cd `dirname $0`
+source_path=$PWD
+cd $build_path
 
 for opt do
   case "$opt" in
@@ -399,6 +396,7 @@
 echo "ELF interp prefix $interp_prefix"
 fi
 echo "Source path       $source_path"
+echo "Build path        $build_path"
 echo "C compiler        $cc"
 echo "make              $make"
 echo "host CPU          $cpu"
@@ -561,6 +559,7 @@
   fi
 fi
 echo "SRC_PATH=$source_path" >> $config_mak
+echo "OBJ_PATH=$build_path" >> $config_mak
 echo "TARGET_DIRS=$target_list" >> $config_mak
 
 # XXX: suppress that
@@ -695,7 +694,7 @@
 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
+if test "$source_path" != "$build_path"; then
     DIRS="tests"
     FILES="Makefile tests/Makefile"
     for dir in $DIRS ; do