From patchwork Mon Mar 14 02:42:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 63787 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2245699lbc; Sun, 13 Mar 2016 19:44:59 -0700 (PDT) X-Received: by 10.66.55.70 with SMTP id q6mr30049805pap.126.1457923499137; Sun, 13 Mar 2016 19:44:59 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zg6si727167pac.237.2016.03.13.19.44.58; Sun, 13 Mar 2016 19:44:59 -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; 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 S1754577AbcCNCo4 (ORCPT + 30 others); Sun, 13 Mar 2016 22:44:56 -0400 Received: from alt32.smtp-out.videotron.ca ([24.53.0.21]:9421 "EHLO alt32.smtp-out.videotron.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754466AbcCNCnE (ORCPT ); Sun, 13 Mar 2016 22:43:04 -0400 Received: from yoda.home ([96.23.157.65]) by Videotron with SMTP id fITFaMLu4omgUfITGanY4V; Sun, 13 Mar 2016 22:43:02 -0400 X-Authority-Analysis: v=2.1 cv=T+wsN6+Q c=1 sm=1 tr=0 a=keA3yYpnlypCNW5BNWqu+w==:117 a=keA3yYpnlypCNW5BNWqu+w==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=7OsogOcEt9IA:10 a=KKAkSRfTAAAA:8 a=XQs6qep6VPQncVl5oZAA:9 Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 4D8442DA0556; Sun, 13 Mar 2016 22:43:01 -0400 (EDT) From: Nicolas Pitre To: Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 4/8] kbuild: de-duplicate fixdep usage Date: Sun, 13 Mar 2016 22:42:12 -0400 Message-Id: <1457923336-2732-5-git-send-email-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457923336-2732-1-git-send-email-nicolas.pitre@linaro.org> References: <1457923336-2732-1-git-send-email-nicolas.pitre@linaro.org> X-CMAE-Envelope: MS4wfN1ULGvyDClVHsbFyoVpS+kytUfcy3De2x1RaimfrVlzqNhAJimZOk7aZPooVko7sr9xIFg6rX6s4wLndX9codtNHVovHZQw+bCRQGqszwo0uuhW4uU5 chQVV4skSaompqmZxqJ3uKha/B+p9tUh8jSo4YI+mmCYGbtdtVV70F748Z6hw8dNVXupIyBOuj6dx3HuLOmDXSd0+/B1oxv39zwnfXJmOFpaYTEtluH0AjfY tLR3tT6v5zKyf3aR7deq+Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The generation and postprocessing of automatic dependency rules is duplicated in rule_cc_o_c and if_changed_dep. Since this is not a trivial one-liner action, it is now abstracted under cmd_and_fixdep to simplify things and make future changes easier. In the rule_cc_o_c case that means the order of some commands has been altered, namely fixdep and related file manipulations are executed earlier, but they didn't depend on those commands that now execute later. Signed-off-by: Nicolas Pitre --- scripts/Kbuild.include | 5 ++++- scripts/Makefile.build | 9 ++------- 2 files changed, 6 insertions(+), 8 deletions(-) -- 2.5.0 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 1db6d73c8d..8a257fa663 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -256,10 +256,13 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ # Execute the command and also postprocess generated .d dependencies file. if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ @set -e; \ + $(cmd_and_fixdep)) + +cmd_and_fixdep = \ $(echo-cmd) $(cmd_$(1)); \ scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ rm -f $(depfile); \ - mv -f $(dot-target).tmp $(dot-target).cmd) + mv -f $(dot-target).tmp $(dot-target).cmd; # Usage: $(call if_changed_rule,foo) # Will check if $(cmd_foo) or any of the prerequisites changed, diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f4b4320e0d..8134ee81ad 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -243,14 +243,9 @@ endif define rule_cc_o_c $(call echo-cmd,checksrc) $(cmd_checksrc) \ - $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ + $(call cmd_and_fixdep,cc_o_c) \ $(cmd_modversions) \ - $(call echo-cmd,record_mcount) \ - $(cmd_record_mcount) \ - scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ - $(dot-target).tmp; \ - rm -f $(depfile); \ - mv -f $(dot-target).tmp $(dot-target).cmd + $(call echo-cmd,record_mcount) $(cmd_record_mcount) endef # List module undefined symbols (or empty line if not enabled)