[4/7] gdb, gdbserver: always use order-only prerequisites for generated files

Message ID 20260831185300.572297-5-simon.marchi@efficios.com
State New
Headers
Series Some Makefile cleanups |

Checks

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

Commit Message

Simon Marchi Aug. 31, 2026, 6:51 p.m. UTC
  Both gdb/Makefile.in and gdbserver/Makefile.in guard their use of
order-only prerequisites behind a check for the .VARIABLES variable,
falling back to a normal prerequisite when it is not defined:

    # Ensure that generated files are created early.  Use order-only
    # dependencies if available.  They require GNU make 3.80 or newer,
    # and the .VARIABLES variable was introduced at the same time.
    ifdef .VARIABLES
    $(all_object_files): | $(generated_files)
    else
    $(all_object_files) : $(generated_files)
    endif

Building GDB requires GNU make >= 3.82, as documented in gdb/NEWS and
(as of the previous patch) in gdb/README.  On top of that,
gdb/Makefile.in already uses an order-only prerequisite unconditionally,
in the rule for compiling .c files in the top-level gdb directory:

    %.o: %.c | $(CONFIG_DEP_SUBDIR)

Remove the conditional and trim the comment accordingly.

Change-Id: Ic5cca15f21dc1a4908f978c788f416780ea1b5cd
---
 gdb/Makefile.in       | 8 +-------
 gdbserver/Makefile.in | 8 +-------
 2 files changed, 2 insertions(+), 14 deletions(-)
  

Comments

Tom Tromey Sept. 1, 2026, 4:34 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

Simon> Both gdb/Makefile.in and gdbserver/Makefile.in guard their use of
Simon> order-only prerequisites behind a check for the .VARIABLES variable,
Simon> falling back to a normal prerequisite when it is not defined:
...
Simon> Remove the conditional and trim the comment accordingly.

Ok, thanks.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 5741ee5e2e92..cdf73ec708e0 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2837,14 +2837,8 @@  all_object_files = gdb.o $(LIBGDB_OBS) gdbtk/generic/gdbtk-main.o
 all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
     $(dir $(dep))/$(DEPDIR)/$(notdir $(dep)))
 
-# Ensure that generated files are created early.  Use order-only
-# dependencies if available.  They require GNU make 3.80 or newer,
-# and the .VARIABLES variable was introduced at the same time.
-ifdef .VARIABLES
+# Ensure that generated files are created early.
 $(all_object_files): | $(generated_files)
-else
-$(all_object_files) : $(generated_files)
-endif
 
 # Dependencies.
 -include $(all_deps_files)
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index 3a3c8e62d14f..7c6ab64196e2 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -602,14 +602,8 @@  gdbreplay.o: gdbreplay.cc
 # dependency tracking.
 all_object_files = $(OBS) $(GDBREPLAY_OBS) $(IPA_OBJS)
 
-# Ensure that generated files are created early.  Use order-only
-# dependencies if available.  They require GNU make 3.80 or newer,
-# and the .VARIABLES variable was introduced at the same time.
-ifdef .VARIABLES
+# Ensure that generated files are created early.
 $(all_object_files): | $(generated_files)
-else
-$(all_object_files) : $(generated_files)
-endif
 
 # All the .deps files to include.
 all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\