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: 9021391 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 46684BF29F for ; Thu, 5 May 2016 07:44:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5862B203B5 for ; Thu, 5 May 2016 07:44:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77D3B203B0 for ; Thu, 5 May 2016 07:44:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752474AbcEEHon (ORCPT ); Thu, 5 May 2016 03:44:43 -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-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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