From patchwork Wed Oct 29 07:27:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 5184801 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 58CC0C11AC for ; Wed, 29 Oct 2014 07:27:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60CF120131 for ; Wed, 29 Oct 2014 07:27:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBF58201FA for ; Wed, 29 Oct 2014 07:27:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755363AbaJ2H14 (ORCPT ); Wed, 29 Oct 2014 03:27:56 -0400 Received: from smtp.mei.co.jp ([133.183.100.20]:49546 "EHLO smtp.mei.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752283AbaJ2H1z (ORCPT ); Wed, 29 Oct 2014 03:27:55 -0400 Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile11) with ESMTP id s9T7RZlX020235; Wed, 29 Oct 2014 16:27:35 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili14) with ESMTP id s9T7RZL11456; Wed, 29 Oct 2014 16:27:35 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi14) id s9T7RZrR009119; Wed, 29 Oct 2014 16:27:35 +0900 Received: from poodle by lomi14.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s9T7RZQF009066; Wed, 29 Oct 2014 16:27:35 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 21D722740043; Wed, 29 Oct 2014 16:27:35 +0900 (JST) From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , "H. Peter Anvin" , Andi Kleen , Sam Ravnborg , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: collect shorthands into the top Makefile Date: Wed, 29 Oct 2014 16:27:31 +0900 Message-Id: <1414567651-2503-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.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 The motivation of this commit is to avoid duplicated definitions of "clean" and "hdr-inst" shorthands. The shorthand "clean" is defined in both the top Makefile and scripts/Makefile.clean. Likewise, "hdr-inst" is defined in both the top Makefile and scripts/Makefile.headersinst. The idea here is define and export them in the top Makefile because $(srctree) is constant during the build process. For consistency, "build" and "modbuiltin" should be also moved. Signed-off-by: Masahiro Yamada --- Makefile | 13 ++++++------- scripts/Kbuild.include | 12 ------------ scripts/Makefile.clean | 5 ----- scripts/Makefile.headersinst | 1 - 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 52c1297..cb29318 100644 --- a/Makefile +++ b/Makefile @@ -440,6 +440,12 @@ export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ --exclude CVS --exclude .pc --exclude .hg --exclude .git +# Shorthands +export build := -f $(srctree)/scripts/Makefile.build obj +export modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj +export clean := -f $(srctree)/scripts/Makefile.clean obj +export hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj + # =========================================================================== # Rules shared between *config targets and build targets @@ -1035,8 +1041,6 @@ firmware_install: FORCE #Default location for installed headers export INSTALL_HDR_PATH = $(objtree)/usr -hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj - # If we do an all arch process set dst to asm-$(hdr-arch) hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) @@ -1580,11 +1584,6 @@ ifneq ($(cmd_files),) include $(cmd_files) endif -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir -# Usage: -# $(Q)$(MAKE) $(clean)=dir -clean := -f $(srctree)/scripts/Makefile.clean obj - endif # skip-makefile PHONY += FORCE diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 65e7b08..98f081b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -167,18 +167,6 @@ ld-ifversion = $(shell [ $(call ld-version) $(1) $(2) ] && echo $(3)) ###### -### -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= -# Usage: -# $(Q)$(MAKE) $(build)=dir -build := -f $(srctree)/scripts/Makefile.build obj - -### -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj= -# Usage: -# $(Q)$(MAKE) $(modbuiltin)=dir -modbuiltin := -f $(srctree)/scripts/Makefile.modbuiltin obj - # Prefix -I with $(srctree) if it is not an absolute path. # skip if -I has no parameter addtree = $(if $(patsubst -I%,%,$(1)), \ diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index b1c668d..2acaabd 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -7,11 +7,6 @@ src := $(obj) PHONY := __clean __clean: -# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir -# Usage: -# $(Q)$(MAKE) $(clean)=dir -clean := -f $(srctree)/scripts/Makefile.clean obj - # The filename Kbuild has precedence over Makefile kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 8ccf830..1106d6c 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -122,7 +122,6 @@ $(check-file): scripts/headers_check.pl $(output-files) FORCE endif # Recursion -hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj .PHONY: $(subdirs) $(subdirs): $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@