binutils-gdb/gdb/silent-rules.mk
Andrew Burgess 824083f34c gdb/doc: use silent-rules.mk in the Makefile
Make use of silent-rules.mk when building the GDB docs.

During review it was requested that there be more specific rules than
just reusing the general 'GEN' rule everywhere in the doc/ directory,
so I've added:

  ECHO_DVIPS =    @echo "  DVIPS    $@";
  ECHO_TEX =      @echo "  TEX      $@";
  ECHO_PDFTEX =   @echo "  PDFTEX   $@";
  ECHO_TEXI2DVI = @echo "  TEXI2DVI $@";
  ECHO_MAKEHTML = @echo "  MAKEHTML $@";
  ECHO_TEXI2POD = @echo "  TEXI2POD $@";
  ECHO_TEXI2MAN = @echo "  TEXI2MAN $@";
  ECHO_MAKEINFO = @echo "  MAKEINFO $@";

Then I've made use of these new silent rules and added lots of uses of
SILENT to reduce additional clutter.

As the man page generation is done in two phases, first the creation
of a .pod file, then the creation of the final man page file, I've
restructured the man page rules.  Previously we had one rule for each
of the 5 man pages.  I now have one general rule that will generate
all of the 5 .pod files, then I have two rules that convert the .pod
files into the final man pages.

I needed two rules for the man page generation as some man pages match
%.1 and some match %.5.  I could combine these by using the GNU Make
.SECONDARYEXPANSION extension, but I think having two rules like this
is probably clearer, and the duplication is minimal.

Cleaning up the temporary .pod files is now moved into the
'mostlyclean' target rather than being done as soon as the man page is
created.

I've added a new SILENT_Q_FLAG to silent-rules.mk, this is like
SILENT_FLAG, but is set to '-q' when in silent mode, this can be used
with the 'dvips' and 'texi2dvi' commands, both of which use '-q' to
mean: only report errors.

As with the rest of the GDB makefiles, I've only converted the
"generation" rules to use silent-rules.mk, the install / uninstall
rules are left unchanged.

When looking at the 'diststuff' target, which generates the info and
man pages, I noticed the recipe for this rule just deleted a temporary
file.  As that temporary file is already cleaned up as part of the
'clean' rule I've removed the deletion from the 'diststuff' target.

There are still a few "generation" targets that produce output, there
seems to be no flag to silence the 'tex' and 'pdftex' commands which
some recipes use, I've not worried about these for now, e.g. the
refcard.dvi and refcard.pdf targets still produce some output.

Luckily, when doing a 'make all' in the gdb/ directory, we only build
the info docs by default, and those rules are now nice and silent, so
a complete GDB build is now looking nice and quiet by default.

While working on this patch I noticed that 'make -j all-doc' doesn't
work (reliably), this is a preexisting bug in the way that dvi/pdf
targets are generated.  For example gdb.dvi and gdb.pdf both use the
texi2dvi tool, which relies on temporary files to hold state.  If both
these rules run in parallel then one (or both) of the recipes will
fail.

Luckily, the default docs target (all), which is what gets run when we
do 'make all' in the gdb/ directory, doesn't build the dvi and pdf
targets, so we're OK in that case.

I've not tried to fix this problem in this commit as it already
existed, and I don't want to do too much in one commit.  I mention it
only because I ran into this issue while testing this commit.
2024-05-08 18:44:03 +01:00

42 lines
1.2 KiB
Makefile

# If V is undefined or V=0 is specified, use the silent/verbose/compact mode.
V ?= 0
ifeq ($(V),0)
ECHO_CXX = @echo " CXX $@";
ECHO_CC = @echo " CC $@";
ECHO_CXXLD = @echo " CXXLD $@";
ECHO_CCLD = @echo " CCLD $@";
ECHO_REGDAT = @echo " REGDAT $@";
ECHO_GEN = @echo " GEN $@";
ECHO_GEN_XML_BUILTIN = \
@echo " GEN xml-builtin.c";
ECHO_GEN_XML_BUILTIN_GENERATED = \
@echo " GEN xml-builtin-generated.c";
ECHO_INIT_C = @echo " GEN init.c"
ECHO_SIGN = @echo " SIGN gdb";
ECHO_YACC = @echo " YACC $@";
ECHO_LEX = @echo " LEX $@";
ECHO_AR = @echo " AR $@";
ECHO_RANLIB = @echo " RANLIB $@";
ECHO_DVIPS = @echo " DVIPS $@";
ECHO_TEX = @echo " TEX $@";
ECHO_PDFTEX = @echo " PDFTEX $@";
ECHO_TEXI2DVI = \
@echo " TEXI2DVI $@";
ECHO_MAKEHTML = \
@echo " MAKEHTML $@";
ECHO_TEXI2POD = \
@echo " TEXI2POD $@";
ECHO_TEXI2MAN = \
@echo " TEXI2MAN $@";
ECHO_MAKEINFO = \
@echo " MAKEINFO $@";
SILENCE = @
# Silence libtool.
SILENT_FLAG = --silent
SILENT_Q_FLAG = -q
# Used in shell snippets instead of 'echo'.
SILENT_ECHO = true
else
SILENT_ECHO = echo
endif