]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Makefiles: Disable suffix rules and implicit rules
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 30 Nov 2016 21:23:59 +0000 (16:23 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Wed, 30 Nov 2016 21:23:59 +0000 (16:23 -0500)
Since we don't use suffix rules nor implicit rules in gdb, we can
disable them.  The advantage is a slightly faster make [1].

Here are some numbers about the speedup.  I ran this on my trusty old
Intel Q6600, so the time numbers are probably higher than what you'd get
on any recent hardware.  I ran "make" in the gdb/ directory of an
already built repository (configured with --enable-targets=all).  I
recorded the time of execution (average of 5).  I then ran "make -d" and
recorded the number of printed lines, which gives a rough idea of the
number of operations done.

I compared the following configurations, to see the impact of both the
empty .SUFFIXES target and the empty pattern rules, as well as running
"make -r", which can be considered the "ideal" case.

 A - baseline
 B - baseline + .SUFFIXES
 C - baseline + pattern rules
 D - baseline + .SUFFIXES + pattern rules
 E - baseline + make -r

 config | time (s) | "make -d"
 -----------------------------
    A   |   5.74   |  2396643
    B   |   1.19   |   298469
    C   |   2.81   |  1266573
    D   |   1.13   |   245489
    E   |   1.01   |   163914

We can see that the empty .SUFFIXES target has a bigger impact than the
empty pattern rules, but still it doesn't hurt to disable the implicit
pattern rules as well.

There are still some mentions of implicit rules I can't get rid of in
the "make -d" output.  For example, it's trying to build .c files from
.w files:

  Looking for an implicit rule for '/home/simark/src/binutils-gdb/gdb/infrun.c'.
  Trying pattern rule with stem 'infrun'.
  Trying implicit prerequisite '/home/simark/src/binutils-gdb/gdb/infrun.w'.

and trying to build Makefile.in from a bunch of extensions:

  Looking for an implicit rule for 'Makefile.in'.
  Trying pattern rule with stem 'Makefile.in'.
  Trying implicit prerequisite 'Makefile.in.o'.
  Trying pattern rule with stem 'Makefile.in'.
  Trying implicit prerequisite 'Makefile.in.c'.
  Trying pattern rule with stem 'Makefile.in'.
  Trying implicit prerequisite 'Makefile.in.cc'.
  ... many more ...

If somebody knows how to disable them, we can do it, but at this point
the returns are minimal, so it is not that important.

I verified that both in-tree and out-of-tree builds work.

[1] Switching from explicit rules to pattern rules for files in
    subdirectories actually made it slower, so this is kind of a way to
    redeem myself.  But it the end it's faster than it was previously,
    so it was all worth it. :)

gdb/ChangeLog:

* disable-implicit-rules.mk: New file.
* Makefile.in: Include disable-implicit-rules.mk.
* data-directory/Makefile.in: Likewise.
* gnulib/Makefile.in: Likewise.

gdb/doc/ChangeLog:

* Makefile.in: Likewise.

gdb/gdbserver/ChangeLog:

* Makefile.in: Include disable-implicit-rules.mk.

gdb/testsuite/ChangeLog:

* Makefile.in: Include disable-implicit-rules.mk.

gdb/ChangeLog
gdb/Makefile.in
gdb/data-directory/Makefile.in
gdb/disable-implicit-rules.mk [new file with mode: 0644]
gdb/doc/ChangeLog
gdb/doc/Makefile.in
gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gnulib/Makefile.in
gdb/testsuite/ChangeLog
gdb/testsuite/Makefile.in

index 03e5f0fb5991e04ac16395da0c9426201ac999f1..85478db0007a4e06bd7e979bb5f63880bbb5c63e 100644 (file)
@@ -1,3 +1,10 @@
+2016-11-30  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * disable-implicit-rules.mk: New file.
+       * Makefile.in: Include disable-implicit-rules.mk.
+       * data-directory/Makefile.in: Likewise.
+       * gnulib/Makefile.in: Likewise.
+
 2016-11-30  Yao Qi  <yao.qi@linaro.org>
 
        * arm-tdep.c (arm_scan_prologue): Read memory as unsigned integer.
