All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Douglas Anderson <dianders@chromium.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <mmarek@suse.com>,
	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	[thread overview]
Message-ID: <1510568979-24440-6-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1510568979-24440-1-git-send-email-yamada.masahiro@socionext.com>

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 <yamada.masahiro@socionext.com>
---

Changes in v2:
  - Remove "." from the filter-out list

 scripts/Makefile.build | 5 +++++
 1 file changed, 5 insertions(+)

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.
-- 
2.7.4

  parent reply	other threads:[~2017-11-13 10:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 10:29 [PATCH v2 0/6] kbuild: optimize output directory creation Masahiro Yamada
2017-11-13 10:29 ` [PATCH v2 1/6] kbuild: create directory for make cache only when necessary Masahiro Yamada
2017-11-13 10:29 ` [PATCH v2 2/6] kbuild: remove redundant $(wildcard ...) for cmd_files calculation Masahiro Yamada
2017-11-13 10:29 ` [PATCH v2 3/6] kbuild: filter-out PHONY targets from "targets" Masahiro Yamada
2017-11-13 10:29 ` [PATCH v2 4/6] kbuild: create object directories simpler and faster Masahiro Yamada
2017-11-13 10:29 ` Masahiro Yamada [this message]
2017-11-13 10:29 ` [PATCH v2 6/6] kbuild: remove redundant mkdir from ./Kbuild Masahiro Yamada
2017-11-16  0:10 ` [PATCH v2 0/6] kbuild: optimize output directory creation Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510568979-24440-6-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=dianders@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=mmarek@suse.com \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.