[PATCH/committed] sim: enable silent rules in common builds

Message ID 20210615000234.1211-1-vapier@gentoo.org
State New
Headers show
Series
  • [PATCH/committed] sim: enable silent rules in common builds
Related show

Commit Message

Eli Zaretskii via Gdb-patches June 15, 2021, 12:02 a.m.
We only do the common code as automake simplifies the logic.
---
 sim/Makefile.in               | 30 +++++++++++++--------------
 sim/common/local.mk           |  6 +++---
 sim/configure                 | 39 +++++++++++++++++++++++++++++++++++
 sim/configure.ac              |  1 +
 sim/testsuite/common/local.mk | 24 ++++++++++-----------
 5 files changed, 70 insertions(+), 30 deletions(-)

-- 
2.31.1

Comments

Eli Zaretskii via Gdb-patches June 15, 2021, 12:40 a.m. | #1
On 2021-06-14 8:02 p.m., Mike Frysinger via Gdb-patches wrote:
> We only do the common code as automake simplifies the logic.


Are you interested in re-using what is done in GDB?  I did this quickly
to show how it works.  It covers maybe 90% of the commands with very little
effort.


From 3c9546a131a0d0309232919ab6f58ced6109a1d8 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>

Date: Mon, 14 Jun 2021 20:39:04 -0400
Subject: [PATCH] silent

Change-Id: Idf9ba5beaee10c7c614859ace5fbdcd1de0287db
---
 gdb/silent-rules.mk       |  3 +++
 sim/common/Make-common.in | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gdb/silent-rules.mk b/gdb/silent-rules.mk
index 772bd6728be3..97d799bf2ae2 100644
--- a/gdb/silent-rules.mk
+++ b/gdb/silent-rules.mk
@@ -4,6 +4,7 @@ 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 = \
@@ -14,5 +15,7 @@ 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 $@";
 SILENCE = @
 endif
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 3dab9ca1fd14..54e641eaa543 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -40,6 +40,8 @@ srccom = $(srcdir)/../common
 srcroot = $(srcdir)/../..
 srcsim = $(srcdir)/..
 
+include $(srcroot)/gdb/silent-rules.mk
+
 # Helper code from gnulib.
 GNULIB_PARENT_DIR = ../..
 include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
@@ -111,7 +113,7 @@ depcomp = $(SHELL) $(srcroot)/depcomp
 # GNU make is used.  The overrides implement dependency tracking.
 COMPILE.pre = $(CC) $(C_DIALECT)
 COMPILE.post = -c -o $@
-COMPILE = $(COMPILE.pre) $(ALL_CFLAGS) $(COMPILE.post)
+COMPILE = $(ECHO_CC) $(COMPILE.pre) $(ALL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
 
 # igen leaks memory, and therefore makes AddressSanitizer unhappy.  Disable
@@ -273,11 +275,11 @@ all: libsim.a run$(EXEEXT) .gdbinit
 
 libsim.a: $(LIB_OBJS)
 	rm -f libsim.a
-	$(AR) $(AR_FLAGS) libsim.a $(LIB_OBJS)
-	$(RANLIB) libsim.a
+	$(ECHO_AR) $(AR) $(AR_FLAGS) libsim.a $(LIB_OBJS)
+	$(ECHO_RANLIB) $(RANLIB) libsim.a
 
 run$(EXEEXT): $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o run$(EXEEXT) \
+	$(ECHO_CCLD) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o run$(EXEEXT) \
 	  $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS)
 
 # FIXME: Ideally, callback.o and friends live in a library outside of
-- 
2.32.0
Eli Zaretskii via Gdb-patches June 15, 2021, 12:52 a.m. | #2
On 14 Jun 2021 20:40, Simon Marchi wrote:
> On 2021-06-14 8:02 p.m., Mike Frysinger via Gdb-patches wrote:

> > We only do the common code as automake simplifies the logic.

> 

> Are you interested in re-using what is done in GDB?  I did this quickly

> to show how it works.  It covers maybe 90% of the commands with very little

> effort.


