From patchwork Thu Apr 6 19:07:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 747952 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vzXLJ538lz9s7c for ; Fri, 7 Apr 2017 05:08:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TvP25Afi"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QGZKb5Ap"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eYIAIFBdhVvE8FvPPFYASTdKaxq7BeiLM+TY2Y4MU8w=; b=TvP25AfiEOachx 7+Q067LqszHqIzWylarL+sp26njZ8aP8iznS3IqoJWXebk10s+9JMICJdUm73ANTA+pLNnHOITQMF 39s6504L62Jq5SdS19IdoZiEYF+RcJr6ITXIsRxEPzwUErlzgY50IZGyhmX4YhzpRTFc1SdsbY7Ro cAOkG1QzuFrwrLT/3uZuwVqnJY7aSRL65rxgnKzRGasFbAedA5PJKdrMtrzAbCpphj1QpdXxokyMX vmJM02s53wNiCGvdjOpTWGVaCizMSN30tMSXc8SFN49qr89gDCIUaMmZcMLL2i9ey3XzXC+tsPEsg n2I7m3Df6eXnui25u0+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cwClp-0000HA-1t; Thu, 06 Apr 2017 19:08:37 +0000 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cwClB-0007tm-D3 for linux-arm-kernel@lists.infradead.org; Thu, 06 Apr 2017 19:08:00 +0000 Received: by mail-wr0-x232.google.com with SMTP id c55so3241097wrc.3 for ; Thu, 06 Apr 2017 12:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q/742yw0QeO8GS1z0XjCGIh0zcr2sbeRQ9tA2peP33E=; b=QGZKb5ApJeV6A8y08UtbxpfIv+nA5eEaSvR+Noyv1fM+iZJ1iNfBNpDhNRivG/P2MX RHMqX5VhVV0sTc0B7Vx6U7TwuwuSWI2Ex+/Cwo7roNaHKHNATploy9Z03RRYFDKW46ES syU4IT/nqbLvBKjrUOINVga0Qb7y5M3S9FG6E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q/742yw0QeO8GS1z0XjCGIh0zcr2sbeRQ9tA2peP33E=; b=bEHvz1N/d9THNvacUnWLDZeb8NpZZxAcKV4Ujl7bWiEIHGw0dk8Zfcy9xy7ukMruiN k5QskhnUUk4QYZugmso/29SGYgmG56EMCXyi073Af2poHMgoUODA34M5ggxSFzmOUcab 6/4g7wRvHmq9FFpU3jfv6wd/Dv3sISpsX0gv26WjVrpIZAB2p2CmnAINF3PWZrSQawh2 zlfHqb3zRWxfC61dLYbWJyJ5PUbXiMwEqBbt2c8lEHN7uKPQgrqYrYgIzLBTbcHTYwxy MfCMAKbOX1jinaN5uN/a8j1NK66yHEFbb36ANZDakBB+7Gr7VDIGfGCpJlVCt5OGJsxX cjJA== X-Gm-Message-State: AFeK/H1y+EiWGq4ZSyx28EuQMAsKampWwqtN1/JW8nNiCraWHDIRfKqbjm6jS9IgA8kB4MG3 X-Received: by 10.223.161.132 with SMTP id u4mr30739965wru.203.1491505655511; Thu, 06 Apr 2017 12:07:35 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b13sm3464318wmf.6.2017.04.06.12.07.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 12:07:33 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 721873E0198; Thu, 6 Apr 2017 20:07:37 +0100 (BST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: drjones@redhat.com, pbonzini@redhat.com Subject: [RFC kvm-unit-tests PATCH 1/8] configure: make it run-able from outside source tree Date: Thu, 6 Apr 2017 20:07:20 +0100 Message-Id: <20170406190727.5624-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170406190727.5624-1-alex.bennee@linaro.org> References: <20170406190727.5624-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170406_120757_588122_6162C588 X-CRM114-Status: GOOD ( 11.05 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c0c:0:0:0:232 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 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 - ensure lib is created with a correct lib/asm - set SRCDIR in the config.mk Signed-off-by: Alex Bennée --- configure | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 8821f37..223809c 100755 --- a/configure +++ b/configure @@ -1,5 +1,6 @@ #!/bin/bash +srcdir=$(cd "$(dirname "$0")"; pwd) prefix=/usr/local cc=gcc ld=ld @@ -102,12 +103,12 @@ elif [ "$arch" = "ppc64" ]; then else testdir=$arch fi -if [ ! -d $testdir ]; then +if [ ! -d $srcdir/$testdir ]; then echo "$testdir does not exist!" exit 1 fi -if [ -f $testdir/run ]; then - ln -fs $testdir/run $testdir-run +if [ -f $srcdir/$testdir/run ]; then + ln -fs $srcdir/$testdir/run $testdir-run fi # check if uint32_t needs a long format modifier @@ -135,18 +136,27 @@ fi rm -f lib_test.c fi +# Are we in a separate build tree? If so, link the Makefile +# so that 'make' works. +if test ! -e Makefile; then + echo "linking Makefile..." + ln -s "${srcdir}/Makefile" . +fi + # link lib/asm for the architecture rm -f lib/asm asm=asm-generic -if [ -d lib/$arch/asm ]; then - asm=$arch/asm -elif [ -d lib/$testdir/asm ]; then - asm=$testdir/asm +if [ -d $srcdir/lib/$arch/asm ]; then + asm=$srcdir/lib/$arch/asm +elif [ -d $srcdir/lib/$testdir/asm ]; then + asm=$srcdir/lib/$testdir/asm fi +mkdir -p lib ln -s $asm lib/asm # create the config cat < config.mak +SRCDIR=$srcdir PREFIX=$prefix HOST=$host ARCH=$arch