[1/4] gdb/doc: don't delete *.pod files too early

Message ID 336dabc0e1d7482d28cb1629a07f56abc3491c74.1715420013.git.aburgess@redhat.com
State New
Headers
Series gdb/doc: build fixes and improvements |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Andrew Burgess May 11, 2024, 9:37 a.m. UTC
  When doing 'make -C gdb/doc man' to build the man pages, I noticed
that the outputs were being rebuilt each time the make command was
rerun, even when the input files hadn't changed.

This was caused by this commit:

  commit 824083f34c222aa7419e2ea58e82d6f230d5f531
  Date:   Fri Apr 12 17:47:20 2024 +0100

      gdb/doc: use silent-rules.mk in the Makefile

Which split the generation of the .pod file from the actual creation
of the man page file.  Prior to this split it was OK to delete the
.pod file at the end of the recipe, the rule depending on the .texi
input file, and output was the .1 or .5 man page file.

Now however, with the split, the man page creation depends on the .pod
file, if we delete this after creating the .1 or .5 man page file then
the next time we run 'make' the .pod file is missing and is
regenerated, which in turn triggers the regeneration of the man page
file.

Fix this by leaving the .pod file around, and only cleaning up these
files in the 'mostlyclean' target.

Which leads to a second problem, the POD_FILE_TMPS is not created
correctly, so we don't actually clean up the .pod files!  This too is
fixed in this commit.

After this commit running 'make -C gdb/doc man' will build the manual
pages the first time, and each subsequent run will do nothing.

Running 'make -C gdb/doc mostlyclean' will now delete the .pod files.
---
 gdb/doc/Makefile.in | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

Tom Tromey May 13, 2024, 4:13 p.m. UTC | #1
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew> After this commit running 'make -C gdb/doc man' will build the manual
Andrew> pages the first time, and each subsequent run will do nothing.

Andrew> Running 'make -C gdb/doc mostlyclean' will now delete the .pod files.

This looks good to me.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  
Andrew Burgess May 14, 2024, 3:53 p.m. UTC | #2
Tom Tromey <tom@tromey.com> writes:

>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> After this commit running 'make -C gdb/doc man' will build the manual
> Andrew> pages the first time, and each subsequent run will do nothing.
>
> Andrew> Running 'make -C gdb/doc mostlyclean' will now delete the .pod files.
>
> This looks good to me.
> Approved-By: Tom Tromey <tom@tromey.com>

Pushed.

Thanks,
Andrew
  

Patch

diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in
index 28d829fdfee..3f3fe7b7ed9 100644
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -190,8 +190,8 @@  MANS = $(MAN1S) $(MAN5S)
 
 # The pod files that are generated as a side effect of creating the
 # man pages.
-POD_FILE_TMPS = $(patsubst %.1,%.pod,$MAN1S) \
-		$(patsubst %.5,%.pod,$MAN1S)
+POD_FILE_TMPS = $(patsubst %.1,%.pod,$(MAN1S)) \
+		$(patsubst %.5,%.pod,$(MAN5S))
 
 HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
 HAVE_NATIVE_GCORE_HOST = @HAVE_NATIVE_GCORE_HOST@
@@ -665,12 +665,10 @@  annotate/index.html: $(ANNOTATE_DOC_FILES)
 $(MAN1S) : %.1 : %.pod $(GDB_DOC_FILES)
 	$(ECHO_TEXI2MAN) ($(POD2MAN1) $*.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
-	$(SILENCE) rm -f $*.pod
 
 $(MAN5S) : %.5 : %.pod $(GDB_DOC_FILES)
 	$(ECHO_TEXI2MAN) ($(POD2MAN1) $*.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
-	$(SILENCE) rm -f $*.pod
 
 force: