From patchwork Mon Nov 13 10:29:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 118722 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1625547qgn; Mon, 13 Nov 2017 02:31:46 -0800 (PST) X-Google-Smtp-Source: AGs4zMah6cTxck+KcwvxxYldL/gVaQQTE1r73u1hHRvfj6bWX2HiaPL8RM0xeZSL5rDmjOUEJJJV X-Received: by 10.101.82.130 with SMTP id y2mr8190303pgp.65.1510569106182; Mon, 13 Nov 2017 02:31:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510569106; cv=none; d=google.com; s=arc-20160816; b=IM5TIwIlYm7Nnat0cZussEkJ7cZtZTm4G8H1YXx4ntFZ93UHRg3SDYYeoNZp4ggGuJ MP7JigX8iTvdDXV4am+OC+qRdA9/I9GhAvi7sDv0w3ic64Vcoubr9hUEjmhchXuE2NSW XjsctKZZKRn1pba7BI+aBD9dp8SOpQPn7SMVOsh2++5UarjqyT7V4FaX5YagjeefvN5F IJECsrf28Y59w7WF1iqD3ccwnjEFnq1SmdNLHnIBElOo1L2ZfJDj+9oO6ml9rzNPYCjK uAXoJMbiE/V3Et+KpCseP6Mn5owykil//tZdkAdXSKBioqcz2hYO/5s6wHEtBkGPfBEq XQpw== 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=qaZXLHYoiB/ipFxL+tv9kxYX+kTaG7OkVcK45xoIg8Y=; b=AEeH1u+flQdH/GAqBM/+KqLi3tMIBlK1dcWqBHI0qbsHedFEZ3f8vb4kAApVaDMHRd BXNJEjq0VIPolT+8jpsrxcK+Cvaur8T96bW15TyIRUky0WtXy5+4xVaAOtEh0yNH7h3z 5btpW04P7itx+3nOl0IlRUuiXQFILilEhmJ3a0GXlHfvvBFF7rLzd+fHCIx48UbJfIBe unIM2znUuFfDQePCa3A0JfPoe/qMIt3swNMFuQdR6wwsG+bsrIVBmYvFEoHQdZvSqked BCFkke4VWKsQwuXodk5+eRGuXnAaiTGsjDEm1HpI9VY38q0NvC2omFm+5kUNMB91tTOE UhRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=K9sMH4ZH; 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 w23si14193381plk.389.2017.11.13.02.31.45; Mon, 13 Nov 2017 02:31:46 -0800 (PST) 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=K9sMH4ZH; 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 S1752539AbdKMKbn (ORCPT + 27 others); Mon, 13 Nov 2017 05:31:43 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40628 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbdKMKbf (ORCPT ); Mon, 13 Nov 2017 05:31:35 -0500 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 vADATvx2031253; Mon, 13 Nov 2017 19:29:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com vADATvx2031253 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1510568999; bh=qaZXLHYoiB/ipFxL+tv9kxYX+kTaG7OkVcK45xoIg8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9sMH4ZHfOoWvgfXnsrHqvjYMBzSymo+KwM+QRdIJES7D1CzaVfPWH0R9bKFS+o2m EDXFtJZRHbe99gArqI9+PW7FTZtAb2EGxNMizj89p/ch3Z4rK0F/HChaGTa+CT/gw7 aHXN7b60euzKhq2dJOgmn+8DsTUWewY5jSI+HEoY5aVaDQo2RRuE6mkp7DRn4F82ba 50yNXlsGaAs6uvLE1q8C4dKB3uWVSh4RdL/z0q+45in6+JpoizmKYqkTBy1sjI/WE2 x/O6UEAQlgjnJRqAR5VV47WQwNbruP2InMNXIBoWDzkmmMR0XtZ1uoPVUxJ9J/MfSi SAs3dabNAraBg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , Michal Marek , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/6] kbuild: create directory for make cache only when necessary Date: Mon, 13 Nov 2017 19:29:34 +0900 Message-Id: <1510568979-24440-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510568979-24440-1-git-send-email-yamada.masahiro@socionext.com> References: <1510568979-24440-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 Currently, the existence of $(dir $(make-cache)) is always checked, and created if it is missing. We can avoid unnecessary system calls by some tricks. [1] If KBUILD_SRC is unset, we are building in the source tree. The output directory checks can be entirely skipped. [2] If at least one cache data is found, it means the cache file was included. Obviously its directory exists. Skip "mkdir -p". [3] If Makefile does not contain any call of __run-and-store, it will not create a cache file. No need to create its directory. [4] The "mkdir -p" should be only invoked by the first call of __run-and-store Signed-off-by: Masahiro Yamada Reviewed-by: Douglas Anderson --- Changes in v2: - Use boolean flag "create-cache-dir" for clarification - Fix a typo in git-log: Obiously -> Obviously scripts/Kbuild.include | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index be1c9d6..065324a 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -99,18 +99,19 @@ cc-cross-prefix = \ # Include values from last time make-cache := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/,$(if $(obj),$(obj)/)).cache.mk -ifeq ($(wildcard $(dir $(make-cache))),) -$(shell mkdir -p '$(dir $(make-cache))') -endif $(make-cache): ; -include $(make-cache) +cached-data := $(filter __cached_%, $(.VARIABLES)) + # If cache exceeds 1000 lines, shrink it down to 500. -ifneq ($(word 1000,$(filter __cached_%, $(.VARIABLES))),) +ifneq ($(word 1000,$(cached-data)),) $(shell tail -n 500 $(make-cache) > $(make-cache).tmp; \ mv $(make-cache).tmp $(make-cache)) endif +create-cache-dir := $(if $(KBUILD_SRC),$(if $(cache-data),,1)) + # Usage: $(call __sanitize-opt,Hello=Hola$(comma)Goodbye Adios) # # Convert all '$', ')', '(', '\', '=', ' ', ',', ':' to '_' @@ -136,6 +137,10 @@ __sanitize-opt = $(subst $$,_,$(subst $(right_paren),_,$(subst $(left_paren),_,$ define __run-and-store ifeq ($(origin $(1)),undefined) $$(eval $(1) := $$(shell $$(2))) +ifeq ($(create-cache-dir),1) + $$(shell mkdir -p $(dir $(make-cache))) + $$(eval create-cache-dir :=) +endif $$(shell echo '$(1) := $$($(1))' >> $(make-cache)) endif endef From patchwork Mon Nov 13 10:29:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 118724 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1626070qgn; Mon, 13 Nov 2017 02:32:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMYo5gZLUNJ7ZlykFiqS8BhwVfwk1uff1HExZ/LufGyK7G2YPK1gpOsB6V1iO/n1V8rKNAx1 X-Received: by 10.84.138.131 with SMTP id 3mr8407580plp.238.1510569142022; Mon, 13 Nov 2017 02:32:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510569142; cv=none; d=google.com; s=arc-20160816; b=BxrZoPWn81Xf5gLe/Qnda2d6+BRBT+F6SDz4LDvksXFfLr3ZMB3MLwXHNQt8R68oHT 11B9BRwIM40oZnZRxz9NEsPSGenHxGmnGO/zqSbRMxXh6iI4GXMbtKw/cPnRbv1Tq1FY L9QEB0VUT9w8bi/lqUXgtlI3Yoj+A35RHzBtD8acNPiXQnVYNzsZ7+la36wBnRpvTvR4 +R84SLOyoZLevonUvNWWFMBRoaPGMaq+Zkq84SE+1ZZp1rpcrU5ibYuibfET1Ejdw7HT 4pt1ayXg6jFrjTDs0+R/qik0TXcfB+hg7z/2o19pwYjBd0teE87QN3gsLiVLHZXztAHd mKug== 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=lIsx0+MDS+hIQ3mjpLrdgftu/jmK0OMZHEsWKEyuAVI=; b=Awj6YQ2tCIzXMatl+G7JeC8j7p7Icm7xW9iIsxLmJBHM9gstFMCI91qzMdlXnwQEZx OsFT4yM89GGHLEa3SDxv5XAoLVUNvtZc0p/bv6I7yVx0qfA1yUEejUohHl3vNS3OREfB JJBoZQb5thOFhvRdVt2aDCQIsmB0eQBSrOJnXHiN5avvlpAVuXstTKH2e6yCp2n9+WU8 mbZO418MzpFy1TLov11RL7xVIDk/2mfKtppI5yF7wA3rJ9JCOqJQVVk0gQk5ISy+zlEI Au44t/qFWNIchjOKqJNlewyQYZbMMT6AxrrIFyy6NqIjT41qEot0Gg/k021PgI0mW1fS I3Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Uqj77aNP; 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 d18si2322432pls.617.2017.11.13.02.32.21; Mon, 13 Nov 2017 02:32:22 -0800 (PST) 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=Uqj77aNP; 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 S1752467AbdKMKbl (ORCPT + 27 others); Mon, 13 Nov 2017 05:31:41 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40662 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752334AbdKMKbg (ORCPT ); Mon, 13 Nov 2017 05:31:36 -0500 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 vADATvx3031253; Mon, 13 Nov 2017 19:29:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com vADATvx3031253 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1510569000; bh=lIsx0+MDS+hIQ3mjpLrdgftu/jmK0OMZHEsWKEyuAVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uqj77aNP+M8A3vjXZHFVpoaLzcQc7WCciYg0FAdHNcB10oP5ALZRKd81f8LzaT+Mt 51baKX50T4x22fBEBejsD98baJi0CDESi95BpiIDEklp2CROl138E5GaXj6sjjhzBU XP68Ok3omF0I2NNQO8wvRSMtYDPqW16YeHNoEVZ4SWQEbPCHnHE2xFqISsWmpXKZlA I8QM+WZosxn5unOiA4o2KIv9dfbMIiiFD9MulxRrdr6/hyUloWIlZUXIpUHheKlQJX +3mOrdZWD1v/4u3QwfOG5opoXyLi+FFdf3VD04fUezhF1V1lLNMI9UIyBMRU0jW88N 168chu9WsvUKQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , Michal Marek , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/6] kbuild: remove redundant $(wildcard ...) for cmd_files calculation Date: Mon, 13 Nov 2017 19:29:35 +0900 Message-Id: <1510568979-24440-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510568979-24440-1-git-send-email-yamada.masahiro@socionext.com> References: <1510568979-24440-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 I do not see any reason why $(wildcard ...) needs to be called twice for computing cmd_files. Remove the first one. Signed-off-by: Masahiro Yamada --- Changes in v2: - Fix "$$" in scripts/Makefile.headersinst per Douglas Makefile | 3 +-- scripts/Makefile.build | 3 +-- scripts/Makefile.headersinst | 3 +-- scripts/Makefile.modpost | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index a7476e6..58dd245 100644 --- a/Makefile +++ b/Makefile @@ -1693,8 +1693,7 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ # read all saved command lines -targets := $(wildcard $(sort $(targets))) -cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) +cmd_files := $(wildcard .*.cmd $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) $(cmd_files): ; # Do not try to update included dependency files diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 061d0c3..62d5314 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -583,8 +583,7 @@ FORCE: # optimization, we don't need to read them if the target does not # exist, we will rebuild anyway in that case. -targets := $(wildcard $(sort $(targets))) -cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) +cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) include $(cmd_files) diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 5692d7a..c6fb2b7 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst @@ -114,9 +114,8 @@ $(check-file): scripts/headers_check.pl $(output-files) FORCE endif -targets := $(wildcard $(sort $(targets))) cmd_files := $(wildcard \ - $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) + $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) include $(cmd_files) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 16923ba..cf125c1 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -143,8 +143,7 @@ FORCE: # optimization, we don't need to read them if the target does not # exist, we will rebuild anyway in that case. -targets := $(wildcard $(sort $(targets))) -cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) +cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) include $(cmd_files) From patchwork Mon Nov 13 10:29:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 118721 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1625518qgn; Mon, 13 Nov 2017 02:31:44 -0800 (PST) X-Google-Smtp-Source: AGs4zMYz5AUm0zPZsud3XD51mN0C/15x9QPYsP2sy+8TZcGPqlmdD7NS/g27QV2F8cmRvipYr8Pl X-Received: by 10.84.149.168 with SMTP id m37mr8459458pla.36.1510569103990; Mon, 13 Nov 2017 02:31:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510569103; cv=none; d=google.com; s=arc-20160816; b=dFFsPtuaJ8FKTi7WbJ1cEOfkYEskvfm0T5YvKbXRAcCNKIUBIPAlFPjgLW0ZNx42ji rUMHU5fmSWb5NQRyqZKy953tzV2GmOl4u2fxUnE8v1zX5bjB4wrzcS0ftkdNkViVtzxH PRUzxyiRVhQX9mbDubBUKbdLNzA2qnCe58MWBvEH9UkeZr+/xdLWuBti24YgfMarNubl MxMHNEnAu+F01BVrivvPj6A1Jzp3a1kV8xxis5ww5m8DihL64c3Rv7Jm4J6QOrCeR/ei C6NLUsgbQnMiDmVjnp23gXku9JvDrIng5HYMDJsP23PjyI36GcvbKES/gNkQGYd0h5SL Rrfw== 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=OkwBV8n2DfSgSr5L5Ljlv3Aj+c8N3myUF4hHzA9rtLU=; b=g+YJv+KvEHj6gM9V7i0uaBoaNxBV9d1+QVcpKejYmQNJWSMppxxt8ZXPVFoajaoeN4 McGO+fuCKMsUZaeum1WPZZByX0If9CSo+Q56pZaqvOVTs0T1vivgvAuvpGyE1htcxr5z uPwyY1gUup9HJpJa9GHuQANf0g55nr3r6n1c3xSkrCN3mzgI4vh/hmpLl7rcAILMUOWM /aNjthvMhi0LHzSwZzdir9hf40kIKjRK+5jjgdkrHUDH+s1brng3DS6cDQz07K+KMp/0 msgaVVceokzXJybK3qRdXsACso7qF77ZQMOn6D5hILkoBKTowU2f90ympW2W2pa9HYrT D8JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Oy8IenXQ; 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 w23si14193381plk.389.2017.11.13.02.31.43; Mon, 13 Nov 2017 02:31:43 -0800 (PST) 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=Oy8IenXQ; 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 S1752501AbdKMKbm (ORCPT + 27 others); Mon, 13 Nov 2017 05:31:42 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40663 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752336AbdKMKbg (ORCPT ); Mon, 13 Nov 2017 05:31:36 -0500 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 vADATvx4031253; Mon, 13 Nov 2017 19:30:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com vADATvx4031253 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1510569000; bh=OkwBV8n2DfSgSr5L5Ljlv3Aj+c8N3myUF4hHzA9rtLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oy8IenXQeXGX3g20F6wcJkV6vrq5wSpSfrt2Vw5wpNXzJIcO+P1aZLLPo6eiRHX8B Fl3azrBZIcQ5wHHiOzk4ORlVM0f5EGM2ymlNmARO4fx/MknfacUUHUQWSfh0Rww/a9 +J2NxKG4XLSaNG+ne/NX8rv/T3FsZ8fX8dshuyWyatgyPSVHKaQWoZmakXe6erBoNd CU6ik/wduXf295cbBgjO5T7B9SJIM4SaTRjQ47LeCcurpeaUoY/2waeRsp1iAxOYOo IaM5qOTrq1+x6OOfDoN0cbMZeg2TlIZkJD3tywlJohrM5KD8zQjmWDctqNKNOkT2wz hx+TLpZio0PbA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , Michal Marek , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/6] kbuild: filter-out PHONY targets from "targets" Date: Mon, 13 Nov 2017 19:29:36 +0900 Message-Id: <1510568979-24440-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510568979-24440-1-git-send-email-yamada.masahiro@socionext.com> References: <1510568979-24440-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 variable "targets" contains object paths for which existing .*.cmd files should be included. scripts/Makefile.build automatically adds $(MAKECMDGOALS) to "targets" as follows: targets += $(extra-y) $(MAKECMDGOALS) $(always) The $(MAKECMDGOALS) is a PHONY target in several places. PHONY targets never create .*.cmd files. Signed-off-by: Masahiro Yamada --- Changes in v2: - Newly added scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 62d5314..6f60377 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -562,7 +562,7 @@ $(multi-used-m): FORCE $(call multi_depend, $(multi-used-m), .o, -objs -y -m) targets += $(multi-used-y) $(multi-used-m) - +targets := $(filter-out $(PHONY), $(targets)) # Descending # --------------------------------------------------------------------------- From patchwork Mon Nov 13 10:29:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 118725 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1626563qgn; Mon, 13 Nov 2017 02:33:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMbOOK5o7bBWNPpKnGjaKIQFgF3h9aYOgTmdFsEMhpN/Emj16Yav4XfcbFcilNEZ2cXkZL8p X-Received: by 10.98.149.72 with SMTP id p69mr9501574pfd.76.1510569183345; Mon, 13 Nov 2017 02:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510569183; cv=none; d=google.com; s=arc-20160816; b=jpQtyUunVqUnJHaEsA6YJbtdGJ+ilCy+vW8xvtOOUk5UXC4g2uCzBQCe18kwU5wAU4 bowVSet/7q0L7qHB9Wjs6AZTQ2SXl69SPwV4S/rIKBL5lnOcKAlvnhb99L/eE+fDK1+9 mUo1YY/H19zHOZeoT5ocjCjefxPnTmhyBKSGZnDd/SNiUeLOxB1wwvpcoCdI37H9SQ0F qV7TtzwM8mv2TO2zBLVdJjFKLQqZNycQdgR3FedO8t73PyAb38WtkRzfT1w9zr5jq7F3 P97ub64V8O4OlGXfpJZH+2LrBAGY9IgjvxJInbG33Dh4OAbkx9ozLMXVkoAU4ctBRTC3 GYXw== 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=iMbzJzLGGfWSt8Kj4N0Di8nASBdW83Egth/k7HOy3FQ=; b=cgPsm+J+Y3IstKwtZFXaueH97BEaPF74J//0ifKDv4PLuZAhsYi32WShzNpTgotpHI RXfAtJFA2fALEuJrSXb/BSOz/pZnHR7aZTHuR4Dc8VR5CcO5HIokbxh+wWN8k4cVELE6 NjyuUUOZTWkZUYQ3EVFnK/sfvybxStjnyKXC/qWmZa2ySnGb2jkPtsbOd/klMhmOB+lD 8BCyZjEtRxQdDGnSFjV5Es/8Ea60tpPfpLNZCrDOOvLeiKtVC6tUbEh6yklEG7CEMG9d NhRco3+KfsPjqu0JJCL/Nl8phrCacPx6lljsfJshVadmwjjtvnzQ4KxIqTBL5zOiO/Z9 65PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=11AB62cF; 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 o2si6415872pfj.12.2017.11.13.02.33.02; Mon, 13 Nov 2017 02:33:03 -0800 (PST) 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=11AB62cF; 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 S1752640AbdKMKdB (ORCPT + 27 others); Mon, 13 Nov 2017 05:33:01 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:43074 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752556AbdKMKc7 (ORCPT ); Mon, 13 Nov 2017 05:32:59 -0500 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 vADATvx5031253; Mon, 13 Nov 2017 19:30:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com vADATvx5031253 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1510569001; bh=iMbzJzLGGfWSt8Kj4N0Di8nASBdW83Egth/k7HOy3FQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=11AB62cF3h5L3SF/Z6XwLJLuWMDKf/QHHpHASvuV8iBKFBrshAKeGQrhzjATT43ZT +YsY81CPjmvKU+AbDH2o/BITNQ+NXVLDGv8KOrW6lPUFoC3Ty65F+Py9VPEfylnfj5 OvLq1ZmD5PYY6YcZ84JHt7ZS+X7s/PDiI1T7lwQKZnt8yUCXYnrlj0796DrMOzV6iG I8WfQoUlx4IN9rzfk6lsWIg5u3rQFyzwztbP38hE4ONUClRC249pU4GeIS02cjqQ4o J7f5P6KmdbU0Ywr65BDOdYSpQLMDDUS9qZyJ/xOj4STq9+fhUfojGxQjheQdZMnmd5 CNOqrAGxD71Rw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , Michal Marek , Masahiro Yamada , Michal Marek , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, Thomas Gleixner , Andy Lutomirski , Ingo Molnar Subject: [PATCH v2 4/6] kbuild: create object directories simpler and faster Date: Mon, 13 Nov 2017 19:29:37 +0900 Message-Id: <1510568979-24440-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510568979-24440-1-git-send-email-yamada.masahiro@socionext.com> References: <1510568979-24440-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 For the out-of-tree build, scripts/Makefile.build creates output directories, but this operation is not efficient. scripts/Makefile.lib calculates obj-dirs as follows: obj-dirs := $(dir $(multi-objs) $(obj-y)) Please notice $(sort ...) is not used here. Usually the result is as many "./" as objects here. For a lot of duplicated paths, the following command is invoked. _dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d))) Then, the costly shell command is run over and over again. I see many points for optimization: [1] Use $(sort ...) to cut down duplicated paths before passing them to system call [2] Use single $(shell ...) instead of repeating it with $(foreach ...) This will reduce forking. [3] We can calculate obj-dirs more simply. Most of objects are already accumulated in $(targets). So, $(dir $(targets)) is fine and more comprehensive. I also removed ugly code in arch/x86/entry/vdso/Makefile. This is now really unnecessary. Signed-off-by: Masahiro Yamada Acked-by: Ingo Molnar Tested-by: Douglas Anderson --- Changes in v2: - Complete "host-objdirs" removal - Remove (obj) from mkdir argument per Cao arch/x86/entry/vdso/Makefile | 4 ---- scripts/Makefile.build | 15 ++++++--------- scripts/Makefile.host | 12 ------------ scripts/Makefile.lib | 5 ----- 4 files changed, 6 insertions(+), 30 deletions(-) -- 2.7.4 diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index d540966..f8e3d85 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -129,10 +129,6 @@ $(obj)/vdsox32.so.dbg: $(src)/vdsox32.lds $(vobjx32s) FORCE CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1 -# This makes sure the $(obj) subdirectory exists even though vdso32/ -# is not a kbuild sub-make subdirectory. -override obj-dirs = $(dir $(obj)) $(obj)/vdso32/ - targets += vdso32/vdso32.lds targets += vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o targets += vdso32/vclock_gettime.o diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 6f60377..496ecd8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -64,15 +64,6 @@ ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(h include scripts/Makefile.host endif -ifneq ($(KBUILD_SRC),) -# Create output directory if not already present -_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) - -# Create directories for object files if directory does not exist -# Needed when obj-y := dir/file.o syntax is used -_dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d))) -endif - ifndef obj $(warning kbuild: Makefile.build is included improperly) endif @@ -589,6 +580,12 @@ ifneq ($(cmd_files),) include $(cmd_files) endif +ifneq ($(KBUILD_SRC),) +# Create directories for object files if they do not exist +obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) +$(shell mkdir -p $(obj-dirs)) +endif + # Declare the contents of the .PHONY variable as phony. We keep that # information in a variable se we can use it in if_changed and friends. diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 9cfd5c8..a5e0383 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -48,15 +48,6 @@ host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) host-cxxshobjs := $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs)))) -# output directory for programs/.o files -# hostprogs-y := tools/build may have been specified. -# Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation -host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs)) - -host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs)))) - - -__hostprogs := $(addprefix $(obj)/,$(__hostprogs)) host-csingle := $(addprefix $(obj)/,$(host-csingle)) host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) @@ -66,9 +57,6 @@ host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) host-cxxshlib := $(addprefix $(obj)/,$(host-cxxshlib)) host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs)) -host-objdirs := $(addprefix $(obj)/,$(host-objdirs)) - -obj-dirs += $(host-objdirs) ##### # Handle options to gcc. Support building with separate output directory diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 4d88ad7..5fbc46d 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -50,15 +50,11 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) # objects depend on those (obviously) multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) -multi-objs := $(multi-objs-y) $(multi-objs-m) # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to # tell kbuild to descend subdir-obj-y := $(filter %/built-in.o, $(obj-y)) -# $(obj-dirs) is a list of directories that contain object files -obj-dirs := $(dir $(multi-objs) $(obj-y)) - # Replace multi-part objects by their individual parts, look at local dir only real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) @@ -81,7 +77,6 @@ multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) -obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) # These flags are needed for modversions and compiling, so we define them here # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will From patchwork Mon Nov 13 10:29:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 118727 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1626956qgn; Mon, 13 Nov 2017 02:33:32 -0800 (PST) X-Google-Smtp-Source: AGs4zMYpaBHvDa0a79XXtX5tlo+POI08cEfAhQnPf1Gh1RV82Jl22vJvI5u+lcUVA1irj1uZ8b0R X-Received: by 10.101.81.136 with SMTP id h8mr8112143pgq.250.1510569212402; Mon, 13 Nov 2017 02:33:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510569212; cv=none; d=google.com; s=arc-20160816; b=mmZLHyyHFC0jEWdSyY32hZ8OF5gsyq6Viy+d1ubmfkz18YHXI8GD/AUQf2OhgRZ5tp k4EvkDNeopYrVExR6/mRQPgwTvn/kxGyLL1ZYdgp+RqoYqqXC3D8cGDm3JixzcdDXP2t FKn4XijoFEnTlwv7eE6kP2LphWwG4i/hK3XLCA7JfNgk9tFtVpviFAlfftHT4BMigUAg 1z0JsDnnDBueQ6ppOUzpRX9k+a7ca5K8r1qoCj0t+RLulrfHjcm0ef0l56KcDlecDk1t cNR7eVEGs4KwUZGTeqt6sgpuLuCdnrlRj6440dGP+LKJU+AHNWuE5U8+miJnJbBNqS9j Rbrw== 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=e0UeDCLl/sBIiOSar3Ae95RPiNN/BNPlbi7d/Ef5rVA=; b=yuy8ZIDTHR3hLzfDPn1FM9mL61GlZZS9cxqq79B1dc1KIoPi9XUL8SWh2/uLXCg+DT 26M/z3zeQK43XTNjPnZSUDCC/hMVPeukcR4u9bLdVhVBsaUSTdqgKdG+A3OiZPCoZCZ1 yq93iTQkFB5zBXPD7jYKfjuPvgfbcQE617Gw6aodD8QSxZMWTsEG7NkMnkq2cppkwQAF wfxxjQdDJ7EqE6AvGwztAQkbiS1TVW/6Nh4knUU48qRDnhpA6PiUjrPbuwAk/iwQ39zv iJ9OZZ0IL3cY+CcvsRbOvBrSZpq7G4BRYbzh4aymF7G3H0vmZZ9Oab55BQ39tkFlVsws XBBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=0+XmTLtj; 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 t17si14185600plo.215.2017.11.13.02.33.32; Mon, 13 Nov 2017 02:33:32 -0800 (PST) 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=0+XmTLtj; 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 S1752411AbdKMKbj (ORCPT + 27 others); Mon, 13 Nov 2017 05:31:39 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40664 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338AbdKMKbg (ORCPT ); Mon, 13 Nov 2017 05:31:36 -0500 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 vADATvx6031253; Mon, 13 Nov 2017 19:30:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com vADATvx6031253 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1510569002; bh=e0UeDCLl/sBIiOSar3Ae95RPiNN/BNPlbi7d/Ef5rVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0+XmTLtjBoTVfCBhr6oaf4AeHNwTq3+WOPILtbMFVHZBK+Kfdcnux2KF2Y0ApeVxb KjA3pcL+WoK1xBfA6qejXdBxT48taj2ywF8Iu8Hom2QpQC/vkIH6Op6SLHzVTCRVg5 kkWAqSFo8Ez+jLYE3zy/YISi8eBtL3QaNykGCa4RXLtVXtUPIzdgkl3PAwoVIr9otP ndGHIwsEXfv6V+2taKsU1FrCzYAqgZ49DaS/cfgeoyQxlonaxzIJx5fhOsTsXLf4yo BFh5WQuILOXlkJCYAX2Ar3ZwV+A4akTbcjR0luGo94ZElQVhnacrgRaNOL2Jc5saAY VKgTzaEo/fPGQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , Michal Marek , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 5/6] kbuild: optimize object directory creation for incremental build Date: Mon, 13 Nov 2017 19:29:38 +0900 Message-Id: <1510568979-24440-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510568979-24440-1-git-send-email-yamada.masahiro@socionext.com> References: <1510568979-24440-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 previous commit largely optimized the object directory creation. We can optimize it more for incremental build. There are already *.cmd files in the output directory. The existing *.cmd files have been picked up by $(wildcard ...). Obviously, directories containing them exist too, so we can skip "mkdir -p". With this, Kbuild runs almost zero "mkdir -p" in incremental building. Signed-off-by: Masahiro Yamada --- Changes in v2: - Remove "." from the filter-out list scripts/Makefile.build | 5 +++++ 1 file changed, 5 insertions(+) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 496ecd8..8624924 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -583,8 +583,13 @@ endif ifneq ($(KBUILD_SRC),) # Create directories for object files if they do not exist obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets)))) +# If cmd_files exist, their directories apparently exist. Skip mkdir. +exist-dirs := $(sort $(patsubst %/,%, $(dir $(cmd_files)))) +obj-dirs := $(strip $(filter-out $(exist-dirs), $(obj-dirs))) +ifneq ($(obj-dirs),) $(shell mkdir -p $(obj-dirs)) endif +endif # Declare the contents of the .PHONY variable as phony. We keep that # information in a variable se we can use it in if_changed and friends. From patchwork Mon Nov 13 10:29:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 118723 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1625562qgn; Mon, 13 Nov 2017 02:31:47 -0800 (PST) X-Google-Smtp-Source: AGs4zMaci40JUUPouX8iV01Sh+t4FaMb3DaXU7qZlMHaIcV16f60oZ/Ig9smrMfLsDUSNR127Dow X-Received: by 10.98.204.69 with SMTP id a66mr9484651pfg.132.1510569107023; Mon, 13 Nov 2017 02:31:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510569107; cv=none; d=google.com; s=arc-20160816; b=Y9yrjVNzcg2XbwRBSZdaqTY+kF3jvPefpsn/5RMSieAghJ5MmU4R4XJirUO5m/yriL YkO9aeHEYbUdybIg9XyJ+YwNOYvNvqVcS9HSp54akUxuQrrF1v0pGPKR0G5aMTDzDIue UL7hSlVSNp2lz1WBxMGRoPfEixKuskX1WzafuwszvMrig9EA8EuhLctNPYB/JnkOiyT4 gyEpguSE1aiU+CK7q+HEJYJzUrhLjUXau/kR8j/MeL8ugf6K9Ob+SlsaQCaPMf769X4j aIxUttkOeEidEDdLk/9CARLECx1QrWtQaJN+X5E6ZaAiHuNSYXh+wae/NykBnuhii46N QBtQ== 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=5bKFZqQVay3WqZ5s63yUgrvwyuDlsczWWlPA7x618bc=; b=v4GowkrguHSJrOCcpmdYMXj4Huj1t3ELA1Whn3vlQUUFBoRJpSXoYlSCucLcdZFPyC nUD09Z2TR83DEGBIbEhg1XHgdHKzy9Oy88WKT0jSP16pctHQ/io+1+gryMiATxRTSAWR xeHLzEHC+JzGuG39Yvaj8vQ7EGxBBJAYdtEiLMwyXfHMQHaQjakA+k5Gmat1Qmh+U1LG P+W3SFBQ17qsbWVBxrau4M8BeDSW4lmlzgqbPY9TR7lMkmDlmJ3m3CAL047E7bFjX/o9 my7IhLDKSGRik9yLd4n2ge/X+fxPQNsQ/TAxPBGmczUJLTxp9zZz+UUk6QBetsVZnCUJ C1sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=JWGMwqsD; 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 w23si14193381plk.389.2017.11.13.02.31.46; Mon, 13 Nov 2017 02:31:47 -0800 (PST) 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=JWGMwqsD; 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 S1752561AbdKMKbp (ORCPT + 27 others); Mon, 13 Nov 2017 05:31:45 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40612 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbdKMKbf (ORCPT ); Mon, 13 Nov 2017 05:31:35 -0500 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 vADATvx7031253; Mon, 13 Nov 2017 19:30:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com vADATvx7031253 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1510569003; bh=5bKFZqQVay3WqZ5s63yUgrvwyuDlsczWWlPA7x618bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JWGMwqsDTrsJd6dMVpj0KYMTi89bAqz+7jF9ivwGXuPRmyN/Hhoi5Yut2YqVExF/C AL+DbvulXzGXSASOdpgC7l+XmX4GF+W2y6O1+zwXKMCZaOgkR5lKB5eLOeu67EMGBu XT1TIA1FERCSQSnxc8LtxnaylNF9AlNI2LXvvjB+WsX9S9oVleYj0OrUKlP1yvEDST CcaxSw1ja+Ol0McxTT9pDIOE0aJ8L9Q2yVZkHZt41deAbhxxJJNTz9+gP5ot3wkobJ WnGazUUxkHIu8kjwS6xCwECn3u31ZdXRApZ7SWwOk79LZOp6XwqjkokEoehgqC/+74 O352K13Qj2R4A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Douglas Anderson , Sam Ravnborg , Michal Marek , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 6/6] kbuild: remove redundant mkdir from ./Kbuild Date: Mon, 13 Nov 2017 19:29:39 +0900 Message-Id: <1510568979-24440-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510568979-24440-1-git-send-email-yamada.masahiro@socionext.com> References: <1510568979-24440-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 These two targets are added to "targets". Their directories are automatically created. Signed-off-by: Masahiro Yamada --- Changes in v2: None Kbuild | 2 -- 1 file changed, 2 deletions(-) -- 2.7.4 diff --git a/Kbuild b/Kbuild index 94c7527..f1997d8 100644 --- a/Kbuild +++ b/Kbuild @@ -17,7 +17,6 @@ targets := kernel/bounds.s # We use internal kbuild rules to avoid the "is up to date" message from make kernel/bounds.s: kernel/bounds.c FORCE - $(Q)mkdir -p $(dir $@) $(call if_changed_dep,cc_s_c) $(obj)/$(bounds-file): kernel/bounds.s FORCE @@ -53,7 +52,6 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s # We use internal kbuild rules to avoid the "is up to date" message from make arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ $(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE - $(Q)mkdir -p $(dir $@) $(call if_changed_dep,cc_s_c) $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE