Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5302116imm; Sun, 22 Jul 2018 18:52:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd0xjJIlNhVwdqkJVYNV/hU5HaGzrk2MlYBngWgeA6QoJXu0AdhUyax6jlcAnXfEARMLcAl X-Received: by 2002:a17:902:6b47:: with SMTP id g7-v6mr11157052plt.251.1532310732142; Sun, 22 Jul 2018 18:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532310732; cv=none; d=google.com; s=arc-20160816; b=J1W3LUnup5lRrbTC9LnDQP09G6l704RNZ9D9Ish9j9JLrNnXjvv6CoZQG8AHfiQEdg XIK1BDeHdvMwqq2C+f4eOEZ1G26uZ9q7EHwHL4s3cf8rbtjg4ShoYUjag1MAuRQLLD7d jla/2FfuGqLmqIT71wZWvy/qVAE1ADUyoC2WBZ/x3a0UACY3g0eEXqxutSPO3nm1Ku2y YO/43Xb20+jxhISISJLmpXvHei+ELmaRZvCvIFQXGcX3RCrYO9VHTUWE4j+3sUSeVnRR 1kXBCBwusWJ6V65bxdzSzMtedpDDhCqoqidadB6Vb2nYDf0IIdFNe6AuRpRw7fjMvn1l IT3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=yT+nFniF9SnJGzUJ4pO96a61OLr01ReysJuuGJ4IFjw=; b=hlczCINx76jIeY+2ugRGZV9AZZ8mMEVufKkYQUN+Ii4cZ/t0vjErMct/dMcLRP2EXK ym4GfqBEQR1sHasPNn07arlB0J97/4sQPGqqSait7KhH3GRnWEpcZcA3W1UCkXQjiSFR caQxhdCBIp/H+Q1uqR7iGyh2DhilMmJqDeDIcESRn2aYEIdMvivNRZc8m0GMiFb3sSDW jrjy77687PeE3ThkVjE9zuITXrUjOVwZSQdrTjZBVWPpdC97McsvVkL8FcbTnJUdi9VO aQoM5wckLN6nAGpxRALz0pazNz9g/F0g+O75/MazR8wedpd7z9rYBUl0gvOJVtlTzGvQ MzuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=w6Z2xi4U; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69-v6si7363298pla.288.2018.07.22.18.51.47; Sun, 22 Jul 2018 18:52:12 -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 header.s=dec2015msa header.b=w6Z2xi4U; 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 S2387712AbeGWCtL (ORCPT + 99 others); Sun, 22 Jul 2018 22:49:11 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:46974 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731151AbeGWCtL (ORCPT ); Sun, 22 Jul 2018 22:49:11 -0400 Received: from mail-vk0-f52.google.com (mail-vk0-f52.google.com [209.85.213.52]) (authenticated) by conssluserg-05.nifty.com with ESMTP id w6N1oM0t007936; Mon, 23 Jul 2018 10:50:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com w6N1oM0t007936 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1532310623; bh=yT+nFniF9SnJGzUJ4pO96a61OLr01ReysJuuGJ4IFjw=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=w6Z2xi4Uq+8kjQ7z/V2sGem5Z1vcDeycpd5X+BRh0QWqT3steIWf6D8Ys8TFM1tox 9rqS78UjFaQTVbYWoePAXGCFHWHGM9O3vYLQfus8D5eDvSAsXM4e2EbQZnFi37XH6I TlCXua1dnsfENTsdP0VGY/rLycbsEy8Lm18rjjb91CPdE6KQmi5kzXH2fJMCH+yoqD 7o/Kz0yUHxQp6PXsGZo8mas+4xSvTISzPOc5hxm9X+1s1+1cG9sysB1ea60slgYj8f /XVdRp/dJLPwIpFqMhVE3OpJy7XrTgmp6ndMtfWsXI1fi0ltqRPwfub7wce2ChI1F+ dBMJ6Eck5ssIQ== X-Nifty-SrcIP: [209.85.213.52] Received: by mail-vk0-f52.google.com with SMTP id s17-v6so8500581vke.10; Sun, 22 Jul 2018 18:50:22 -0700 (PDT) X-Gm-Message-State: AOUpUlHm5KgggwKpdv0/HuuQ0fLQgS5kkePcV5bo+eibnx6eCGwayJCg t023leBahJsXpq/6eM4Wu5mas+kdZeKVhEvBKMo= X-Received: by 2002:a1f:420d:: with SMTP id p13-v6mr6548017vka.10.1532310621735; Sun, 22 Jul 2018 18:50:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:7289:0:0:0:0:0 with HTTP; Sun, 22 Jul 2018 18:49:41 -0700 (PDT) In-Reply-To: <20180718091336.4540-1-dirk@gouders.net> References: <20180718091336.4540-1-dirk@gouders.net> From: Masahiro Yamada Date: Mon, 23 Jul 2018 10:49:41 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: if_changed: document single use per target limitation To: Dirk Gouders Cc: Jonathan Corbet , Linux Kbuild mailing list , "open list:DOCUMENTATION" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-07-18 18:13 GMT+09:00 Dirk Gouders : > Users of if_changed could easily feel invited to use it to divide a > recipe into parts like: > > a: prereq FORCE > $(call if_changed,do_a) > $(call if_changed,do_b) > > But this is problematic, because if_changed should not be used more > than once per target: in the above example, if_changed stores the > command-line of the given command in .a.cmd and when a is up-to-date > with respect to prereq, the file .a.cmd contains the command-line for > the last command executed, i.e. do_b. > > When the recipe is then executed again, without any change of > prerequisites, the command-line check for do_a will fail, do_a will be > executed and stored in .a.cmd. The next check, however, will still see > the old content (the file isn't re-read) and if_changed will skip > do_b, because the command-line test will not recognize a change. On > the next execution of the recipe the roles will flip: do_a is OK but > do_b not and it will be executed. And so on... > > Signed-off-by: Dirk Gouders > --- Applied. Thanks! > Documentation/kbuild/makefiles.txt | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt > index 048fc39a6b91..01fae5a01ce7 100644 > --- a/Documentation/kbuild/makefiles.txt > +++ b/Documentation/kbuild/makefiles.txt > @@ -1105,6 +1105,12 @@ When kbuild executes, the following steps are followed (roughly): > target: source(s) FORCE > #WRONG!# $(call if_changed, ld/objcopy/gzip/...) > > + Note: if_changed should not be used more than once per target. > + It stores the executed command in a corresponding .cmd > + file and multiple calls would result in overwrites and > + unwanted results when the target is up to date and only the > + tests on changed commands trigger execution of commands. > + > ld > Link target. Often, LDFLAGS_$@ is used to set specific options to ld. > > -- > 2.16.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada