From patchwork Thu Feb 18 20:07:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 62243 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp783604lbl; Thu, 18 Feb 2016 12:07:23 -0800 (PST) X-Received: by 10.66.189.165 with SMTP id gj5mr12935357pac.157.1455826043638; Thu, 18 Feb 2016 12:07:23 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fc2si11168255pab.106.2016.02.18.12.07.23; Thu, 18 Feb 2016 12:07:23 -0800 (PST) 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 S1427051AbcBRUHQ (ORCPT + 30 others); Thu, 18 Feb 2016 15:07:16 -0500 Received: from relais.videotron.ca ([24.201.245.36]:37142 "EHLO relais.videotron.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425675AbcBRUHN (ORCPT ); Thu, 18 Feb 2016 15:07:13 -0500 Content-transfer-encoding: 7BIT Received: from yoda.home ([96.23.157.65]) by VL-VM-MR006.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0O2R00B16EJUF4D1@VL-VM-MR006.ip.videotron.ca>; Thu, 18 Feb 2016 15:07:06 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 8EF6E2DA016C; Thu, 18 Feb 2016 15:07:06 -0500 (EST) From: Nicolas Pitre To: Michal Marek , linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Al Viro , Rusty Russell Subject: [PATCH v3 4/7] kbuild: de-duplicate fixdep usage Date: Thu, 18 Feb 2016 15:07:00 -0500 Message-id: <1455826023-2134-5-git-send-email-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.5.0 In-reply-to: <1455826023-2134-1-git-send-email-nicolas.pitre@linaro.org> References: <1455826023-2134-1-git-send-email-nicolas.pitre@linaro.org> 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)