diff mbox series

[v4,23/23] Makefile: move ".SUFFIXES" rule to shared.mak

Message ID patch-v4-23.23-48a3927d972-20211117T101807Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series Makefile: dependency fixes, make noop runtime ~1.4x faster | expand

Commit Message

Ævar Arnfjörð Bjarmason Nov. 17, 2021, 10:20 a.m. UTC
This was added in 30248886ce8 (Makefile: disable default implicit
rules, 2010-01-26), let's move it to the top of "shared.mak" so it'll
apply to all our Makefiles.

This doesn't benefit the main Makefile at all, since it already had
the rule, but since we're including shared.mak in other Makefiles
starts to benefit them. E.g. running the 'man" target is now ~1.3x
faster:

    $ git -c hyperfine.hook.setup= hyperfine -L rev HEAD~1,HEAD~0 -s 'make -j8 -C Documentation man' 'make -C Documentation man' --warmup 10 -M 10
    Benchmark 1: make -C Documentation man' in 'HEAD~1
      Time (mean ± σ):      87.2 ms ±   1.0 ms    [User: 79.3 ms, System: 10.8 ms]
      Range (min … max):    86.3 ms …  89.7 ms    10 runs

    Benchmark 2: make -C Documentation man' in 'HEAD~0
      Time (mean ± σ):      64.5 ms ±   0.6 ms    [User: 54.5 ms, System: 13.0 ms]
      Range (min … max):    63.8 ms …  65.7 ms    10 runs

    Summary
      'make -C Documentation man' in 'HEAD~0' ran
        1.35 ± 0.02 times faster than 'make -C Documentation man' in 'HEAD~1'

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile   | 2 --
 shared.mak | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index eb1c944787b..035573c8997 100644
--- a/Makefile
+++ b/Makefile
@@ -2459,8 +2459,6 @@  ASM_SRC := $(wildcard $(OBJECTS:o=S))
 ASM_OBJ := $(ASM_SRC:S=o)
 C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
 
-.SUFFIXES:
-
 $(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
 	$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
 $(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
diff --git a/shared.mak b/shared.mak
index 20109e6a90e..d8453bb471f 100644
--- a/shared.mak
+++ b/shared.mak
@@ -9,6 +9,11 @@ 
 %:: s.%
 %:: SCCS/s.%
 
+## Likewise delete default $(SUFFIXES). See:
+##
+##     info make --index-search=.DELETE_ON_ERROR
+.SUFFIXES:
+
 ### Flags affecting all rules
 
 # A GNU make extension since gmake 3.72 (released in late 1994) to