bfd: fix generation of bfd.texi in out-of-tree builds

Message ID 87cygdnw06.fsf@oracle.com
State New
Headers
Series bfd: fix generation of bfd.texi in out-of-tree builds |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Jose E. Marchesi Jan. 23, 2025, 7:57 p.m. UTC
  Hello people!

I have been bitten by this since ages when I build a fresh clone of
binutils git master:

  bfd.texi:202: @menu reference to nonexistent node `Threading'

But I always took the lazy approach of just editing bfd.texi by hand to
remove the menu entry, in the hope someone else would fix this... oh
well, I think I found the problem.

[In the sequel TS means $(top_srcdir) and TB means $(top_builddir)]

The Texinfo file TS/bfd/doc/bfd.texi @includes many other .texi files
such as:

  bfdt.texi
  bfdio.texi
  section.texi
  ...

These .texi files are generated from the bfd/*.c source files, by a
program called `chew' that is distributed along with BFD, via some
default rules and macro magic in TS/bfd/doc/local.mk.  Important point:
the .texi files are generated in TB/bfd/doc/, not TS/bfd/doc.

Now, AM_MAKEINFOFLAGS in local.mk is defined as:

  AM_MAKEINFOFLAGS = --no-split -I "$(srcdir)/%D%" -I %D%

Where %D% is 'doc/' in this case (the relative doc from fragment to
@including makefile).  Now, it looks like the directory containing the
.texi file is automatically inserted in the @include search path, and
this means that:

  -I "$(srcdir/%D%)" is probably redundant, and
  -I %D% places TB/bfd/doc _after_ TS/bfd/doc.

Since currently TS/bfd/doc/bfdt.texi is outdated and is missing some
nodes, the error above happens.

This patch changes bfd/doc/local.mk to use -P to prepend the current
build directory to the @include search path, rather than -I, which
appends it.  Note that switching the two -I doesn't work.

PS: The release making script doesn't face this problem probably because
    it does an in-tree build.
  

Comments

Alan Modra Jan. 23, 2025, 8:47 p.m. UTC | #1
On Thu, Jan 23, 2025 at 08:57:45PM +0100, Jose E. Marchesi wrote:
> Since currently TS/bfd/doc/bfdt.texi is outdated and is missing some
> nodes, the error above happens.

Um, TS/bfd/doc/bfdt.text doesn't exist in my source tree.

> This patch changes bfd/doc/local.mk to use -P to prepend the current

Sounds a good idea, please apply.
  
Jose E. Marchesi Jan. 23, 2025, 9:07 p.m. UTC | #2
> On Thu, Jan 23, 2025 at 08:57:45PM +0100, Jose E. Marchesi wrote:
>> Since currently TS/bfd/doc/bfdt.texi is outdated and is missing some
>> nodes, the error above happens.
>
> Um, TS/bfd/doc/bfdt.text doesn't exist in my source tree.

Oh I thought it was in git, but it isn't.
Mine is from May 10 2023 :)

>
>> This patch changes bfd/doc/local.mk to use -P to prepend the current
>
> Sounds a good idea, please apply.

Pushed, thanks.
  

Patch

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index da27f8c3f31..d8facc241c9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@ 
+2025-01-23  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+	* doc/local.mk (AM_MAKEINFOFLAGS): Prepend the build directory to
+	the @include search path.
+	* Makefile.in: Regenerate.
+
 2025-01-19  Nick Clifton  <nickc@redhat.com>
 
 	* 2.44 Branch point.
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index ee674a36c5b..1543af7984a 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1301,7 +1301,7 @@  SRCIPROT = $(srcdir)/cache.c $(srcdir)/libbfd.c \
 TEXIDIR = $(srcdir)/../texinfo/fsf
 info_TEXINFOS = doc/bfd.texi
 doc_bfd_TEXINFOS = $(DOCFILES) doc/bfdsumm.texi
-AM_MAKEINFOFLAGS = --no-split -I "$(srcdir)/doc" -I doc
+AM_MAKEINFOFLAGS = --no-split -I "$(srcdir)/doc" -P doc
 TEXI2DVI = texi2dvi -I "$(srcdir)/doc" -I doc
 MKDOC = doc/chew$(EXEEXT_FOR_BUILD)
 
diff --git a/bfd/doc/local.mk b/bfd/doc/local.mk
index 9b75402387c..515efbf72c9 100644
--- a/bfd/doc/local.mk
+++ b/bfd/doc/local.mk
@@ -72,7 +72,7 @@  TEXIDIR = $(srcdir)/../texinfo/fsf
 info_TEXINFOS = %D%/bfd.texi
 %C%_bfd_TEXINFOS = $(DOCFILES) %D%/bfdsumm.texi
 
-AM_MAKEINFOFLAGS = --no-split -I "$(srcdir)/%D%" -I %D%
+AM_MAKEINFOFLAGS = --no-split -I "$(srcdir)/%D%" -P %D%
 TEXI2DVI = texi2dvi -I "$(srcdir)/%D%" -I %D%
 
 MKDOC = %D%/chew$(EXEEXT_FOR_BUILD)