seems fine if you want to merge it ;)
-mike
Eli Zaretskii via Gdb-patches June 15, 2021, 12:53 a.m. | #3
On 2021-06-14 8:52 p.m., Mike Frysinger wrote:
> On 14 Jun 2021 20:40, Simon Marchi wrote:

>> On 2021-06-14 8:02 p.m., Mike Frysinger via Gdb-patches wrote:

>>> We only do the common code as automake simplifies the logic.

>>

>> Are you interested in re-using what is done in GDB?  I did this quickly

>> to show how it works.  It covers maybe 90% of the commands with very little

>> effort.

> 

> seems fine if you want to merge it ;)

> -mike

> 


Ok, there's no issue in including the file directly from the gdb directory,
the sim/ directory is never released without gdb?

Simon
Eli Zaretskii via Gdb-patches June 15, 2021, 1:43 a.m. | #4
On 14 Jun 2021 20:53, Simon Marchi via Gdb-patches wrote:
> On 2021-06-14 8:52 p.m., Mike Frysinger wrote:

> > On 14 Jun 2021 20:40, Simon Marchi wrote:

> >> On 2021-06-14 8:02 p.m., Mike Frysinger via Gdb-patches wrote:

> >>> We only do the common code as automake simplifies the logic.

> >>

> >> Are you interested in re-using what is done in GDB?  I did this quickly

> >> to show how it works.  It covers maybe 90% of the commands with very little

> >> effort.

> > 

> > seems fine if you want to merge it ;)

> 

> Ok, there's no issue in including the file directly from the gdb directory,

> the sim/ directory is never released without gdb?


currently not
-mike
Eli Zaretskii via Gdb-patches June 16, 2021, 3:59 p.m. | #5
On 2021-06-14 9:43 p.m., Mike Frysinger wrote:
> On 14 Jun 2021 20:53, Simon Marchi via Gdb-patches wrote:

>> On 2021-06-14 8:52 p.m., Mike Frysinger wrote:

>>> On 14 Jun 2021 20:40, Simon Marchi wrote:

>>>> On 2021-06-14 8:02 p.m., Mike Frysinger via Gdb-patches wrote:

>>>>> We only do the common code as automake simplifies the logic.

>>>>

>>>> Are you interested in re-using what is done in GDB?  I did this quickly

>>>> to show how it works.  It covers maybe 90% of the commands with very little

>>>> effort.

>>>

>>> seems fine if you want to merge it ;)

>>

>> Ok, there's no issue in including the file directly from the gdb directory,

>> the sim/ directory is never released without gdb?

> 

> currently not

> -mike

> 


Ok, here's what I pushed.

There are still a few non-silent rules, in particular I think we could
say "GEN foo" instead of showing the big shell command that generates
it.  But I don't plan on doing it, the patch below already makes the
output easier to follow.


From 7daf500de25c0e93bc70d593a7979657a2d4ceb5 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>

Date: Wed, 16 Jun 2021 11:55:53 -0400
Subject: [PATCH] sim: make some rules silent by default in Make-common.in

Use GDB's silent-rules.mk to make some rules silent by default.  These
rules cover most of what is built in sim/.

gdb/ChangeLog:

	* silent-rules.mk (ECHO_CCLD, ECHO_AR, ECHO_RANLIB): New.

sim/ChangeLog:

	* common/Make-common.in (COMPILE, libsim.a, run$(EXEEXT),
	gentmap.o, gentmap): Make rules silent.

Change-Id: Idf9ba5beaee10c7c614859ace5fbdcd1de0287db
---
 gdb/ChangeLog             |  4 ++++
 gdb/silent-rules.mk       |  3 +++
 sim/ChangeLog             |  5 +++++
 sim/common/Make-common.in | 14 ++++++++------
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e841fdaab5e6..2444773bde93 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-16  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* silent-rules.mk (ECHO_CCLD, ECHO_AR, ECHO_RANLIB): New.
+
 2021-06-16  Tom de Vries  <tdevries@suse.de>
 
 	PR symtab/26327
