diff mbox

Makefile.target: include top level build dir in vpath

Message ID 1440377875-10991-1-git-send-email-michael.marineau@coreos.com
State New
Headers show

Commit Message

Michael Marineau Aug. 24, 2015, 12:57 a.m. UTC
Using ccache with CCACHE_BASEDIR set to $(SRC_PATH) or a parent will
rewrite all absolute paths to relative paths. This interacts poorly with
QEMU's two-level build directory scheme. For example, lets say
BUILD_DIR=$(SRC_PATH)/build so build/blockdev.d will contain:

  blockdev.o: ../blockdev.c ../include/sysemu/block-backend.h \

Now the target build under build/x86_64-softmmu or similar will depend
on ../blockdev.o which in turn will get make to source ../blockdev.d to
check its dependencies. Since make always considers paths relative to
the current working directory rather than the makefile the path appeared
in the relative path to ../blockdev.c is useless.

This change simply adds the top level build directory to vpath so paths
relative to the source directory, top build directory, and target build
directory all work just fine.

Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
---

This is a re-send with the proper Signed-off-by line.

 Makefile.target | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Marineau Sept. 7, 2015, 9:02 p.m. UTC | #1
On Sun, Aug 23, 2015 at 5:57 PM, Michael Marineau
<michael.marineau@coreos.com> wrote:
> Using ccache with CCACHE_BASEDIR set to $(SRC_PATH) or a parent will
> rewrite all absolute paths to relative paths. This interacts poorly with
> QEMU's two-level build directory scheme. For example, lets say
> BUILD_DIR=$(SRC_PATH)/build so build/blockdev.d will contain:
>
>   blockdev.o: ../blockdev.c ../include/sysemu/block-backend.h \
>
> Now the target build under build/x86_64-softmmu or similar will depend
> on ../blockdev.o which in turn will get make to source ../blockdev.d to
> check its dependencies. Since make always considers paths relative to
> the current working directory rather than the makefile the path appeared
> in the relative path to ../blockdev.c is useless.
>
> This change simply adds the top level build directory to vpath so paths
> relative to the source directory, top build directory, and target build
> directory all work just fine.
>
> Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
> ---
>
> This is a re-send with the proper Signed-off-by line.
>
>  Makefile.target | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile.target b/Makefile.target
> index 3e7aafd..dc32294 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -7,7 +7,7 @@ include config-target.mak
>  include config-devices.mak
>  include $(SRC_PATH)/rules.mak
>
> -$(call set-vpath, $(SRC_PATH))
> +$(call set-vpath, $(SRC_PATH):$(BUILD_DIR))
>  ifdef CONFIG_LINUX
>  QEMU_CFLAGS += -I../linux-headers
>  endif
> --
> 2.4.6
>

ping http://patchwork.ozlabs.org/patch/510065/
Paolo Bonzini Sept. 7, 2015, 9:11 p.m. UTC | #2
On 07/09/2015 23:02, Michael Marineau wrote:
> ping http://patchwork.ozlabs.org/patch/510065/

Just back from vacation, this is queued in my next pull request
(currently at tags/for-upstream on github.com/bonzini/qemu.git, but I
haven't finished testing it).

Paolo
Michael Marineau Sept. 7, 2015, 9:18 p.m. UTC | #3
On Mon, Sep 7, 2015 at 2:11 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 07/09/2015 23:02, Michael Marineau wrote:
>> ping http://patchwork.ozlabs.org/patch/510065/
>
> Just back from vacation, this is queued in my next pull request
> (currently at tags/for-upstream on github.com/bonzini/qemu.git, but I
> haven't finished testing it).
>
> Paolo

Great, thanks!
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index 3e7aafd..dc32294 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -7,7 +7,7 @@  include config-target.mak
 include config-devices.mak
 include $(SRC_PATH)/rules.mak
 
-$(call set-vpath, $(SRC_PATH))
+$(call set-vpath, $(SRC_PATH):$(BUILD_DIR))
 ifdef CONFIG_LINUX
 QEMU_CFLAGS += -I../linux-headers
 endif