index 415cca3f39a332877e69d7e9f60e8e30b50fa6d1..2cf1b3d120808b5a1be1a49c017997235a290940 100644 (file)
@@ -2909,4 +2909,7 @@ endif
 # Dependencies.
 -include $(patsubst %.o, $(DEPDIR)/%.Po, $(all_object_files))
 
+# Disable implicit make rules.
+include $(srcdir)/disable-implicit-rules.mk
+
 ### end of the gdb Makefile.in.
index 51b5c2ab40887e43ed3309bc41f261da6b717bdb..d27765e09d1af27cfe70acda4cc366e1b6cc7098 100644 (file)
@@ -412,3 +412,6 @@ MAKEOVERRIDES=
 
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        cd $(top_builddir) && $(MAKE) data-directory/Makefile
+
+# Disable implicit make rules.
+include $(srcdir)/../disable-implicit-rules.mk
diff --git a/gdb/disable-implicit-rules.mk b/gdb/disable-implicit-rules.mk
new file mode 100644 (file)
index 0000000..b524e44
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright (C) 2016 Free Software Foundation, Inc.
+
+# This file is part of GDB.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# An empty .SUFFIXES target clears the suffixes list, which will skip lookups
+# of many implicit rules, speeding up the execution of make.
+.SUFFIXES:
+
+# Disable some implicit pattern rules.
+%: %,v
+%: RCS/%,v
+%: RCS/%
+%: s.%
+%: SCCS/s.%
index a74b4dd00c7f09b60aff8c2e81df848e732264ec..dc8244c2d01e3e7675cd762a6e609c154f352481 100644 (file)
@@ -1,3 +1,7 @@
+2016-11-30  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * Makefile.in: Likewise.
+
 2016-11-18  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * gdb.texinfo (GDB/MI Async Records): Add missing comma after
index 70af0fe146d5e589fb9c04e3bdcb0279e66d2dab..be63c8731d80b6e9b49cf53d4c41b6b31efc1ff3 100644 (file)
@@ -676,3 +676,6 @@ maintainer-clean realclean: distclean
 install: install-info install-man
 
 uninstall: uninstall-info uninstall-man
+
+# Disable implicit make rules.
+include $(srcdir)/../disable-implicit-rules.mk
index 8b83461668c7893da02b897437b9403365e63d84..fdb1ca200a9fce07095416666c9c58d6b1a08891 100644 (file)
@@ -1,3 +1,7 @@
+2016-11-30  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * Makefile.in: Include disable-implicit-rules.mk.
+
 2016-11-23  Pedro Alves  <palves@redhat.com>
 
        * debug.c: Include <chrono> instead of "gdb_sys_time.h".
index 5316c95b67f04591c448a8a14b4ed3cac0092666..e17cf70f4986ab081c046999934480a13c65bd6a 100644 (file)
@@ -1079,4 +1079,7 @@ endif
 # Dependencies.
 -include $(patsubst %.o, $(DEPDIR)/%.Po, $(all_object_files))
 
+# Disable implicit make rules.
+include $(srcdir)/../disable-implicit-rules.mk
+
 # This is the end of "Makefile.in".
index 743e3a6113ce484dc726d096029cdfaa8f134ca9..932e110327d0909b77bf86803d9501cdcca0981e 100644 (file)
@@ -287,4 +287,7 @@ force_update:
 # will remove them.
 MAKEOVERRIDES=
 
+# Disable implicit make rules.
+include $(srcdir)/../disable-implicit-rules.mk
+
 ### end of the libgnu Makefile.in.
index 81470915c1bcf14d0dca6d5bd3476c7824c9be8f..78b6cf8cc3c61ed5777d9dddad9cd4d55af9eec8 100644 (file)
@@ -1,3 +1,7 @@
+2016-11-30  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * Makefile.in: Include disable-implicit-rules.mk.
+
 2016-11-24  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * gdb.dwarf2/nonvar-access.exp: Add a test for accessing
index 29897abea1ff47fd9d40da7322f756229e6bd58e..ad1dab218465b40edce81c0d58066929473829cf 100644 (file)
@@ -372,3 +372,6 @@ read1.so: lib/read1.c
 # Build the read1 machinery.
 .PHONY: read1
 read1: read1.so expect-read1
+
+# Disable implicit make rules.
+include $(srcdir)/../disable-implicit-rules.mk