Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754707AbcCNCoz (ORCPT ); Sun, 13 Mar 2016 22:44:55 -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 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 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2437 Lines: 57 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(-) 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) -- 2.5.0