From patchwork Thu May 5 07:45:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 67194 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp610375qge; Thu, 5 May 2016 00:44:50 -0700 (PDT) X-Received: by 10.98.32.211 with SMTP id m80mr18567214pfj.3.1462434290102; Thu, 05 May 2016 00:44:50 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si9863828paa.60.2016.05.05.00.44.46; Thu, 05 May 2016 00:44:50 -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; 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 S1756071AbcEEHoo (ORCPT + 29 others); Thu, 5 May 2016 03:44:44 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:44026 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751528AbcEEHon (ORCPT ); Thu, 5 May 2016 03:44:43 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id u457iDmE006863; Thu, 5 May 2016 16:44:16 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com u457iDmE006863 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1462434257; bh=5dQleDvgw6moa4E0Nn7MVWqRXAdF67V5FxveucDzoZI=; h=From:To:Cc:Subject:Date:From; b=F2Nx5gpt3PExj69V+HOGcWxl/FjilSQWsJYPM3JtJgN2VhmG84c1qkTvLwdpjXErN ha1xwllafgK5ELWntAx00LB5eTpj2EkLdm6PURm83aeVC1RJUKm/1teXKBmfZWclqV cx6GNlePDwW93LpJ+Rv/em1CxKwdrzVOIuF5NSmyS8Mmbgqc4yxVRvszlSK6hFg71o Zx4zMDN503MjbbGu+6j884Y3bIv5HhcVMMgkB0fNboPO614Mgqrcxul3SVlnG3Ofjw lyJDNClsYQfKd85Bclp/OY05J0zKMwgEfHUmWU2qGhH2Ucv46Odo58TCBlF2zzzour TvSnLYbyRtz9w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , David Howells , David Woodhouse , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: fix if_change and friends to consider argument order Date: Thu, 5 May 2016 16:45:12 +0900 Message-Id: <1462434312-19422-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, arg-check is implemented as follows: arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ $(filter-out $(cmd_$@), $(cmd_$(1))) ) This does not care about the order of arguments that appear in $(cmd_$(1)) and $(cmd_$@). So, if_changed and friends never rebuild the target if only the argument order is changed. This is a problem when the link order is changed. Apparently, obj-y += foo.o obj-y += bar.o and obj-y += bar.o obj-y += foo.o should be distinguished because the link order determines the probe order of drivers. So, built-in.o should be rebuilt if the order of objects is changed. This commit fixes arg-check to compare two strings as a whole. $(strip ...) is important because we want to ignore the difference that comes from white-spaces. Signed-off-by: Masahiro Yamada --- scripts/Kbuild.include | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index b2ab2a9..2d03480 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -228,8 +228,8 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) ifneq ($(KBUILD_NOCMDDEP),1) # Check if both arguments has same arguments. Result is empty string if equal. # User may override this check using make KBUILD_NOCMDDEP=1 -arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ - $(filter-out $(cmd_$@), $(cmd_$(1))) ) +arg-check = $(filter-out $(quote)$(strip $(cmd_$1))$(quote), \ + $(quote)$(strip $(cmd_$@))$(quote)) else arg-check = $(if $(strip $(cmd_$@)),,1) endif