From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732AbdKIPnH (ORCPT ); Thu, 9 Nov 2017 10:43:07 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:23930 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750909AbdKIPm5 (ORCPT ); Thu, 9 Nov 2017 10:42:57 -0500 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vA9FfQvE007776 X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Marek , Sam Ravnborg , Douglas Anderson , Masahiro Yamada , Michal Marek Subject: [PATCH 4/4] kbuild: optimize object directory creation for incremental build Date: Fri, 10 Nov 2017 00:41:17 +0900 Message-Id: <1510242077-8122-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510242077-8122-1-git-send-email-yamada.masahiro@socionext.com> References: <1510242077-8122-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org 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 --- scripts/Makefile.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 89ac180..90ea7a5 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -583,8 +583,13 @@ endif ifneq ($(KBUILD_SRC),) # Create directories for object files if directory does 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