[Swan-dev] Append .kvm to OBJDIR when a KVM build
Antony Antony
antony at phenome.org
Wed Mar 11 21:03:20 EET 2015
On Wed, Mar 11, 2015 at 11:46:12AM -0400, Andrew Cagney wrote:
> Another of my local tweaks.
>
> Currently, a VM build (swan-build) unhelpfully deletes all OBJ.linux.*
> directories. This, of course, includes any native build you've been
> doing. I'd like to tweak things so that:
>
> - on the VM OBJDIR has .kvm (.vm?) appended so VM and host builds use
> different directories
> - swan-build, which should only be run on a VM, deletes OBJ.linix*.vm
> (yes it should rely on "make distclean" but that's another story)
>
> Since the VM has its own private build directory this also gets us that bit
> closer to not even needing the delete.
Probably things got better recently. A couple of weeks ago, deleting OBJDIR inside VM was a safe strategy.
> I've appended the key part of the patch. The magic grep line matches what
> virt-what does.
>
> Andrew
>
> diff --git a/mk/objdir.mk b/mk/objdir.mk
> index f86c9db..a581319 100644
> --- a/mk/objdir.mk
> +++ b/mk/objdir.mk
> @@ -56,4 +56,8 @@ BUILDENV:=$(shell uname -s | tr 'A-Z' 'a-z' | sed -e
> 's/\(.*\)-.*/\1/')
> endif
> export BUILDENV
>
> -OBJDIR?=OBJ.${BUILDENV}.${ARCH}
> +ifeq ($(origin OBJDIR_KVM),undefined)
> +OBJDIR_KVM:=$(shell grep -i QEMU /proc/cpuinfo >/dev/null 2>&1 && echo
> .kvm)
> +endif
> +
> +OBJDIR?=OBJ.${BUILDENV}.${ARCH}$(OBJDIR_KVM)
If someone build on kvm, not running full testsuite, just building to install, suddenly directory will have OBJDIR_KVM. That does not sound convenient to me. This probably belong to mk/testing.mk or something. I am not sure if it is good idea for the upstream.
what I do is in Makefile.local
OBJDIR?=OBJ.${BUILDENV}.${ARCH}${OBJDIREXT}
and in .bashrc
export OBJDIREXT="-host"
I wish there was one for modobj that annoys me more when host and vm kernels drift aptart.
-antony
More information about the Swan-dev
mailing list