From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [kvm-unit-tests PATCH v2 1/9] configure: make it run-able from outside source tree Date: Wed, 17 May 2017 16:50:32 +0200 Message-ID: <20170517145027.GB10587@potion> References: <20170512164001.4117-1-alex.bennee@linaro.org> <20170512164001.4117-2-alex.bennee@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: pbonzini@redhat.com, drjones@redhat.com, kvm@vger.kernel.org To: Alex =?utf-8?Q?Benn=C3=A9e?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:48920 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752548AbdEQOus (ORCPT ); Wed, 17 May 2017 10:50:48 -0400 Content-Disposition: inline In-Reply-To: <20170512164001.4117-2-alex.bennee@linaro.org> Sender: kvm-owner@vger.kernel.org List-ID: 2017-05-12 17:39+0100, Alex Bennée: > This is a first step to enabling out-of-tree builds for > kvm-unit-tests. When you invoke configure like this: > > ../tree.git/configure [args] > > It will detect we the case and: > > - link ../tree.git/Makefile to the build-dir > - link ../tree.git/$(arch) and test scripts > - link ../tree.git/run_tests.sh > - ensure lib is created with a correct lib/asm > - set SRCDIR in the config.mk > > Signed-off-by: Alex Bennée > > --- > v2 > - ln -sf more directory structure > - quotes around places where $srcdir is used > - dropped pointless {}s > --- > diff --git a/configure b/configure > +srcdir=$(cd "$(dirname "$0")"; pwd) > +# Are we in a separate build tree? If so, link the Makefile > +# and shared stuff so that 'make' and run_tests.sh work. > +if test ! -e Makefile; then > + echo "linking Makefile..." > + ln -s "$srcdir/Makefile" . > + > + echo "linking tests..." > + mkdir -p $testdir > + ln -sf "$srcdir/$testdir/run" $testdir/ > + ln -sf "$srcdir/$testdir/unittests.cfg" $testdir/ > + ln -sf "$srcdir/run_tests.sh" > + > + echo "linking scripts..." > + ln -sf "$srcdir/scripts" > +fi > + > > # create the config > cat < config.mak > +SRCDIR=$srcdir Whitespace in $srcdir is going to break the build. I think that we cannot prevent that by escaping as `make` is notoriously bad in that regard. Aborting sounds better and maybe something like this could work: ln -sf "$srcdir" srcdir srcdir=srcdir I'm ok with this version if the solution would not be simple. :)