diff --git a/gdb/silent-rules.mk b/gdb/silent-rules.mk
index 772bd6728be3..97d799bf2ae2 100644
--- a/gdb/silent-rules.mk
+++ b/gdb/silent-rules.mk
@@ -4,6 +4,7 @@ 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 = \
@@ -14,5 +15,7 @@ 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 $@";
 SILENCE = @
 endif
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 8896c4ca6ea7..109d5d8a9d25 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-16  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* common/Make-common.in (COMPILE, libsim.a, run$(EXEEXT),
+	gentmap.o, gentmap): Make rules silent.
+
 2021-06-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* m4/sim_ac_common.m4: Delete AC_EXEEXT call.
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 54ac7f40a9c0..0ab9e79e8fdf 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -40,6 +40,8 @@ srccom = $(srcdir)/../common
 srcroot = $(srcdir)/../..
 srcsim = $(srcdir)/..
 
+include $(srcroot)/gdb/silent-rules.mk
+
 # Helper code from gnulib.
 GNULIB_PARENT_DIR = ../..
 include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
@@ -111,7 +113,7 @@ depcomp = $(SHELL) $(srcroot)/depcomp
 # GNU make is used.  The overrides implement dependency tracking.
 COMPILE.pre = $(CC) $(C_DIALECT)
 COMPILE.post = -c -o $@
-COMPILE = $(COMPILE.pre) $(ALL_CFLAGS) $(COMPILE.post)
+COMPILE = $(ECHO_CC) $(COMPILE.pre) $(ALL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
 
 # igen leaks memory, and therefore makes AddressSanitizer unhappy.  Disable
@@ -273,11 +275,11 @@ all: libsim.a run$(EXEEXT) .gdbinit
 
 libsim.a: $(LIB_OBJS)
 	rm -f libsim.a
-	$(AR) $(AR_FLAGS) libsim.a $(LIB_OBJS)
-	$(RANLIB) libsim.a
+	$(ECHO_AR) $(AR) $(AR_FLAGS) libsim.a $(LIB_OBJS)
+	$(ECHO_RANLIB) $(RANLIB) libsim.a
 
 run$(EXEEXT): $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o run$(EXEEXT) \
+	$(ECHO_CCLD) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o run$(EXEEXT) \
 	  $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS)
 
 # FIXME: Ideally, callback.o and friends live in a library outside of
@@ -286,10 +288,10 @@ run$(EXEEXT): $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
 # a library).
 
 gentmap.o: Makefile $(srccom)/gentmap.c $(srccom)/nltvals.def
-	$(COMPILE_FOR_BUILD) -o $@ -c $(srccom)/gentmap.c $(NL_TARGET)
+	$(ECHO_CC) $(COMPILE_FOR_BUILD) -o $@ -c $(srccom)/gentmap.c $(NL_TARGET)
 
 gentmap: gentmap.o
-	$(LINK_FOR_BUILD) $<
+	$(ECHO_CC) $(LINK_FOR_BUILD) $<
 
 targ-vals.h targ-map.c: stamp-tvals
 stamp-tvals: gentmap
-- 
2.32.0
Eli Zaretskii via Gdb-patches June 17, 2021, 4:22 a.m. | #6
On 16 Jun 2021 11:59, Simon Marchi via Gdb-patches wrote:
> On 2021-06-14 9:43 p.m., Mike Frysinger wrote:

> > On 14 Jun 2021 20:53, Simon Marchi via Gdb-patches wrote:

> >> On 2021-06-14 8:52 p.m., Mike Frysinger wrote:

> >>> On 14 Jun 2021 20:40, Simon Marchi wrote:

> >>>> On 2021-06-14 8:02 p.m., Mike Frysinger via Gdb-patches wrote:

> >>>>> We only do the common code as automake simplifies the logic.

> >>>>

> >>>> Are you interested in re-using what is done in GDB?  I did this quickly

> >>>> to show how it works.  It covers maybe 90% of the commands with very little

> >>>> effort.

> >>>

> >>> seems fine if you want to merge it ;)

> >>

> >> Ok, there's no issue in including the file directly from the gdb directory,

> >> the sim/ directory is never released without gdb?

> > 

> > currently not

> 

> Ok, here's what I pushed.

> 

> There are still a few non-silent rules, in particular I think we could

> say "GEN foo" instead of showing the big shell command that generates

> it.  But I don't plan on doing it, the patch below already makes the

