diff mbox

[pushed] gdbserver: fix Makefile dependency of regformat-generated files on regdat.sh

Message ID 20200113185840.30553-1-simon.marchi@efficios.com
State New
Headers show

Commit Message

Simon Marchi Jan. 13, 2020, 6:58 p.m. UTC
The intent of the rules modified by this patch is that the *-generated.c
files generated by regdat.sh are re-generated in the event that
regdat.sh is modified.  However, if I build, touch regdat.sh, and build
again, the files are not re-generated during the second build.

This is because regdat.sh is specified as an order-only dependency [1],
after the pipe.  Make therefore only ensures that regdat.sh exists
before generating the target file, it doesn't check the timestamp of

This patch changes it to be a regular prerequisite.

The rules use the $< variable, which is substituted by the first
prerequisite only, so the command lines won't change.

[1] https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html


	* Makefile.in (%-generated.c): Make $(regdat_sh) a regular
 gdb/gdbserver/ChangeLog   | 5 +++++
 gdb/gdbserver/Makefile.in | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
diff mbox


diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 67d39beba5b8..730c53a2e830 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@ 
+2020-01-13  Simon Marchi  <simon.marchi@efficios.com>
+	* Makefile.in (%-generated.c): Make $(regdat_sh) a regular
+	prerequisite.
 2020-01-12  Simon Marchi  <simon.marchi@polymtl.ca>
 	* linux-arm-tdesc.c: Include linux-arm-tdesc.h.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 1125426778b8..fd43e407b8a3 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -648,16 +648,16 @@  gdbsupport/%.o: ../gdbsupport/%.c
 # Rules for register format descriptions.  Suffix destination files with
 # -generated to identify and clean them easily.
-%-generated.c: ../regformats/%.dat | $(regdat_sh)
+%-generated.c: ../regformats/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
-%-generated.c: ../regformats/arm/%.dat | $(regdat_sh)
+%-generated.c: ../regformats/arm/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
-%-generated.c: ../regformats/i386/%.dat | $(regdat_sh)
+%-generated.c: ../regformats/i386/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
-%-generated.c: ../regformats/rs6000/%.dat | $(regdat_sh)
+%-generated.c: ../regformats/rs6000/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@