From patchwork Tue Apr 29 14:08:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Marek X-Patchwork-Id: 4087611 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B0B869F39D for ; Tue, 29 Apr 2014 14:09:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE53E20121 for ; Tue, 29 Apr 2014 14:09:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 61FA4201F4 for ; Tue, 29 Apr 2014 14:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933637AbaD2OI2 (ORCPT ); Tue, 29 Apr 2014 10:08:28 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54668 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933510AbaD2OI1 (ORCPT ); Tue, 29 Apr 2014 10:08:27 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E4C50AC44; Tue, 29 Apr 2014 14:08:26 +0000 (UTC) Received: by pobox.suse.cz (Postfix, from userid 10020) id C5087C22A4; Tue, 29 Apr 2014 16:08:26 +0200 (CEST) From: Michal Marek To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 5/5] kbuild: Use relative path when building in a subdir of the source tree Date: Tue, 29 Apr 2014 16:08:13 +0200 Message-Id: <1398780493-15391-6-git-send-email-mmarek@suse.cz> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1398780493-15391-1-git-send-email-mmarek@suse.cz> References: <1398780493-15391-1-git-send-email-mmarek@suse.cz> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When doing make O=, use '..' to refer to the source tree. This allows for more readable compiler messages, and, more importantly, it sets the VPATH to '..', so filenames in WARN_ON() etc. will be shorter. Signed-off-by: Michal Marek --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7ae9e9d..3d311b6 100644 --- a/Makefile +++ b/Makefile @@ -153,7 +153,17 @@ else _all: modules endif -srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),.) +ifeq ($(KBUILD_SRC),) + # building in the source tree + srctree := . +else + ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR))) + # building in a subdirectory of the source tree + srctree := .. + else + srctree := $(KBUILD_SRC) + endif +endif objtree := . src := $(srctree) obj := $(objtree)