From: Andrew Burgess <aburgess@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCHv2 2/5] gdb/doc: allow for version.subst in the source tree
Date: Thu, 06 Jun 2024 18:52:22 +0100 [thread overview]
Message-ID: <87cyouarhl.fsf@redhat.com> (raw)
In-Reply-To: <86msnygu2y.fsf@gnu.org>
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Andrew Burgess <aburgess@redhat.com>
>> Cc: gdb-patches@sourceware.org
>> Date: Mon, 03 Jun 2024 15:22:41 +0100
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> make: Entering directory '/tmp/build/build/gdb/doc'
>> >> GEN GDBvn.texi
>> >> sed: can't read version.subst: No such file or directory
>> >> make: Leaving directory '/tmp/build/build/gdb/doc'
>> >>
>> >> The problem is that every reference to version.subst in GDB's Makefile
>> >> assumes that the version.subst file will always be in the build
>> >> directory.
>> >>
>> >> In this commit I replace direct references to version.subst with a
>> >> small shell snippet which returns the path to the version.subst file
>> >> to use. If there is a version.subst file in the build directory then
>> >> that file is selected, otherwise we return the path to a version.subst
>> >> file in the source directory.
>> >
>> > Why isn't VPATH or vpath enough to solve this nuisance?
>>
>> If anything VPATH is the _cause_ of this nuisance! With the VPATH set
>> as it is, make will check both the build directory and the source
>> directory. So when we have a rule like:
>>
>> some_target : version.subst
>> some_command version.subst
>>
>> make is going to look for the version.subst dependency in both
>> locations, however, where 'some_command' looks is entirely up to
>> 'some_command'. In our case for example, the 'sed' command doesn't (to
>> my knowledge) have a search path command line option, so a command like:
>>
>> sed q version.subst
>>
>> is only going to search in the build directory.
>
> My reading of the node "Recipes/Search" in the GNU Make manual is that
> if you use automatic variables, such as $^, in the recipe, Make will
> expand the variable into the full file name including the directory in
> which it found the file via VPATH search. Can't we use that feature
> here? IOW, instead of
>
> some_target : version.subst
> some_command version.subst
>
> you should use something like
>
> some_target : version.subst
> some_command $<
Thanks. I was completely unaware that $< (and friends) worked like
this... but I guess it makes sense when you think about it.
This is indeed a better way to solve the problem I had.
While working on this change I ended up adding a whole extra patch to
the series, so I've followed up with a V3 series.
Thanks for your patience.
Andrew
next prev parent reply other threads:[~2024-06-06 17:52 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-11 9:37 [PATCH 0/4] gdb/doc: build fixes and improvements Andrew Burgess
2024-05-11 9:37 ` [PATCH 1/4] gdb/doc: don't delete *.pod files too early Andrew Burgess
2024-05-13 16:13 ` Tom Tromey
2024-05-14 15:53 ` Andrew Burgess
2024-05-11 9:37 ` [PATCH 2/4] gdb/doc: don't try to copy GDBvn.texi from the source tree Andrew Burgess
2024-05-13 16:12 ` Tom Tromey
2024-05-13 17:33 ` Eli Zaretskii
2024-05-14 13:32 ` Andrew Burgess
2024-06-14 19:06 ` Pedro Alves
2024-05-11 9:37 ` [PATCH 3/4] gdb/doc: fix parallel build of refcard related targets Andrew Burgess
2024-05-13 16:13 ` Tom Tromey
2024-05-11 9:37 ` [PATCH 4/4] gdb/doc: fix parallel build of pdf and dvi files Andrew Burgess
2024-05-13 16:18 ` Tom Tromey
2024-05-14 13:40 ` Andrew Burgess
2024-05-31 8:18 ` [PATCHv2 0/5] gdb/doc: parallel build fixes and improvements Andrew Burgess
2024-05-31 8:18 ` [PATCHv2 1/5] gdb/doc: don't try to copy GDBvn.texi from the source tree Andrew Burgess
2024-05-31 8:18 ` [PATCHv2 2/5] gdb/doc: allow for version.subst in " Andrew Burgess
2024-05-31 10:40 ` Eli Zaretskii
2024-06-03 14:22 ` Andrew Burgess
2024-06-06 11:59 ` Eli Zaretskii
2024-06-06 17:52 ` Andrew Burgess [this message]
2024-05-31 8:18 ` [PATCHv2 3/5] gdb/doc: also look in srcdir when running TEXI2POD Andrew Burgess
2024-05-31 8:18 ` [PATCHv2 4/5] gdb/doc: fix parallel build of refcard related targets Andrew Burgess
2024-05-31 8:18 ` [PATCHv2 5/5] gdb/doc: fix parallel build of pdf and dvi files Andrew Burgess
2024-06-06 17:49 ` [PATCHv3 0/6] gdb/doc: parallel build fixes and improvements Andrew Burgess
2024-06-06 17:49 ` [PATCHv3 1/6] gdb/doc: don't try to copy GDBvn.texi from the source tree Andrew Burgess
2024-06-14 18:45 ` Pedro Alves
2024-06-06 17:49 ` [PATCHv3 2/6] gdb/doc: merge rules for building .1 and .5 man pages Andrew Burgess
2024-06-06 17:49 ` [PATCHv3 3/6] gdb/doc: allow for version.subst in the source tree Andrew Burgess
2024-06-14 18:44 ` Pedro Alves
2024-06-06 17:49 ` [PATCHv3 4/6] gdb/doc: also look in srcdir when running TEXI2POD Andrew Burgess
2024-06-06 17:49 ` [PATCHv3 5/6] gdb/doc: fix parallel build of refcard related targets Andrew Burgess
2024-06-06 17:49 ` [PATCHv3 6/6] gdb/doc: fix parallel build of pdf and dvi files Andrew Burgess
2024-06-14 19:00 ` Pedro Alves
2024-06-15 9:44 ` Andrew Burgess
2024-06-15 12:40 ` Eli Zaretskii
2024-06-15 14:59 ` Andrew Burgess
2024-06-15 15:04 ` Andrew Burgess
2024-06-21 15:35 ` Pedro Alves
2024-06-24 11:16 ` Andrew Burgess
2024-06-25 13:39 ` Andrew Burgess
2024-06-14 18:14 ` [PATCHv3 0/6] gdb/doc: parallel build fixes and improvements Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cyouarhl.fsf@redhat.com \
--to=aburgess@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).