From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 5477C3858D28 for ; Mon, 8 Apr 2024 03:09:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5477C3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5477C3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712545756; cv=none; b=cAgD5ql2KVrz6nSGsCqovlvQCJAPjeLtlLxdC78t+yrIwSpxiBqVcLmgd0Tpms3bhCyWzOiMLPSoGQJUOhYQPPBhw+0QarrEpqAfeaMdXo9+hjdhD6vOX3Hyr9u2F1Lcrn/lJ9KA41or0gs9DsHiMcJdr1iX6yODX5xN9afudn0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712545756; c=relaxed/simple; bh=1gfWklcx4bYdA/PbZB796MndWGZudP64znhjuqBCXDM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=tUPKZaEcpemecqnEAX1Ilo6OaiefGhGufzn8utafyMtmluS+7P/F8lO+zvFRjETt73z7o/b2doLJsG8z00pJGAmKzJ+86nO9lJXKswTnnnVj4cCzmhdtWQF+q3X5VDJSp43CfToNrBVF8eDG4XO7JabQbEqFZjDHhZyLWfVkJvc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1712545754; bh=1gfWklcx4bYdA/PbZB796MndWGZudP64znhjuqBCXDM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=MDHvQjnmI1kv7fx58ZixthXzYDH42of574zHNgwHH4ZovqXZnyIG1rcoSA6RPdeG7 8b04FKVhR0p2jxzsDVfzgQosKY0tjAbVAeV2ywVcNKN8QWwA7VDScPRWj7v8iA5jjL XcBFudyFlvqnslKiL5fsXZ2d0KMzUTKP4hmy96i0= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id C53601E092; Sun, 7 Apr 2024 23:09:14 -0400 (EDT) Message-ID: <0abe2dbb-2369-4861-afdb-5664f4dba8eb@simark.ca> Date: Sun, 7 Apr 2024 23:09:14 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv2 2/6] gdb/Makefile: rewrite dependencies for config.status target To: Andrew Burgess , gdb-patches@sourceware.org References: <20e8e8749d8119823ce18d23dffd2e47f9ad5791.1712422921.git.aburgess@redhat.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <20e8e8749d8119823ce18d23dffd2e47f9ad5791.1712422921.git.aburgess@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2024-04-06 13:03, Andrew Burgess wrote: > I noticed something weird, the rule for the config.status target looks > like this: > > config.status: $(srcdir)/configure configure.nat configure.tgt configure.host ../bfd/development.sh > $(SHELL) config.status --recheck > > What bothered me is that 'configure' is specified as being in > $(srcdir), while all of the other files are not, even though those > files are in the same $(srcdir) as the configure script. > > However, I tried touching one of those files, and the config.status > rule does trigger! > > This is thanks to the VPATH variable, which is set to $(srcdir), so > make looks in $(srcdir) for any dependencies. > > However, this inconsistency bothers me. Better, I think, to add the > $(srcdir) prefix to each of these files. > > I also spotted that the configure script also includes the files > ../bfd/config.bfd, yet that is missing from the include list, so in > this commit I plan to add this as a dependency. > > The configure script also pulls in two TCL and TK related files: > > . ${TCL_BIN_DIR}/tclConfig.sh > . ${TK_BIN_DIR}/tkConfig.sh > > However, I don't think ${TCL_BIN_DIR} and ${TK_BIN_DIR} are currently > visible in GDB's Makefile, so I'm not planning to add these > dependencies at this time. > > In this commit I add a new variable config_status_deps which holds the > list of all the dependencies for config.status, with the $(srcdir) > prefix included, and then I use this in the config.status rule. > > After this commit config.status will regenerate if config.bfd changes, > which it wouldn't before, but nothing else changes. > --- > gdb/Makefile.in | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/gdb/Makefile.in b/gdb/Makefile.in > index df044288b5e..9340becbdc9 100644 > --- a/gdb/Makefile.in > +++ b/gdb/Makefile.in > @@ -2333,7 +2333,18 @@ nm.h: stamp-nmh ; @true > stamp-nmh: config.status > $(SHELL) config.status nm.h > > -config.status: $(srcdir)/configure configure.nat configure.tgt configure.host ../bfd/development.sh > +# Files included from config.status or the configure script. When > +# these change the configure script doesn't need regenerating, but its > +# output (and so that of config.status) might change. > +config_status_deps = \ > + $(srcdir)/configure \ > + $(srcdir)/configure.nat \ > + $(srcdir)/configure.tgt \ > + $(srcdir)/configure.host \ > + $(srcdir)/../bfd/development.sh \ > + $(srcdir)/../bfd/config.bfd I agree that lists formatted like this are easier to read than long lines. I also agree that using $(srcdir) consistently helps with readability, even if it works without (because of VPATH). Although it would probably be overkill in contexts like the definition of `COMMON_SFILES`. Simon