> output easier to follow.


yep, looks pretty good, thanks.  maybe the 90% coverage will annoy me to fix
the remaining rules if i can't unify them fast enough ;).
-mike

Patch

diff --git a/sim/common/local.mk b/sim/common/local.mk
index 076335d0b427..fc1149789a3c 100644
--- a/sim/common/local.mk
+++ b/sim/common/local.mk
@@ -39,6 +39,6 @@  noinst_LIBRARIES += %D%/libcommon.a
 	%D%/version.c
 
 %D%/version.c: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh
-	$(SHELL) $(srcdir)/%D%/create-version.sh $(srcroot)/gdb $@.tmp
-	$(SHELL) $(srcroot)/move-if-change $@.tmp $@
-	touch $@
+	$(AM_V_GEN)$(SHELL) $(srcdir)/%D%/create-version.sh $(srcroot)/gdb $@.tmp
+	$(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $@
+	$(AM_V_at)touch $@
diff --git a/sim/configure.ac b/sim/configure.ac
index e7f3f535ef59..129e9421ec1d 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -19,6 +19,7 @@  SIM_AC_PLATFORM
 
 AM_MAINTAINER_MODE
 AM_INIT_AUTOMAKE
+AM_SILENT_RULES([yes])
 
 # If a cpu ever has more than one simulator to choose from, use
 # --enable-sim=... to choose.
diff --git a/sim/testsuite/common/local.mk b/sim/testsuite/common/local.mk
index 4db7981d1602..69f2d70eb5f4 100644
--- a/sim/testsuite/common/local.mk
+++ b/sim/testsuite/common/local.mk
@@ -49,33 +49,33 @@  check_PROGRAMS += $(TESTS)
 	$(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits32m0_OBJECTS) $(%C%_bits32m0_LDADD)
 
 %D%/bits32m0.c: %D%/bits-gen %D%/bits-tst.c
-	$< 32 0 big > $@.tmp
-	cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
-	mv $@.tmp $@
+	$(AM_V_GEN)$< 32 0 big > $@.tmp
+	$(AM_V_at)cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
+	$(AM_V_at)mv $@.tmp $@
 
 %D%/bits32m31$(EXEEXT): $(%C%_bits32m31_OBJECTS) $(%C%_bits32m31_DEPENDENCIES) %D%/$(am__dirstamp)
 	$(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits32m31_OBJECTS) $(%C%_bits32m31_LDADD)
 
 %D%/bits32m31.c: %D%/bits-gen %D%/bits-tst.c
-	$< 32 31 little > $@.tmp
-	cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
-	mv $@.tmp $@
+	$(AM_V_GEN)$< 32 31 little > $@.tmp
+	$(AM_V_at)cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
+	$(AM_V_at)mv $@.tmp $@
 
 %D%/bits64m0$(EXEEXT): $(%C%_bits64m0_OBJECTS) $(%C%_bits64m0_DEPENDENCIES) %D%/$(am__dirstamp)
 	$(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits64m0_OBJECTS) $(%C%_bits64m0_LDADD)
 
 %D%/bits64m0.c: %D%/bits-gen %D%/bits-tst.c
-	$< 64 0 big > $@.tmp
-	cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
-	mv $@.tmp $@
+	$(AM_V_GEN)$< 64 0 big > $@.tmp
+	$(AM_V_at)cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
+	$(AM_V_at)mv $@.tmp $@
 
 %D%/bits64m63$(EXEEXT): $(%C%_bits64m63_OBJECTS) $(%C%_bits64m63_DEPENDENCIES) %D%/$(am__dirstamp)
 	$(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_bits64m63_OBJECTS) $(%C%_bits64m63_LDADD)
 
 %D%/bits64m63.c: %D%/bits-gen %D%/bits-tst.c
-	$< 64 63 little > $@.tmp
-	cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
-	mv $@.tmp $@
+	$(AM_V_GEN)$< 64 63 little > $@.tmp
+	$(AM_V_at)cat $(srcdir)/%D%/bits-tst.c >> $@.tmp
+	$(AM_V_at)mv $@.tmp $@
 
 CLEANFILES += \
 	%D%/bits-gen \