From patchwork Sat Nov 26 04:04:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 17946 Received: (qmail 113403 invoked by alias); 26 Nov 2016 04:04:23 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 113364 invoked by uid 89); 26 Nov 2016 04:04:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=AWL, BAYES_50, SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=Hx-spam-relays-external:sk:cable-1, H*RU:sk:cable-1, H*r:sk:cable-1, 6766 X-HELO: barracuda.ebox.ca Received: from barracuda.ebox.ca (HELO barracuda.ebox.ca) (96.127.255.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 26 Nov 2016 04:04:09 +0000 X-ASG-Debug-ID: 1480133047-0c856e65d5bc0330001-fS2M51 Received: from smtp.electronicbox.net (smtp.electronicbox.net [96.127.255.82]) by barracuda.ebox.ca with ESMTP id JzbzNq1YIaSZ3t5d (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 25 Nov 2016 23:04:07 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.lan (cable-11.246.173-162.electronicbox.net [173.246.11.162]) by smtp.electronicbox.net (Postfix) with ESMTP id ECD13440E7C; Fri, 25 Nov 2016 23:04:06 -0500 (EST) From: Simon Marchi X-Barracuda-Effective-Source-IP: cable-11.246.173-162.electronicbox.net[173.246.11.162] X-Barracuda-Apparent-Source-IP: 173.246.11.162 X-Barracuda-RBL-IP: 173.246.11.162 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] Makefiles: Disable suffix rules and implicit rules Date: Fri, 25 Nov 2016 23:04:05 -0500 X-ASG-Orig-Subj: [PATCH] Makefiles: Disable suffix rules and implicit rules Message-Id: <20161126040405.20929-1-simon.marchi@polymtl.ca> X-Barracuda-Connect: smtp.electronicbox.net[96.127.255.82] X-Barracuda-Start-Time: 1480133047 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 5633 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M, BSF_SC0_MISMATCH_TO X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.34733 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header 0.50 BSF_RULE7568M Custom Rule 7568M X-IsSubscribed: yes 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. * doc/Makefile.in: Likewise. gdb/gdbserver/ChangeLog: * Makefile.in: Include disable-implicit-rules.mk. gdb/testsuite/ChangeLog: * Makefile.in: Include disable-implicit-rules.mk. --- gdb/Makefile.in | 3 +++ gdb/data-directory/Makefile.in | 3 +++ gdb/disable-implicit-rules.mk | 10 ++++++++++ gdb/doc/Makefile.in | 3 +++ gdb/gdbserver/Makefile.in | 3 +++ gdb/testsuite/Makefile.in | 3 +++ 6 files changed, 25 insertions(+) create mode 100644 gdb/disable-implicit-rules.mk diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 415cca3..2cf1b3d 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -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. diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in index 51b5c2a..d27765e 100644 --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in @@ -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 index 0000000..d797882 --- /dev/null +++ b/gdb/disable-implicit-rules.mk @@ -0,0 +1,10 @@ +# 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.% diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in index 70af0fe..be63c87 100644 --- a/gdb/doc/Makefile.in +++ b/gdb/doc/Makefile.in @@ -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 diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 5316c95..e17cf70 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -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". diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in index 29897ab..ad1dab2 100644 --- a/gdb/testsuite/Makefile.in +++ b/gdb/testsuite/Makefile.in @@ -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