From patchwork Sat Jun 22 16:07:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 167481 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2095080ilk; Sat, 22 Jun 2019 09:07:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9D5Ckg+fylTSNQMQiMKWI6Vs8zdWpZ8HwuSUiC5sWAk01Z9CKgJgoQdJ351x7X+wcBGWM X-Received: by 2002:a17:902:7295:: with SMTP id d21mr118152963pll.299.1561219640196; Sat, 22 Jun 2019 09:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561219640; cv=none; d=google.com; s=arc-20160816; b=RJxNq+JR7JF1EWHQqsAhgukghNL0+iBT3bxEYsFoFs+J8AVcpEk5qDKqo3h1tq7y49 ZrOS3AQqWcO/2fsYJ8Mfmf/e1dX5OyRempWTgQtofhyrRC4CJN6gwLGuE+i4Kt8u+Ec7 O7RTxA6FI6W6XCvMXWosVVw02jwZC/h+ENreiHUQQXQLry0p5aY8XQGPI3OUQkWzRB74 jEX3E6uzaVHyTLMZUWIiO40ELqcomIzkOwtFDJrW9gevmhGNHHMmYeXAVOJRrbIMOLfX FaWLJn/75E6SFf2DWKEmqeshJSYiP4Gh4MG0/btzjWhKf5kSnBouKM8AtNCCFJcAf9P3 p4PA== 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; bh=ZlvLycAkHyzzpdCcUrLPWm4mf7P72IsMu/6F8p5QR30=; b=v6uJBRIALvXm0HbK8hbn+IZT+Ku5YELGt0n9cI4/eTyc0Mm5oH9ixPt0XN8qdaUl96 5lZm573PxKcEQCSP5Z8F82WOlqQMuRYhnJG+synl7jaHG1zmKo7Fby5fvR2meWqLvwPO TLb4HbN1kbRJ5R/WQgZHHws6DpJ7jl/wwtpTU6kQoUh8QyOKuNzjTUcMRBeIDP/uLs8z xiYdICp8SwHtXXkJZZKekYWvQ9vZtsEbDA2JpE3BM7f+zZjF8X4StCP5AtxkHxK6YMsH qJjIsSfWrTjwmT2sBHOKN9jFLZdExXj+PlteUaKimuTyAuIFblYPC/OrFkw7q17Xx+8w pogw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=F+eqeVkw; 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 n11si5130575plp.361.2019.06.22.09.07.16; Sat, 22 Jun 2019 09:07:20 -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=F+eqeVkw; 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 S1726383AbfFVQHO (ORCPT + 30 others); Sat, 22 Jun 2019 12:07:14 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:55076 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726290AbfFVQHN (ORCPT ); Sat, 22 Jun 2019 12:07:13 -0400 Received: from grover.flets-west.jp (softbank126125154139.bbtec.net [126.125.154.139]) (authenticated) by conuserg-11.nifty.com with ESMTP id x5MG77nd010140; Sun, 23 Jun 2019 01:07:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x5MG77nd010140 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1561219627; bh=ZlvLycAkHyzzpdCcUrLPWm4mf7P72IsMu/6F8p5QR30=; h=From:To:Cc:Subject:Date:From; b=F+eqeVkwJbBDQpFiYS0LUjvhR937paJpLi3Mg7OUZ6BnFxSsJrVNyxz4UQ1uFdIy7 bicy+v9/R4hF+plAnn2R9aFKebyLhw/ciHdugHF6qQ1QAAsI9+YGmFYuQN3rjCREwl c862N90L9vS4gA7rhm8Rtf0kYg2fXDvSS4fzX2KDNV2NG5UbBBA9OZk1eYitIo/iav HUrQYD+50D5mKXcPITy5B5ae6WUfxtNrNGoW7cYsmsCMVDja40rMz6d5EM2XzwM9Bf k1AQYZFuZiEMgu1UbIi01Xz5lKuOHrJKLgVh48awQFzuDlW014a8PyW/IyVl/V0NbP GUqne8FqnkNpg== X-Nifty-SrcIP: [126.125.154.139] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] kbuild: rename arg-check to cmd-check Date: Sun, 23 Jun 2019 01:07:03 +0900 Message-Id: <20190622160705.17071-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I prefer 'cmd-check' for consistency. We have 'echo-cmd', 'cmd', 'cmd_and_fixdep', etc. in this file. Signed-off-by: Masahiro Yamada --- scripts/Kbuild.include | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index f641bb0aa63f..4bec04c89750 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -213,12 +213,12 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) # See Documentation/kbuild/makefiles.txt for more info ifneq ($(KBUILD_NOCMDDEP),1) -# Check if both arguments are the same including their order. Result is empty +# Check if both commands are the same including their order. Result is empty # string if equal. User may override this check using make KBUILD_NOCMDDEP=1 -arg-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \ +cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(cmd_$@))), \ $(subst $(space),$(space_escape),$(strip $(cmd_$1)))) else -arg-check = $(if $(strip $(cmd_$@)),,1) +cmd-check = $(if $(strip $(cmd_$@)),,1) endif # Replace >$< with >$$< to preserve $ when reloading the .cmd file @@ -234,12 +234,12 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))) any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) # Execute command if command has changed or prerequisite(s) are updated. -if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ +if_changed = $(if $(strip $(any-prereq) $(cmd-check)), \ $(cmd); \ printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) # Execute the command and also postprocess generated .d dependencies file. -if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)),$(cmd_and_fixdep),@:) +if_changed_dep = $(if $(strip $(any-prereq) $(cmd-check)),$(cmd_and_fixdep),@:) cmd_and_fixdep = \ $(cmd); \ @@ -249,7 +249,7 @@ cmd_and_fixdep = \ # Usage: $(call if_changed_rule,foo) # Will check if $(cmd_foo) or any of the prerequisites changed, # and if so will execute $(rule_foo). -if_changed_rule = $(if $(strip $(any-prereq) $(arg-check)),$(rule_$(1)),@:) +if_changed_rule = $(if $(strip $(any-prereq) $(cmd-check)),$(rule_$(1)),@:) ### # why - tell why a target got built @@ -275,7 +275,7 @@ why = \ $(if $(filter $@, $(PHONY)),- due to target is PHONY, \ $(if $(wildcard $@), \ $(if $(strip $(any-prereq)),- due to: $(any-prereq), \ - $(if $(arg-check), \ + $(if $(cmd-check), \ $(if $(cmd_$@),- due to command line change, \ $(if $(filter $@, $(targets)), \ - due to missing .cmd file, \ From patchwork Sat Jun 22 16:07:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 167482 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2095100ilk; Sat, 22 Jun 2019 09:07:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnM65OcXB7IhHEPXbIoNIrIhtryXbD3LjZK2d4XL4Wvugkwe9PHZDy/jFe32xI5KbP7iPP X-Received: by 2002:a63:81c2:: with SMTP id t185mr6099663pgd.448.1561219640564; Sat, 22 Jun 2019 09:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561219640; cv=none; d=google.com; s=arc-20160816; b=ANNjpPS+PXLn5kXKsLrOKOoZvqGSynHILwud/LlEomY51jSHeS58nCUiRruY0i+5+J 5OD6znlb7zrKG/wTlpPSHLQ1FtJTLZS9AsptSZ94DyKV9f/A+Toc4r3LvS88Yf3T/5K0 L/r/4h+2yakj0gRZKneaXIXM9tkBsZ9p2vEOYXqJ+4f+H4IV6Sy6vXWMPFAIMq/5/TUv NenrnDtEhQt6tlURI+cBrJ6F1KGkgP5YFPrnUUk+2ZP6c9Ds3F4ZHK4tM+Gup7SD0B/G 3iPeYYLXZdfl0/aGKp3qotJHBfbX0+A26H6ido/WV5VKUbvl8htCOamk/wqH/bPo0av0 kXrw== 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; bh=BrWzygOirnh6Vzzhfu7Gd4Vu22siU0gsu4JudlFjotY=; b=nOhGVCBehO7jtewqfAs9s36bXReqg85xHwI/OOzoA2mSp4Hlk8XRkY9a7fHFzQZwZ+ 09JNnc9gv9rQkS6ouHwvxJxxTIdQazpkCOlO4CbmwU70nMcd+8sYCVUQE4T1YDe/NRot ONdxkEWcugkA+8M9tDKceGLVV+n9XG8E8PlYKaGbQEyE+FG9QSjDdjAJ3yYY1pBUYL5z OH6wJm97jghU/ODGLRp77ydRqLFlh3qZTIc6aNSfCup7YlrTqMNwpOMghL46g1hHo6z5 hAZx5UmVyorPTc8Q0lMIIx2JLPk9imT6uIY/z6fPFvYU6s97FOAanOLQOesSWNNwTez3 i8yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="hEIwm/pt"; 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 n11si5130575plp.361.2019.06.22.09.07.20; Sat, 22 Jun 2019 09:07:20 -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="hEIwm/pt"; 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 S1726351AbfFVQHN (ORCPT + 30 others); Sat, 22 Jun 2019 12:07:13 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:55073 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbfFVQHM (ORCPT ); Sat, 22 Jun 2019 12:07:12 -0400 Received: from grover.flets-west.jp (softbank126125154139.bbtec.net [126.125.154.139]) (authenticated) by conuserg-11.nifty.com with ESMTP id x5MG77ne010140; Sun, 23 Jun 2019 01:07:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x5MG77ne010140 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1561219628; bh=BrWzygOirnh6Vzzhfu7Gd4Vu22siU0gsu4JudlFjotY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hEIwm/ptIqDFlBaDqP+pAnTTU3InHllPUGjYX0fcKWpWJiukEomYRDuJfYBgfxTAm 0DB/EuFTzo8CNeIKrKhaQ7ImdNWgWAC2qZUarboZQzgQ5pIzbf7jfJ4hmNARqHoipu quqv7AIPranMc7rcvif5v0hRULFR2soPafgK19FPR5gtR3cFc+gT5CySegkVb1oR9v APp3JMA9k6KloCtdyciaikmEV+LKkNnAlXBjeQN5VMpzSlEp8UdFTUx3/kIi1/sF8v Zv7siSAGTewl+FcTWBrdw4x6aI/adXmmkKqKN+jGayJdqfgRejaCHvUqeWgq7sl967 3gvIdyofqYWLw== X-Nifty-SrcIP: [126.125.154.139] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] kbuild: save $(strip ...) for calling any-prepreq Date: Sun, 23 Jun 2019 01:07:04 +0900 Message-Id: <20190622160705.17071-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190622160705.17071-1-yamada.masahiro@socionext.com> References: <20190622160705.17071-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The string returned by $(filter-out ...) does not contain any leading or trailing spaces. So, only the space that matters is the one between $(filter-out $(PHONY),$?) and $(filter-out $(PHONY) $(wildcard $^),$^) By removing it from the code, we can save $(strip ...) evaluation. This refactoring is possible because $(any-prereq) is only passed to the first argument of $(if ...), so we are only interested in whether it is empty or not. This is also the prerequisite for the next commit. Signed-off-by: Masahiro Yamada --- scripts/Kbuild.include | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 4bec04c89750..0fa93f6de0b0 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -231,7 +231,7 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))) # Find any prerequisites that is newer than target or that does not exist. # PHONY targets skipped in both cases. -any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) +any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^) # Execute command if command has changed or prerequisite(s) are updated. if_changed = $(if $(strip $(any-prereq) $(cmd-check)), \ @@ -274,7 +274,7 @@ ifeq ($(KBUILD_VERBOSE),2) why = \ $(if $(filter $@, $(PHONY)),- due to target is PHONY, \ $(if $(wildcard $@), \ - $(if $(strip $(any-prereq)),- due to: $(any-prereq), \ + $(if $(any-prereq),- due to: $(any-prereq), \ $(if $(cmd-check), \ $(if $(cmd_$@),- due to command line change, \ $(if $(filter $@, $(targets)), \ From patchwork Sat Jun 22 16:07:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 167483 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2095286ilk; Sat, 22 Jun 2019 09:07:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/xddvpMtifHE+DHxyH8GLIn+jz9XyTW6CFUF3tXR9F7GNSUVdIoddBO6Mi5pYS2n7R68p X-Received: by 2002:a65:4c4a:: with SMTP id l10mr23615289pgr.231.1561219653348; Sat, 22 Jun 2019 09:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561219653; cv=none; d=google.com; s=arc-20160816; b=eM/CgAQw1E++0Eqou/RMhQIif9RCNp5M2JAsklmbRInAQEHmuVUYznKMZ1k4odFpuY ZxHvJA+teV0SanCs/1pDsJ7fyjUSiyhb1W8mcfAJrI3QQI5GLRJixnQXfp8TnuC8GfVZ wE7M80+GqllyMf7ESuctPZJMKAytzaRLDEo/hqd4G5TIK4UjH9pneDcZRx3yxSfJKRpP ZoUTznMfnvBztlEgdfbe260XoJEJ0kvyQnvVA240n96RSvt+xQ4Lpc5Tn7XP/nMeDi8v up67rEm77JUjPSgTYfuLQtv6jPADGnYr0MbKgNpzXTI6fn7gbhdHxhe3z4G02qkKHQ89 IfXw== 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; bh=sM12Se/SNC24WmIARzc8cjfzxyRxgACkEt3Rjwy8CAA=; b=LUhOs/E6Y2V7KzQpJ2RcWj5i6SMk38pxXixOfXc8+6qnPn1u6TWuTVDJfSMObUyR+u buLwd5bR6cfLGHfOEBS+pRl0iPVX7ic2nOtdNQxu5O6IMKAG+uwchSb6W9wZGnyj+olo pwFSGaAZj6/1Hg1kohWI1nlFxiXXKoy1O+WBt42aPDB/tLa1Jjwk+WXSqZT6X5Q2XNoZ NPxpVsmf4tAX7Q6njbXXCVby7MiCgCwzjm3q6HeVFlhg9iFWvQCms1cocBXd+h/4USD2 BO+qmZoaFCghDm7oUCqF9ythmn2aLyLblmupVWsce7Y9z5dYC7MnEA5ApRl3GJqyQRjw nQVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=MQFyp7kM; 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 g90si5445941plb.282.2019.06.22.09.07.33; Sat, 22 Jun 2019 09:07:33 -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=MQFyp7kM; 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 S1726413AbfFVQHT (ORCPT + 30 others); Sat, 22 Jun 2019 12:07:19 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:55074 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbfFVQHN (ORCPT ); Sat, 22 Jun 2019 12:07:13 -0400 Received: from grover.flets-west.jp (softbank126125154139.bbtec.net [126.125.154.139]) (authenticated) by conuserg-11.nifty.com with ESMTP id x5MG77nf010140; Sun, 23 Jun 2019 01:07:08 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x5MG77nf010140 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1561219628; bh=sM12Se/SNC24WmIARzc8cjfzxyRxgACkEt3Rjwy8CAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQFyp7kM/uCIWxVtksPsDHogRtBwRhlUQf7UGljyZwGVgmafs/+xcTz4BxUdhFaS4 lnTJ0+zp/8V7mxTM/pKnO05fj8E3313PJy21JRF4mWDGD5ODn5txEvazwCtFwNedSY ozrTpWAl3w7WfduUAYhLfRiCCnphyM5+DePkdtX1dLHgZefLIAR+PyI+LbBb+KnJZM IMKOju1UEzs4ydG7kb3vLSgSu0NIqcLzyaMElDaA9qJXE6Mtd8iYXu2JJkc36997FF NWMKe3c6LAOz5lOVH5II92lAaQx23B42XhuZUxo5m9q7ubrs56EejhPvMUAiMV1t9j 8Op0M/EF7934w== X-Nifty-SrcIP: [126.125.154.139] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] kbuild: save $(strip ...) for calling if_changed and friends Date: Sun, 23 Jun 2019 01:07:05 +0900 Message-Id: <20190622160705.17071-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190622160705.17071-1-yamada.masahiro@socionext.com> References: <20190622160705.17071-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The string returned by $(filter-out ...) does not contain any leading or trailing spaces. With the previous commit, 'any-prereq' no longer contains any excessive spaces. Nor does 'cmd-check' since it expands to a $(filter-out ...) call. So, only the space that matters is the one between 'any-prereq' and 'cmd-check'. By removing it from the code, we can save $(strip ...) evaluation. This refactoring is possible because $(any-prereq)$(cmd-check) is only passed to the first argument of $(if ...), so we are only interested in whether it is empty or not. Signed-off-by: Masahiro Yamada --- scripts/Kbuild.include | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 0fa93f6de0b0..0e57a9524003 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -234,12 +234,12 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))) any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^) # Execute command if command has changed or prerequisite(s) are updated. -if_changed = $(if $(strip $(any-prereq) $(cmd-check)), \ +if_changed = $(if $(any-prereq)$(cmd-check), \ $(cmd); \ printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) # Execute the command and also postprocess generated .d dependencies file. -if_changed_dep = $(if $(strip $(any-prereq) $(cmd-check)),$(cmd_and_fixdep),@:) +if_changed_dep = $(if $(any-prereq)$(cmd-check),$(cmd_and_fixdep),@:) cmd_and_fixdep = \ $(cmd); \ @@ -249,7 +249,7 @@ cmd_and_fixdep = \ # Usage: $(call if_changed_rule,foo) # Will check if $(cmd_foo) or any of the prerequisites changed, # and if so will execute $(rule_foo). -if_changed_rule = $(if $(strip $(any-prereq) $(cmd-check)),$(rule_$(1)),@:) +if_changed_rule = $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:) ### # why - tell why a target got built