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.