Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5652269img; Wed, 27 Mar 2019 12:29:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJAJhkcVBTxGJ7tHtREKkp8PKhu0A3W7rWFDo5WFQWo7vn/0E3E2cq9nsbfRROHxjMTEcn X-Received: by 2002:a65:6283:: with SMTP id f3mr36801321pgv.108.1553714968060; Wed, 27 Mar 2019 12:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714968; cv=none; d=google.com; s=arc-20160816; b=fYjvvHmkpiusltrA0JHk57dlAJE9x7vuVaZBA+V+iMivqlK2QQiJnwj2hbc2L4o25Z 2g4rf9k904kHaASSZxcuZRBCcPoEhocJW/7OmGVo0kUztLZ7xKopiMl9c4tvYSW4WuRY Kgymd01Qy8nhrIWu+lLaNK0/iIqzsTiSbXhGpTXhi3F4s21WeEXim9pUDd4oWTO1Gt4v gcYQwjeS9y2n3BPoR/NH34O63BfGtzD1Q56jSaIn2nNWij0z/2lXUA6mvUi96pwvNBfn LX2DhK6j45RvJRHIMdbY4YcECi6D6g1hXVoHqPJVpn7Z3/HppHrhRFTBpFhgBaGIHKBJ 2l2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=djWi5kOGKhZ5xp0KKddmAaKJRupyvB6C06vQdOD9/Lc=; b=n5jr7kKC2y4gnWj7WXG37DqkdWNnhw0P6oK7E6QejBefrO5I/9vo8N21WxsGiw4XG/ sgGdN5L40si+MQMjt67JttmkR25XdgqQAOmleOuHvqcVdhKwl8QkxptIdkr6DT2FIKST jsrAKe7P6XtjrXQZ/zWY+bhJquRk7uY+bULe3NP2PhIUVkrFKggCJ7I5tioKuLKs6JXv SwvRBervaaVXKFfEPYEnH/Hb6bZKY7qxLBzqsrNkcXpzNXAfop9EqPrK7cZce4X11vlp cqE/lJyqVtfXjnf2seWTyqNrsphlxc2LAtl3K6sVpo4gFek5DTA+cwgZytjQGuZUed68 GD5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bNoLBKCE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r63si11370947pfc.183.2019.03.27.12.29.13; Wed, 27 Mar 2019 12:29:28 -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=@kernel.org header.s=default header.b=bNoLBKCE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729396AbfC0T2l (ORCPT + 99 others); Wed, 27 Mar 2019 15:28:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:44838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733197AbfC0SEP (ORCPT ); Wed, 27 Mar 2019 14:04:15 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BFAA2183F; Wed, 27 Mar 2019 18:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709854; bh=E4/p3YlPnzqEqNKCZ6CRI6ayKVLZdrJnlQqWk0cOMGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNoLBKCEaNbYK/JLAP39263oqauISeTS90HulZK9ACRFDyOUfTXQTxUkPVjPsoqCn 8BDWuHpxxgAEI9D5LExsICKW4e0ONxGKOfp9siaVEhqiNHWRXzTETiEsyncGjVSOy7 wpJBdKcgQu0kWkHshSMZd1IEwwvc84iQAPYR73Gg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Masahiro Yamada , Sasha Levin , linux-kbuild@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 074/262] kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing Date: Wed, 27 Mar 2019 13:58:49 -0400 Message-Id: <20190327180158.10245-74-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada [ Upstream commit 9390dff66a52d1a60c6e517d8fa6cdbdffc83cb1 ] If include/config/auto.conf.cmd is lost for some reasons, it is not self-healing, so the top Makefile misses to run syncconfig. Move include/config/auto.conf.cmd to the target side. I used a pattern rule instead of a normal rule here although it is a bit gross. If the rule were written with a normal rule like this, include/config/auto.conf \ include/config/auto.conf.cmd \ include/config/tristate.conf: $(KCONFIG_CONFIG) $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig ... syncconfig would be executed per target. Using a pattern rule makes sure that syncconfig is executed just once because Make assumes the recipe will create all of the targets. Here is a quote from the GNU Make manual [1]: "Pattern rules may have more than one target. Unlike normal rules, this does not act as many different rules with the same prerequisites and recipe. If a pattern rule has multiple targets, make knows that the rule's recipe is responsible for making all of the targets. The recipe is executed only once to make all the targets. When searching for a pattern rule to match a target, the target patterns of a rule other than the one that matches the target in need of a rule are incidental: make worries only about giving a recipe and prerequisites to the file presently in question. However, when this file's recipe is run, the other targets are marked as having been updated themselves." [1]: https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 06fda21614bc..89af52ca0ba5 100644 --- a/Makefile +++ b/Makefile @@ -625,12 +625,15 @@ ifeq ($(may-sync-config),1) -include include/config/auto.conf.cmd # To avoid any implicit rule to kick in, define an empty command -$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; +$(KCONFIG_CONFIG): ; # The actual configuration files used during the build are stored in # include/generated/ and include/config/. Update them if .config is newer than # include/config/auto.conf (which mirrors .config). -include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd +# +# This exploits the 'multi-target pattern rule' trick. +# The syncconfig should be executed only once to make all the targets. +%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG) $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig else # External modules and some install targets need include/generated/autoconf.h -- 2.19.1