From patchwork Wed Oct 4 03:56:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 114721 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2632109qgn; Tue, 3 Oct 2017 20:57:41 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBRkPOe78MdEuVi/8kvc1iJUNz3ckdGIOnqkNpMHLUDmAEHlTXQZFynoSaNYer7kgegizkS X-Received: by 10.84.132.66 with SMTP id 60mr18770151ple.158.1507089461363; Tue, 03 Oct 2017 20:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507089461; cv=none; d=google.com; s=arc-20160816; b=RK75OdNu45nBKGeGW98N1DnFGXdD05TP1jKWdrkPynglBXF5o1NMtN8q8xnKDQ09bE HYZIk/EPFn5znsbR3iYw6sLgXXuzd+zGpuHGtWVzVlSY/JWKKMWB+4ZVtBLTiK52xN6X 3ntVHaeQoDbZ0O/945NhO5Cjz0K39n7e+N4s4L4RIZdYVeyFOymK67Jx8uhXTPsdmXHD QByYJHAToXD8u/Gf6yWkt+qZ6TMpZL3kWT0PhsZjLTc5HpLQeO16/1E61kzfProB9Wbz aNfCb93E1ajwLmZaI9/bEl/MmKcFkeaBtU+veHCDGFipNdebOvahVHe5FfRDw24CKVbe 82tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=XMCZDJ9HPinVSKIZn38d7DIoXDS/DClxUKwmJGuUu/s=; b=ltlps/x/DQtV8vBL2/vIBEFIm6PH/qiPQ55jLKcYiSbaTWFglrxUntz/CZbINHCidJ 4CtkhBS/JxoT9vMEdCPG+wVZmGmnlPI2Y05fytU8o81y+7pbY7YcFdoNyL154As02Kt+ SA3xjS+JUGQFWAliKRqshhZiTT4O5Ezavh8DgUvROhQ4ShVwGr6RKhJuawMIEhKCL4x4 9YrCnVcSZIJ6IK9Wi7L2SevIQplC9TeyN//3JjC64mKDktMm0ldMlxJPpC8Xsfu+b2pg MIeFjTXtHIBL0ueVuBZr8DIXb1AIvNsDRD2APf7zkMYqLiT56S42v7U/GuyY7RcsdEED Z5iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rRwAf3A4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n62si11188648pfh.131.2017.10.03.20.57.41; Tue, 03 Oct 2017 20:57:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rRwAf3A4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752135AbdJDD5i (ORCPT + 26 others); Tue, 3 Oct 2017 23:57:38 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:25223 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527AbdJDD5c (ORCPT ); Tue, 3 Oct 2017 23:57:32 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v943u8Pm001949; Wed, 4 Oct 2017 12:56:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v943u8Pm001949 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1507089369; bh=XMCZDJ9HPinVSKIZn38d7DIoXDS/DClxUKwmJGuUu/s=; h=From:To:Cc:Subject:Date:From; b=rRwAf3A49bFlKJ3KowDfQ/gBQO9bKIRsmrSaVPNAUuYYio9q1Jb7g8aWlYljHYHPR tEKHHvbkRQNgnE2tJF38UaXFvW/+ZB9I8dGtocTbRr4N9msPRIZoBLYqvH7z224FHD Wfg5OG5nwzOL+hY3xUs0GpWRyP2yFH0cJaK7xlrnVN7X9Ttrb6FSTKx+emoJULrOd2 alMWqCmpYElo9I/hG5eQm7mt5wWcT44szI+HSNGdjQ6yXOfTLzEhiqiQjJ9INGkssK vX1gDdLvboPPx8QbxAX21IEamTd5j4HfmfVh4fATmwrKqFDoxyrEvCNFw5XuobqD9J np3w4d2scTp2g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 1/4] kbuild: replace $(hdr-arch) with $(SRCARCH) Date: Wed, 4 Oct 2017 12:56:04 +0900 Message-Id: <1507089367-10402-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit 5e53879008b9 ("sparc,sparc64: unify Makefile"), hdr-arch and SRCARCH always match. Signed-off-by: Masahiro Yamada --- Makefile | 21 +++++++++------------ scripts/Makefile.headersinst | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) -- 2.7.4 Reviewed-by: Douglas Anderson diff --git a/Makefile b/Makefile index cf007a3..8d900ba 100644 --- a/Makefile +++ b/Makefile @@ -283,9 +283,6 @@ ifeq ($(ARCH),tilegx) SRCARCH := tile endif -# Where to locate arch specific headers -hdr-arch := $(SRCARCH) - KCONFIG_CONFIG ?= .config export KCONFIG_CONFIG @@ -378,8 +375,8 @@ CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,) # Use USERINCLUDE when you must reference the UAPI directories only. USERINCLUDE := \ - -I$(srctree)/arch/$(hdr-arch)/include/uapi \ - -I$(objtree)/arch/$(hdr-arch)/include/generated/uapi \ + -I$(srctree)/arch/$(SRCARCH)/include/uapi \ + -I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \ -I$(srctree)/include/uapi \ -I$(objtree)/include/generated/uapi \ -include $(srctree)/include/linux/kconfig.h @@ -387,8 +384,8 @@ USERINCLUDE := \ # Use LINUXINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option LINUXINCLUDE := \ - -I$(srctree)/arch/$(hdr-arch)/include \ - -I$(objtree)/arch/$(hdr-arch)/include/generated \ + -I$(srctree)/arch/$(SRCARCH)/include \ + -I$(objtree)/arch/$(SRCARCH)/include/generated \ $(if $(KBUILD_SRC), -I$(srctree)/include) \ -I$(objtree)/include \ $(USERINCLUDE) @@ -1134,8 +1131,8 @@ headerdep: #Default location for installed headers export INSTALL_HDR_PATH = $(objtree)/usr -# If we do an all arch process set dst to include/arch-$(hdr-arch) -hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include) +# If we do an all arch process set dst to include/arch-$(SRCARCH) +hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(SRCARCH), dst=include) PHONY += archheaders archheaders: @@ -1153,10 +1150,10 @@ headers_install_all: PHONY += headers_install headers_install: __headers - $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \ + $(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/Kbuild),, \ $(error Headers not exportable for the $(SRCARCH) architecture)) $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) + $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) PHONY += headers_check_all headers_check_all: headers_install_all @@ -1165,7 +1162,7 @@ headers_check_all: headers_install_all PHONY += headers_check headers_check: headers_install $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1 - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi $(hdr-dst) HDRCHECK=1 # --------------------------------------------------------------------------- # Kernel selftest diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 343d586..5692d7a 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -30,7 +30,7 @@ __headers: $(subdirs) $(subdirs): $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@ -# Skip header install/check for include/uapi and arch/$(hdr-arch)/include/uapi. +# Skip header install/check for include/uapi and arch/$(SRCARCH)/include/uapi. # We have only sub-directories there. skip-inst := $(if $(filter %/uapi,$(obj)),1) From patchwork Wed Oct 4 03:56:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 114720 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2632076qgn; Tue, 3 Oct 2017 20:57:38 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBrb69O4REOslDlqa9a3vo71e4obSAWWzne64UHlaZcfM6qjc2IhGgpDTdqjiGxosf2oC6R X-Received: by 10.84.128.103 with SMTP id 94mr18574965pla.96.1507089458049; Tue, 03 Oct 2017 20:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507089458; cv=none; d=google.com; s=arc-20160816; b=mnoCsoNsuxHq4n+QvWVNa7IyAW6ZLIYK/IyTlOFWK+P1Tl0FwbTNX2YRzCa6PJ9yyr UmgcVCMj4KD870+bjH2qr5bZIkMYqfbqLyMEJs8LrUQjb+p956fldGNjyW/GeOqj7Uh+ Ei/BVVRGaBz5LuaGOHg4+ZaGu2rEKP+P/PdDf5O2eSCXyZTZzdlK5At1xD2bKIwEZU9Z czco5RPHf5Vn9rwTutGNpwZfrbKt1fbe9ffBEz+k1z0LRtvTQkDN1hFKiKio2Zz/r6GY 8nygx4AgdfgmJqiXhm1wB+i34IGHoC2UqE7/QE9fN/SpUAALP95weq3A38WXT2qk2CM3 k/zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=4Hvn9rLgmS6rf18nqjP/VtHGDL4ZONuweOfitqmJJH4=; b=ulbO9jZ84P8/KABA4L0jp9bGeCsCxrp10zISp2z49WVzX4Yg46gOsfsbwhnl1s5Trm cMVzngVMi8OmVFha5hpF635ROYp4yTsIvTtX0mKYOaB+DHovY5pKRvswMMO918m/oVY2 G4RILbZteSNEoYl9z92xGZd/gIH3VFcchLnJLWzK7ucuxTIFEIzyu8o7oSTFjTiWnIGX ioAcgLACRmshMoeLXhGS9Te1RY41e5DJA1ea96JU7MV+5cv0i20qh0oFuqkvoHjTub6e PD06rWN7z6DJ3G3Ir4wPv3e8RGFRnQYEnYM2AjsUFw6/K2q04IhdqGxh77BQ56ZwozFB cfFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=A7v93bDk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si11534419pla.257.2017.10.03.20.57.37; Tue, 03 Oct 2017 20:57:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=A7v93bDk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752095AbdJDD5g (ORCPT + 26 others); Tue, 3 Oct 2017 23:57:36 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:25258 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751776AbdJDD5c (ORCPT ); Tue, 3 Oct 2017 23:57:32 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v943u8Pn001949; Wed, 4 Oct 2017 12:56:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v943u8Pn001949 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1507089369; bh=4Hvn9rLgmS6rf18nqjP/VtHGDL4ZONuweOfitqmJJH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A7v93bDkeGcE0/3uem3b6aG5aOiN9WT7o5sCBv8nd8xumKUfNasmCKaA31y6YtNYZ 5UY7fOXZ8uSOgPJ3qqYdQ9mW70ZW456Kcyl5Zu7B2JurU5rLsQmgHRGUvuPNydnSep xlFOpC/jN6c/5R1yvKkfPfuo9bd4V7CQBWOEYQTgWeNQ2Fx0lLsOw9Q/oB+MlhEAAV ToU/pVPxl+Dpz7WdcPzI5fz/vt86ulTH/h5xWX9fBstpng9+slSxnUqVtfXG/+bUSI Aumv4mKYBrzL+u1zTBCpZe3eInWMh7hFfQWThSSMfYD9AuftF+yfs9TVCLYGWIQj1k SCLXJ42RPTCcg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 2/4] kbuild: move "_all" target out of $(KBUILD_SRC) conditional Date: Wed, 4 Oct 2017 12:56:05 +0900 Message-Id: <1507089367-10402-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507089367-10402-1-git-send-email-yamada.masahiro@socionext.com> References: <1507089367-10402-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first "_all" occurrence around line 120 is only visible when KBUILD_SRC is unset. If O=... is specified, the working directory is relocated, then the only second occurrence around line 193 is visible, that is not set to PHONY. Move the first one to an always visible place. This clarifies "_all" is our default target and it is always set to PHONY. Signed-off-by: Masahiro Yamada --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.7.4 Reviewed-by: Douglas Anderson diff --git a/Makefile b/Makefile index 8d900ba..39a7c03 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ NAME = Fearless Coyote # Comments in this file are targeted only to the developer, do not # expect to learn how to build the kernel reading this file. +# That's our default target when none is given on the command line +PHONY := _all +_all: + # o Do not use make's built-in rules and variables # (this increases performance and avoids hard-to-debug behaviour); # o Look for make include files relative to root of kernel src @@ -116,10 +120,6 @@ ifeq ("$(origin O)", "command line") KBUILD_OUTPUT := $(O) endif -# That's our default target when none is given on the command line -PHONY := _all -_all: - # Cancel implicit rules on top Makefile $(CURDIR)/Makefile Makefile: ; From patchwork Wed Oct 4 03:56:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 114723 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2632437qgn; Tue, 3 Oct 2017 20:58:16 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB9c2Bz8QVZSM59EoFFllFRkwsQGKCQnbBreYJqumlOBhgmKjCJ/iRdr4RZiD36VowE9vKO X-Received: by 10.84.135.34 with SMTP id 31mr19155401pli.306.1507089495954; Tue, 03 Oct 2017 20:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507089495; cv=none; d=google.com; s=arc-20160816; b=MfJohl72LixNOocEgYNaNVDLMVFROlnU8YmpWvvzkZYuQoaIXqhhktcisb4FhZTrqr QVExQvjO7t/yWdjAOzrsFa+Jm3SUD+LPhU6IoOEyefCHfz6Hvl/9OdySQR0BHR4vBQPu 3Cp5m4uiyFdzTbz4uLzKgXFy7AjGh1Y5l4AykuIJyDpehGDujzF+BJObf1J3M82wlYjp +r81tQg5qBXgKpc7S6MWwzV1kWqzi4NH0sBNA+/5aHxLVmlOHKxhSeCEeYm1ZMau7cBR /XkrZakDuB7eefFEpJFdC+WFD8gw2w57FGlF1NGv/YY0mITuA4NJMazujqhTzlgSyMk6 ER7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=kG2IaCFF2P9JZ1cSGjeEM6scX9bHMvjJJVkBVhor0JE=; b=UaZWxGQOj+/6OP4EyzlSapN6z1+0tXgzhQhqRyMCUAavQsAyi8wX1Klz2vMvY5vyVI EUOXOfU1WoEYZImQMxz9248NIfKt+I3Z7fL7nj1DvbqhGBhT4W4VjO3KrCbYxkGPSP++ KU7Z9yCWGquN5wel+WOFNgPLelOeH0H7jQh6xMocR0xXOTA9bQ7L8CDN7EIahIgPJdrt z/iMcRKxQZvFj5yqQaT+JGroLPvhnk4Abjf3gS8+u4ss8QqhIOE6hoNFnYkdStgkuoFi 3e68MlA9GlBQ1LbsXvc0B5s/AEMpMYsZKDqrqn+WVRtvvoxlkADOnmY5tyhz5mK7dFM8 ZA/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=OWszTK2+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j185si410024pgc.543.2017.10.03.20.58.15; Tue, 03 Oct 2017 20:58:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=OWszTK2+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752067AbdJDD5f (ORCPT + 26 others); Tue, 3 Oct 2017 23:57:35 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:25257 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751731AbdJDD5c (ORCPT ); Tue, 3 Oct 2017 23:57:32 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v943u8Po001949; Wed, 4 Oct 2017 12:56:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v943u8Po001949 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1507089370; bh=kG2IaCFF2P9JZ1cSGjeEM6scX9bHMvjJJVkBVhor0JE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWszTK2+BLFMGTGtOqxTwQECEdKVUY6+RHMGHtFwUfMUTYjqhstRQF4CclzvjwBH4 c5wbytqBv5dOJcedaO4AAZVlwAfJ00UH+u5dlwTT627RenjyeQAyPQp/T6+zWLSNcE XDiGmQCnKIPg6+U53M66yYCHuCVWEMtctISz6QRAcn6RhSGsfFoz+2RPHMMwz8vSoo PqFtf8ANR2iRg/QD1s8P8dD2PMOfBDMwOVEMbPE62UtgzE9PVVpCtd5GlyXcw1HEVv RBETw4rPWHGFfoItqZEIDrMqjWyzeygojGqQNTWY9dLNEkcjGIZOCeblbZfcPwRZya QipkAvxarKn7Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 3/4] kbuild: re-order the code to not parse unnecessary variables Date: Wed, 4 Oct 2017 12:56:06 +0900 Message-Id: <1507089367-10402-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507089367-10402-1-git-send-email-yamada.masahiro@socionext.com> References: <1507089367-10402-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The top Makefile is divided into some sections such as mixed targets, config targets, build targets, etc. When we build mixed targets, Kbuild just invokes submake to process them one by one. In this case, compiler-related variables like CC, KBUILD_CFLAGS, etc. are unneeded. Check what kind of targets we are building first, then parse necessary variables for building them. Signed-off-by: Masahiro Yamada --- Makefile | 233 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 118 insertions(+), 115 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 39a7c03..a4fd682 100644 --- a/Makefile +++ b/Makefile @@ -186,15 +186,6 @@ ifeq ("$(origin M)", "command line") KBUILD_EXTMOD := $(M) endif -# If building an external module we do not care about the all: rule -# but instead _all depend on modules -PHONY += all -ifeq ($(KBUILD_EXTMOD),) -_all: all -else -_all: modules -endif - ifeq ($(KBUILD_SRC),) # building in the source tree srctree := . @@ -206,6 +197,9 @@ else srctree := $(KBUILD_SRC) endif endif + +export KBUILD_CHECKSRC KBUILD_EXTMOD KBUILD_SRC + objtree := . src := $(srctree) obj := $(objtree) @@ -214,6 +208,74 @@ VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) export srctree objtree VPATH +# To make sure we do not include .config for any of the *config targets +# catch them early, and hand them over to scripts/kconfig/Makefile +# It is allowed to specify more targets when calling make, including +# mixing *config targets and build targets. +# For example 'make oldconfig all'. +# Detect when mixed targets is specified, and make a second invocation +# of make so .config is not included in this case either (for *config). + +version_h := include/generated/uapi/linux/version.h +old_version_h := include/linux/version.h + +no-dot-config-targets := clean mrproper distclean \ + cscope gtags TAGS tags help% %docs check% coccicheck \ + $(version_h) headers_% archheaders archscripts \ + kernelversion %src-pkg + +config-targets := 0 +mixed-targets := 0 +dot-config := 1 + +ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) + ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) + dot-config := 0 + endif +endif + +ifeq ($(KBUILD_EXTMOD),) + ifneq ($(filter config %config,$(MAKECMDGOALS)),) + config-targets := 1 + ifneq ($(words $(MAKECMDGOALS)),1) + mixed-targets := 1 + endif + endif +endif +# install and modules_install need also be processed one by one +ifneq ($(filter install,$(MAKECMDGOALS)),) + ifneq ($(filter modules_install,$(MAKECMDGOALS)),) + mixed-targets := 1 + endif +endif + +ifeq ($(mixed-targets),1) +# =========================================================================== +# We're called with mixed targets (*config and build targets). +# Handle them one by one. + +PHONY += $(MAKECMDGOALS) __build_one_by_one + +$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one + @: + +__build_one_by_one: + $(Q)set -e; \ + for i in $(MAKECMDGOALS); do \ + $(MAKE) -f $(srctree)/Makefile $$i; \ + done + +else + +# We need some generic definitions (do not try to remake the file). +scripts/Kbuild.include: ; +include scripts/Kbuild.include + +# Read KERNELRELEASE from include/config/kernel.release (if it exists) +KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) +KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) +export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION + # SUBARCH tells the usermode build what the underlying arch is. That is set # first, and if a usermode build is happening, the "ARCH=um" on the command # line overrides the setting of ARCH below. If a native build is happening, @@ -308,40 +370,6 @@ HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter \ -Wno-missing-field-initializers -fno-delete-null-pointer-checks endif -# Decide whether to build built-in, modular, or both. -# Normally, just do built-in. - -KBUILD_MODULES := -KBUILD_BUILTIN := 1 - -# If we have only "make modules", don't compile built-in objects. -# When we're building modules with modversions, we need to consider -# the built-in objects during the descend as well, in order to -# make sure the checksums are up to date before we record them. - -ifeq ($(MAKECMDGOALS),modules) - KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) -endif - -# If we have "make modules", compile modules -# in addition to whatever we do anyway. -# Just "make" or "make all" shall build modules as well - -ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) - KBUILD_MODULES := 1 -endif - -ifeq ($(MAKECMDGOALS),) - KBUILD_MODULES := 1 -endif - -export KBUILD_MODULES KBUILD_BUILTIN -export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD - -# We need some generic definitions (do not try to remake the file). -scripts/Kbuild.include: ; -include scripts/Kbuild.include - # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld @@ -406,11 +434,6 @@ KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds -# Read KERNELRELEASE from include/config/kernel.release (if it exists) -KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) -KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) - -export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE @@ -459,73 +482,6 @@ ifneq ($(KBUILD_SRC),) $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) endif -# Support for using generic headers in asm-generic -PHONY += asm-generic uapi-asm-generic -asm-generic: uapi-asm-generic - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ - src=asm obj=arch/$(SRCARCH)/include/generated/asm -uapi-asm-generic: - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ - src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm - -# To make sure we do not include .config for any of the *config targets -# catch them early, and hand them over to scripts/kconfig/Makefile -# It is allowed to specify more targets when calling make, including -# mixing *config targets and build targets. -# For example 'make oldconfig all'. -# Detect when mixed targets is specified, and make a second invocation -# of make so .config is not included in this case either (for *config). - -version_h := include/generated/uapi/linux/version.h -old_version_h := include/linux/version.h - -no-dot-config-targets := clean mrproper distclean \ - cscope gtags TAGS tags help% %docs check% coccicheck \ - $(version_h) headers_% archheaders archscripts \ - kernelversion %src-pkg - -config-targets := 0 -mixed-targets := 0 -dot-config := 1 - -ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) - ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) - dot-config := 0 - endif -endif - -ifeq ($(KBUILD_EXTMOD),) - ifneq ($(filter config %config,$(MAKECMDGOALS)),) - config-targets := 1 - ifneq ($(words $(MAKECMDGOALS)),1) - mixed-targets := 1 - endif - endif -endif -# install and modules_install need also be processed one by one -ifneq ($(filter install,$(MAKECMDGOALS)),) - ifneq ($(filter modules_install,$(MAKECMDGOALS)),) - mixed-targets := 1 - endif -endif - -ifeq ($(mixed-targets),1) -# =========================================================================== -# We're called with mixed targets (*config and build targets). -# Handle them one by one. - -PHONY += $(MAKECMDGOALS) __build_one_by_one - -$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one - @: - -__build_one_by_one: - $(Q)set -e; \ - for i in $(MAKECMDGOALS); do \ - $(MAKE) -f $(srctree)/Makefile $$i; \ - done - -else ifeq ($(config-targets),1) # =========================================================================== # *config targets only - make sure prerequisites are updated, and descend @@ -548,6 +504,44 @@ else # Build targets only - this includes vmlinux, arch specific targets, clean # targets and others. In general all targets except *config targets. +# If building an external module we do not care about the all: rule +# but instead _all depend on modules +PHONY += all +ifeq ($(KBUILD_EXTMOD),) +_all: all +else +_all: modules +endif + +# Decide whether to build built-in, modular, or both. +# Normally, just do built-in. + +KBUILD_MODULES := +KBUILD_BUILTIN := 1 + +# If we have only "make modules", don't compile built-in objects. +# When we're building modules with modversions, we need to consider +# the built-in objects during the descend as well, in order to +# make sure the checksums are up to date before we record them. + +ifeq ($(MAKECMDGOALS),modules) + KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) +endif + +# If we have "make modules", compile modules +# in addition to whatever we do anyway. +# Just "make" or "make all" shall build modules as well + +ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) + KBUILD_MODULES := 1 +endif + +ifeq ($(MAKECMDGOALS),) + KBUILD_MODULES := 1 +endif + +export KBUILD_MODULES KBUILD_BUILTIN + ifeq ($(KBUILD_EXTMOD),) # Additional helpers built in scripts/ # Carefully list dependencies so we do not try to build scripts twice @@ -1063,6 +1057,15 @@ prepare0: archprepare gcc-plugins # All the preparing.. prepare: prepare0 prepare-objtool +# Support for using generic headers in asm-generic +PHONY += asm-generic uapi-asm-generic +asm-generic: uapi-asm-generic + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + src=asm obj=arch/$(SRCARCH)/include/generated/asm +uapi-asm-generic: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm + PHONY += prepare-objtool prepare-objtool: $(objtool_target) From patchwork Wed Oct 4 03:56:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 114722 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2632212qgn; Tue, 3 Oct 2017 20:57:51 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBPINWxoddv3ZeYZSyp8mMKPuziORKI9ljwhYtw82boEKmbdnyNQ3DDWoI0tPhrcqUNSv5t X-Received: by 10.159.245.141 with SMTP id a13mr13999540pls.441.1507089471698; Tue, 03 Oct 2017 20:57:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507089471; cv=none; d=google.com; s=arc-20160816; b=E9PgNb9AoG0Q3mHyxbKg1mXPQ43VWbeZOo6KADRGA8PVgg6tXoCY5ZUi7hyVnqO+hv tBDgbm5etJ9pDYsJNaw26Poxnav45Rr+bYfD3RREJawGW5S6t1peTw17RC4QkQ6z9vr5 9fh0s2XnM+dgZXZ3G4JmvTOhkogSCtOExAE9JQFtkJdoFjeD0TjKcaQPElnYyWbc4Eqq WaK0VG8Rdzd+8UPh9eNTxMj2t6vFDkJZYhiV7tS5voJ0HuO1tPHfMtZzmX17Cw/QjNTD YgFRlvR8hGX7RXMj7TTrOgLH56h8RIYmI71BOAYhi8Mj4j5bWOjLt4JPBTwUijWWR9vV i5Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=RNuM0MTrReCiZBCIb2/oxKdPp6yQ0Y1AAuRaiTLtJss=; b=fU+tqZjoAc5v8yaNhYiIitwepI8dGqp2zOwM4TZg4SRl0C0/GSX2GE1JlomPTOgKQT a8lZ4n4yxrcMo182RePg79FRM9p3vWv75LiS6G21G8c+ivHjhqFbNo5knOn2yhjQzA/s copmX3mUCtfgGXaA4BAReCY16wnErGpc1vyTqd/ygZrBy2axQ0pC3mMU3puiaeKISJXj /riW3wodghm8eR5vXJN5RcvmgiCivpsZdfihJUOVafIJqjhg5JrxNxitEyYXLpVmGtIJ 9i2Kjhgi7hfDJZRI466EftFgZTID917k8DAemzyMcxWw0gG8mAgaB+SbgLr2tnNCzQdl 9ioQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=PaUmGQ2H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n62si11188648pfh.131.2017.10.03.20.57.51; Tue, 03 Oct 2017 20:57:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=PaUmGQ2H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752114AbdJDD5h (ORCPT + 26 others); Tue, 3 Oct 2017 23:57:37 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:25229 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751692AbdJDD5c (ORCPT ); Tue, 3 Oct 2017 23:57:32 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v943u8Pp001949; Wed, 4 Oct 2017 12:56:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v943u8Pp001949 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1507089371; bh=RNuM0MTrReCiZBCIb2/oxKdPp6yQ0Y1AAuRaiTLtJss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PaUmGQ2HRp29kH2XIqOjBQtmKTCJI0H002EGXjxQ8hdkRH3H385UhUvdaPxmLOWhE 0zoSKYjsBtk4Nej8EYerpV6MhV9l8YXoM0bqM9A6IzHEblrq1AOIuaStVBBixgRtR5 z5I5L4G9TiwXkHfekjguyASnJXeouxvN3Q8CVnGh35gcPU1+/WblnUo/j3QMhZCc+Z YdUT6hIhJxumvQ9EfbRb6BLPeycnPVbKDEn5L4FGhD1FnM8+evDpKQtDiSdRW3de9H Q2FPrdP86MVBXCl+N3SMQjGNZxdkqQhgAVONLeIP4cPlxllnGY45ZSqo83niZOcKUO JZJ/xG920y8dg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [RFC PATCH 4/4] kbuild: evaluate cc-option and friends only when building kernel Date: Wed, 4 Oct 2017 12:56:07 +0900 Message-Id: <1507089367-10402-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507089367-10402-1-git-send-email-yamada.masahiro@socionext.com> References: <1507089367-10402-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org $(call cc-option,...) is costly because it invokes the C compiler. Given that only some targets need compiler flags, it is pointless to compute them all the time. The variable no-dot-config-targets lists the targets we can run without the .config file, such as "make clean", "make help", etc. My idea is similar here. We can add no-compiler-targets to list the targets we can run without the target compiler information. This includes no-dot-config-targets + config targets + misc. When we run only targets listed in the no-compiler-targets, we can set cc-option and friends to no-op. The hostcc-option is an exception since the host compiler is needed for building fixdep, kconfig, etc. I did not add "dtbs" and "%.dtb" to no-compiler-targets. This is intentional. Theoretically, we can build device tree blobs without the C compiler. It it true that in-kernel DT files are pre-processed by CPP before DTC, but KBUILD_CPPFLAGS is unused. However, for the reason of scripts/dtc/ location, Kbuild descends into scripts/mod/ before the DT build. I do not want to trigger the unrelated re-build of modpost when building DT. Perhaps, we can fix this with further refactoring, but not now. Signed-off-by: Masahiro Yamada --- Makefile | 10 ++++++++++ scripts/Kbuild.include | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index a4fd682..80e1a38 100644 --- a/Makefile +++ b/Makefile @@ -224,9 +224,13 @@ no-dot-config-targets := clean mrproper distclean \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg +no-compiler-targets := $(no-dot-config-targets) config %config \ + kernelrelease image_name + config-targets := 0 mixed-targets := 0 dot-config := 1 +need-compiler := 1 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) @@ -234,6 +238,12 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) endif endif +ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),) + ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),) + need-compiler := 0 + endif +endif + ifeq ($(KBUILD_EXTMOD),) ifneq ($(filter config %config,$(MAKECMDGOALS)),) config-targets := 1 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 9ffd3dd..222d0a2 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -96,6 +96,13 @@ try-run = $(shell set -e; \ fi; \ rm -f "$$TMP" "$$TMPO") +# hostcc-option +# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) +hostcc-option = $(call __cc-option, $(HOSTCC),\ + $(HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2)) + +ifeq ($(need-compiler),1) + # as-option # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) @@ -123,11 +130,6 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) cc-option = $(call __cc-option, $(CC),\ $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2)) -# hostcc-option -# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) -hostcc-option = $(call __cc-option, $(HOSTCC),\ - $(HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2)) - # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(call try-run,\ @@ -180,6 +182,8 @@ ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh) # Usage: $(call ld-ifversion, -ge, 22252, y) ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4)) +endif + ###### ###