From patchwork Wed Jul 9 06:27:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 4511981 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DC9B1BEEAA for ; Wed, 9 Jul 2014 06:27:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B250202AE for ; Wed, 9 Jul 2014 06:27:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B6FE201F7 for ; Wed, 9 Jul 2014 06:27:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751313AbaGIG1w (ORCPT ); Wed, 9 Jul 2014 02:27:52 -0400 Received: from smtp.mei.co.jp ([133.183.100.20]:32879 "EHLO smtp.mei.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750953AbaGIG1w (ORCPT ); Wed, 9 Jul 2014 02:27:52 -0400 Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile13) with ESMTP id s696RXiZ026173; Wed, 9 Jul 2014 15:27:33 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili11) with ESMTP id s696RWR08874; Wed, 9 Jul 2014 15:27:32 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi11) id s696RWEd007560; Wed, 9 Jul 2014 15:27:32 +0900 Received: from poodle by lomi11.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s696RWiZ007530; Wed, 9 Jul 2014 15:27:32 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 869B62740043; Wed, 9 Jul 2014 15:27:32 +0900 (JST) From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , Sam Ravnborg Subject: [PATCH] kbuild: Use symbolic link to the source tree for out-of-tree build Date: Wed, 9 Jul 2014 15:27:21 +0900 Message-Id: <1404887241-14455-1-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.9.1 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Since commit 9da0763bd, the variable 'srctree' is set as follows: [1] Building in the source tree => srctree is set to '.' [2] Building in a subdir right under the source tree => srctree is set to '..' [3] Other cases => srctree is set to the absolute path to the source tree Pros are more readable compiler messages, WARN_ON() etc. for case [1] and [2]. (but not [3]) Cons are we have to do build-test for 3 cases when adding some changes to the build infrastructure. We want to treat case [2] and [3] in the same way like prior to commit 9da0763bd, keeping the compact log messages. The idea here is to create a symbolic link 'srctree' pointing to $(KBUILD_SRC) at the very early stage of the build process. We created the symbolic link 'source' in outputmakefile: target, but it is redundant and should be removed. (I think 'srctree' is a more suitable symbolic link name than 'source') Signed-off-by: Masahiro Yamada Cc: Michal Marek Cc: Sam Ravnborg --- Makefile | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 4d75b4b..0089618 100644 --- a/Makefile +++ b/Makefile @@ -130,6 +130,7 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make # able to understand relative filenames. sub-make: FORCE @echo "make[1]: Entering directory \`$(KBUILD_OUTPUT)'" + $(if $(KBUILD_VERBOSE:1=),@)ln -fsn $(CURDIR) $(KBUILD_OUTPUT)/srctree $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ KBUILD_SRC=$(CURDIR) \ KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ @@ -152,17 +153,7 @@ else _all: modules endif -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 +srctree := $(if $(KBUILD_SRC),srctree,.) objtree := . src := $(srctree) obj := $(objtree) @@ -460,7 +451,6 @@ PHONY += outputmakefile # output directory. outputmakefile: ifneq ($(KBUILD_SRC),) - $(Q)ln -fsn $(srctree) source $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) endif