Message ID | 20161116160808.12830-4-simon.marchi@ericsson.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 127618 invoked by alias); 16 Nov 2016 16:12:29 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 127605 invoked by uid 89); 16 Nov 2016 16:12:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 spammy=gmo, U*$, co, PACKAGE X-HELO: sessmg23.ericsson.net Received: from sessmg23.ericsson.net (HELO sessmg23.ericsson.net) (193.180.251.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Nov 2016 16:12:18 +0000 Received: from ESESSHC015.ericsson.se (Unknown_Domain [153.88.183.63]) by (Symantec Mail Security) with SMTP id E9.C8.02551.A458C285; Wed, 16 Nov 2016 17:11:54 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.63) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 16 Nov 2016 17:08:31 +0100 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from elxcz23q12-y4.dyn.mo.ca.am.ericsson.se (192.75.88.130) by AMSPR07MB389.eurprd07.prod.outlook.com (10.242.22.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.2; Wed, 16 Nov 2016 16:08:29 +0000 From: Simon Marchi <simon.marchi@ericsson.com> To: <gdb-patches@sourceware.org> CC: Simon Marchi <simon.marchi@polymtl.ca> Subject: [PATCH 3/4] Makefile: Replace old suffix rules with pattern rules Date: Wed, 16 Nov 2016 11:08:07 -0500 Message-ID: <20161116160808.12830-4-simon.marchi@ericsson.com> In-Reply-To: <20161116160808.12830-1-simon.marchi@ericsson.com> References: <20161116160808.12830-1-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: SN1PR02CA0035.namprd02.prod.outlook.com (10.165.224.173) To AMSPR07MB389.eurprd07.prod.outlook.com (10.242.22.11) X-Microsoft-Exchange-Diagnostics: 1; AMSPR07MB389; 2:Z74k1xu0ktEyqs9HOMA2Jcg91xSP3gt+X+WAZfQgdHk5vTjgx7Q1cWxqTfupUELg23QFpOUqplmwqsx7WS7ylos7lVUKo6zJfI2XYNLg4CSIeqqqGg8c2BJh6NNOvHdaw32A6BXfXhgLbvlb5k+7MGY4Tl5w8Uz2pW7Pg7xzkiM=; 3:8v8dN+C915l3NIhVzfdd/YAOlKqKTvzfq+E0iBsWanHdwfrQjyVegC3ED6YnsS2xEIMAdOwrKFV/gfKZwr6+ATvcNyo+MAz3b6CuIqeoVdJhmikN3M1+NnJBIF+2HvSDeKzipZtEHDFWE4eUXrivRSnQYF9jwFPEoyNVW3oLqPU= X-MS-Office365-Filtering-Correlation-Id: 1dae17d3-c108-4daf-06b9-08d40e3ace98 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AMSPR07MB389; X-Microsoft-Exchange-Diagnostics: 1; AMSPR07MB389; 25:F3Fc0o3eWGe54FqDk+7ouuLb9uyAVICvDXLJcV0HafShmqwv13qJaH9/CiFFKQdw98BjIXYpcmZ3esuh4CdUKa4PmsUe8/uXwbLhZ6/foSxihvNXcevPw3ZH0sTondm/rtWSYUwh1nh6T+1Oy/yzuCpYAQmjgnmseu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HxVZQouy212Ww=; 20:ahdQpojjA1/PM+ntDOtLKu+5LM4+Fh6nK/v45lyjGXYZWxHn9+bTV/YNHtBAq6oKjbkkhtGJRmfPoPPD07P7ulAQS/PtbM6ymC9UWZiZs5rvPy44bovdZfs4JlAQa2xpACHnHT9zP4cHAAN+ZiDDuM/1fu5aUBWZ+toxZRWqFAORkkvtQ9UDQzC3K5A+C8XihR9EaKEweCop6c2DQ3I8d5M3Ww0cfXR/iJtH5OIaVqEEasb3B/drA9svK9XdT37T5bszsZ51wT/Dq0PTjdqZBNO6WdNYRlBxjWjL1vbTxxq8YmHklLaAoCkwSCD7blsjQUAjvB7eLlsQZ9+cKHnHO9ewplyFOfxOckFX0js4yqqRekGnd9BGnG9aEDKsTHb6k2LpafixagPvDHebjdfsAQoO19BnKirnW4fcbKjS7EgyToXO4xjE6EsZmjGZoNt8WNwccGBlc8yunPDrd/2/Y8nDYtpyIv9nRrD18kY1CbKOrk91wISUhJ2dAM0u6Kfp X-Microsoft-Antispam-PRVS: <AMSPR07MB3896B46D59BF4BAE4645D9FEDBE0@AMSPR07MB389.eurprd07.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060326)(6040281)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041223)(6061324); SRVR:AMSPR07MB389; BCL:0; PCL:0; RULEID:; SRVR:AMSPR07MB389; X-Microsoft-Exchange-Diagnostics: 1; AMSPR07MB389; 4:a19DXE7WWIJaMDmPN/9aw5t56+8fY2oG285GDQYJgxe87IwfjSLSZd+rAguXIavPmC67QufhRzSOpASsR0Ks4bxyhWhfGntgSb9QYhNvnhxhNtGH+TSqpzsA7MnL9E/EoWpNNw1fm/s8hAQzpbAQss7JCdeBAl9qN9HIp42OUVXkSxzZ7YHnaZ5yrsqVDur7T9aVtTQ0B5TDmZNGNZtbJQykEbZEnLqPZ8Rg7ux0b/9dxn6NJhiMyQW78qZ7kv12SBKUv6K1giU+75XcJYWzAf1b8tE/O/8CATRUkLudiN4cSiDX1e0WMSQSlxKb9N6rT/roqeI3ir2UmxDXJfV93epZ83Frl28HqotwqH2dYEUvXpmlLg+t0csyHB7St1izt3y9EMCU+Rg/xRk7GiPoIzbwobwZrsUj2x4kDy33tGb07kpB9kjagby5IFHOm7ywI1WZC+1diZ9gjM7/VttsJjU/9FWl9x45g5ZWxSDXWm08VURqJde0M3J+N2m1Rjn2CFGE7spDQRTqfJo1cDztjAoSzfUKPfwRtAKFjuwLzFrPvNBv1PBmukkZqZFVp/gr X-Forefront-PRVS: 01283822F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(54534003)(66066001)(81156014)(81166006)(50466002)(68736007)(2950100002)(5003940100001)(6666003)(8676002)(47776003)(189998001)(6916009)(5660300001)(4326007)(50226002)(105586002)(305945005)(50986999)(36756003)(106356001)(7846002)(92566002)(7736002)(76176999)(2351001)(48376002)(1076002)(42186005)(77096005)(101416001)(110136003)(6116002)(86362001)(3846002)(33646002)(2906002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:AMSPR07MB389; H:elxcz23q12-y4.dyn.mo.ca.am.ericsson.se; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AMSPR07MB389; 23:kvc2HWfYbLoWmj07UN/21VOF2BmjP0/lMqQbds1DiO?= =?us-ascii?Q?Of524x0NGOB228gM/zrn2z1hyT/8HptkRBotwjnRyRlVz+KB011EMcm7IMSI?= =?us-ascii?Q?0JlpkvIZp+viFNCe10UnJQTMse8O9g8bIREvpXS/IynMPDIJWFl8OOM2pSfp?= =?us-ascii?Q?ULfZKAml3PWyOe90PO+ztKY+10fEBRlWFl6/Z/344d7LEdaVu984mB+gDo0f?= =?us-asc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wPC+JWgurK1blXTQR/9U8Q= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2016 16:08:29.5708 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMSPR07MB389 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes |
Commit Message
Simon Marchi
Nov. 16, 2016, 4:08 p.m. UTC
From: Simon Marchi <simon.marchi@polymtl.ca>
As mentioned here [1], suffix rules are obsolete and have been
superseeded with pattern rules. People (myself included, before writing
this patch) are more likely to know what pattern rules are than suffix
rules.
AFAIK, .SUFFIXES targets are only used for those rules, and can be
removed as well.
New in v2:
- Replace rule in gdbserver/Makefile.in as well.
[1] https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html
gdb/ChangeLog:
* Makefile.in (.c.o): Replace rule with ...
(%.o: %.c): ... this one.
(.po.gmo): Replace rule with ...
(%.gmo: %.po): ... this one.
(.po.pox): Replace rule with ...
(%.pox: %.po): ... this one.
(.y.c): Replace rule with ...
(%.c: %.y): ... this one.
(.l.c): Replace rule with ...
(%.c: %.l): ... this one.
(.SUFFIXES): Remove all instances.
gdb/gdbserver/ChangeLog:
* Makefile.in (.c.o): Replace rule with ...
(%.o: %.c): ... this one.
---
gdb/Makefile.in | 12 +++++-------
gdb/gdbserver/Makefile.in | 2 +-
2 files changed, 6 insertions(+), 8 deletions(-)
Comments
> From: Simon Marchi <simon.marchi@ericsson.com> > CC: Simon Marchi <simon.marchi@polymtl.ca> > Date: Wed, 16 Nov 2016 11:08:07 -0500 > > AFAIK, .SUFFIXES targets are only used for those rules, and can be > removed as well. AFAIK, .SUFFIXES affects built-in rules, and so having there only suffixes relevant to our build will make the build faster, sometimes much faster, because Make doesn't need to consider irrelevant built-in rules. When in doubt, we can ask the GNU Make maintainer to help us.
On 11/16/2016 04:34 PM, Eli Zaretskii wrote: >> From: Simon Marchi <simon.marchi@ericsson.com> >> CC: Simon Marchi <simon.marchi@polymtl.ca> >> Date: Wed, 16 Nov 2016 11:08:07 -0500 >> >> AFAIK, .SUFFIXES targets are only used for those rules, and can be >> removed as well. > > AFAIK, .SUFFIXES affects built-in rules, and so having there only > suffixes relevant to our build will make the build faster, sometimes > much faster, because Make doesn't need to consider irrelevant built-in > rules. > Given the shared ancestry, and the fact that GCC nowadays requires GNU make, I think it may be worth it to take a look at what does GCC's Makefile.in do. In this case, it has: ~~~ # Suppress smart makes who think they know how to automake yacc and flex file .y.c: .l.c: # The only suffixes we want for implicit rules are .c and .o, so clear # the list and add them. This speeds up GNU Make, and allows -r to work. # For i18n support, we also need .gmo, .po, .pox. # This must come before the language makefile fragments to allow them to # add suffixes and rules of their own. .SUFFIXES: .SUFFIXES: .c .cc .o .po .pox .gmo ~~~ I don't know why they still add some suffixes instead of relying on the pattern rules. Might just be legacy. > When in doubt, we can ask the GNU Make maintainer to help us. Here's what he was saying in an internal GNU list (about speeding up make and emptying '.SUFFIXES'): ~~~ This doesn't get rid of all the implicit rules in GNU make, however, because some default rules are pattern rules which are not affected by the .SUFFIXES special target. To get rid of all implicit rules in GNU make you have to either invoke make with the -r option [...], or else add this to your makefile: .SUFFIXES: %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% ~~~ I'd be curious if this makes any difference in a "make" invocation that ends up building nothing (because all targets are already up to date). Thanks, Pedro Alves
> Cc: gdb-patches@sourceware.org > From: Pedro Alves <palves@redhat.com> > Date: Wed, 16 Nov 2016 16:56:02 +0000 > > Given the shared ancestry, and the fact that GCC nowadays requires > GNU make, I think it may be worth it to take a look at what > does GCC's Makefile.in do. > > In this case, it has: > > ~~~ > # Suppress smart makes who think they know how to automake yacc and flex file > .y.c: > .l.c: > > # The only suffixes we want for implicit rules are .c and .o, so clear > # the list and add them. This speeds up GNU Make, and allows -r to work. > # For i18n support, we also need .gmo, .po, .pox. > # This must come before the language makefile fragments to allow them to > # add suffixes and rules of their own. > .SUFFIXES: > .SUFFIXES: .c .cc .o .po .pox .gmo > ~~~ > > I don't know why they still add some suffixes instead of relying > on the pattern rules. Might just be legacy. No, it's because of the built-in rules. They are by default considered no matter which pattern rules you have in the Makefile, because theoretically each .c file can be built from some other file in any number of ways. > This doesn't get rid of all the implicit rules in GNU make, however, > because some default rules are pattern rules which are not affected by > the .SUFFIXES special target. > > To get rid of all implicit rules in GNU make you have to either invoke > make with the -r option [...], or else add this to your makefile: > > .SUFFIXES: > %:: %,v > %:: RCS/%,v > %:: RCS/% > %:: s.% > %:: SCCS/s.% > ~~~ > > I'd be curious if this makes any difference in a "make" invocation > that ends up building nothing (because all targets are already > up to date). It might produce a significant difference, but of course the interesting case is when a small number of files need to be recompiled.
On 11/16/2016 05:14 PM, Eli Zaretskii wrote: >> Cc: gdb-patches@sourceware.org >> From: Pedro Alves <palves@redhat.com> >> Date: Wed, 16 Nov 2016 16:56:02 +0000 >> >> Given the shared ancestry, and the fact that GCC nowadays requires >> GNU make, I think it may be worth it to take a look at what >> does GCC's Makefile.in do. >> >> In this case, it has: >> >> ~~~ >> # Suppress smart makes who think they know how to automake yacc and flex file >> .y.c: >> .l.c: >> >> # The only suffixes we want for implicit rules are .c and .o, so clear >> # the list and add them. This speeds up GNU Make, and allows -r to work. >> # For i18n support, we also need .gmo, .po, .pox. >> # This must come before the language makefile fragments to allow them to >> # add suffixes and rules of their own. >> .SUFFIXES: >> .SUFFIXES: .c .cc .o .po .pox .gmo >> ~~~ >> >> I don't know why they still add some suffixes instead of relying >> on the pattern rules. Might just be legacy. > > No, it's because of the built-in rules. They are by default > considered no matter which pattern rules you have in the Makefile, > because theoretically each .c file can be built from some other file > in any number of ways. I still don't understand. The question is why they add back some suffixes _after_ having deleted all the implicit rules. I.e., why do: .SUFFIXES: .SUFFIXES: .c instead of: .SUFFIXES: %.o: %.c They use pattern rules for other, more specific cases, AFAICS. Thanks, Pedro Alves
> Cc: simon.marchi@ericsson.com, gdb-patches@sourceware.org > From: Pedro Alves <palves@redhat.com> > Date: Wed, 16 Nov 2016 17:32:28 +0000 > > >> # The only suffixes we want for implicit rules are .c and .o, so clear > >> # the list and add them. This speeds up GNU Make, and allows -r to work. > >> # For i18n support, we also need .gmo, .po, .pox. > >> # This must come before the language makefile fragments to allow them to > >> # add suffixes and rules of their own. > >> .SUFFIXES: > >> .SUFFIXES: .c .cc .o .po .pox .gmo > >> ~~~ > >> > >> I don't know why they still add some suffixes instead of relying > >> on the pattern rules. Might just be legacy. > > > > No, it's because of the built-in rules. They are by default > > considered no matter which pattern rules you have in the Makefile, > > because theoretically each .c file can be built from some other file > > in any number of ways. > > I still don't understand. The question is why they add back > some suffixes _after_ having deleted all the implicit rules. > I.e., why do: > > .SUFFIXES: > .SUFFIXES: .c > > instead of: > > .SUFFIXES: > %.o: %.c > > They use pattern rules for other, more specific cases, AFAICS. Doesn't the comment explain that? And who said you should use pattern rules for everything? Suffix rules are not a dirty word.
On 11/16/2016 05:49 PM, Eli Zaretskii wrote: > And who said you should use pattern rules for everything? Suffix > rules are not a dirty word. Of course not. The point was --- is there is perhaps some odd reason for adding back the default rules, when you have pattern rules that would match anyway. I don't know of one, but ... Anyway, doesn't really matter. Thanks, Pedro Alves
On 11/16/2016 04:08 PM, Simon Marchi wrote: > From: Simon Marchi <simon.marchi@polymtl.ca> > > As mentioned here [1], suffix rules are obsolete and have been > superseeded with pattern rules. People (myself included, before writing > this patch) are more likely to know what pattern rules are than suffix > rules. > > AFAIK, .SUFFIXES targets are only used for those rules, and can be > removed as well. > > New in v2: > > - Replace rule in gdbserver/Makefile.in as well. > > [1] https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html > > gdb/ChangeLog: > > * Makefile.in (.c.o): Replace rule with ... > (%.o: %.c): ... this one. > (.po.gmo): Replace rule with ... > (%.gmo: %.po): ... this one. > (.po.pox): Replace rule with ... > (%.pox: %.po): ... this one. > (.y.c): Replace rule with ... > (%.c: %.y): ... this one. > (.l.c): Replace rule with ... > (%.c: %.l): ... this one. > (.SUFFIXES): Remove all instances. > > gdb/gdbserver/ChangeLog: > > * Makefile.in (.c.o): Replace rule with ... > (%.o: %.c): ... this one. IMO, whether to explicitly remove default suffixes from the the implicit rule suffixes list for efficiency is a separate subject, since we're not currently doing it either. Just to be sure none of the default suffix rules is necessary, can you confirm: 1. that "make -r" (from scratch) still works. 2. that "make -r diststuff" in the gdb build dir still works. If the above work, then this is OK with me to push in. Thanks, Pedro Alves
On 2016-11-16 11:56, Pedro Alves wrote: > # Suppress smart makes who think they know how to automake yacc and > flex file > .y.c: > .l.c: I don't understand how that can be useful. According to the GNU make doc: Suffix rules with no recipe are also meaningless. They do not remove previous rules as do pattern rules with no recipe (see Canceling Implicit Rules). They simply enter the suffix or pair of suffixes concatenated as a target in the data base. Source: https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html So those two would be meaningless? > ~~~ > This doesn't get rid of all the implicit rules in GNU make, however, > because some default rules are pattern rules which are not affected by > the .SUFFIXES special target. > > To get rid of all implicit rules in GNU make you have to either invoke > make with the -r option [...], or else add this to your makefile: > > .SUFFIXES: > %:: %,v > %:: RCS/%,v > %:: RCS/% > %:: s.% > %:: SCCS/s.% > ~~~ > > I'd be curious if this makes any difference in a "make" invocation > that ends up building nothing (because all targets are already > up to date). When looking at the make debug output (make -d), I think it becomes obvious: http://pastebin.com/raw/cETk9W3v That's taken without .SUFFIXES or other means to disable implicit rules. For _each_ .c file, make tries to determine if it was generated somehow, and you can see the lines which the rules you mentioned would suppress. In our case, most C files are not generated, and those that are have an explicit rule. I don't think we rely on implicit rules. Since we don't use them, I think it makes sense to disable then as much as possible. Plus, I can imagine them being a possible source of "bugs". If you happen to have a file called infrun.l by accident, the the build will fail and you'll wonder why. I did some experiments, here's the time it takes to run make in the gdb/ directory with nothing to re-build. The other number is the number of lines printed when running make -d. It gives a rough idea of the amount of operations make does. Note that these results are by changing both gdb/Makefile.in and gdb/gdbserver/Makefile.in. That's fair, since the -r applies recursively as well. Baseline: 2.5 seconds, 2306335 lines With .SUFFIXES: 0.7 seconds, 307706 lines With .SUFFIXES and the other %:: rules: 0.6 seconds, 255386 lines With -r flag (make -r): 0.5 seconds, 160682 lines So I think it shows that it wouldn't hurt to use ".SUFFIXES =" and the other rules from the gcc Makefile. I couldn't manage to get rid of the %.{y,l,w} -> %.c implicit rules though no matter what I tried. Calling make with the -r flag was the only way. At this point the returns are minimal though, so I don't think we should worry about it.
On 11/16/2016 07:38 PM, Simon Marchi wrote: > I did some experiments, here's the time it takes to run make in the gdb/ > directory with nothing to re-build. The other number is the number of > lines printed when running make -d. It gives a rough idea of the amount > of operations make does. > > Note that these results are by changing both gdb/Makefile.in and > gdb/gdbserver/Makefile.in. That's fair, since the -r applies > recursively as well. > > Baseline: 2.5 seconds, 2306335 lines > With .SUFFIXES: 0.7 seconds, 307706 lines > With .SUFFIXES and the other %:: rules: 0.6 seconds, 255386 lines > With -r flag (make -r): 0.5 seconds, 160682 lines That's a nice speedup. Presumably if you change gdb/doc/ and gdb/testsuite/ too, the number without -r gets even closer to the -r number. If it works, I think it'll be nice to put the ".SUFFIXES and the other %:: rules" bits in a shared makefile fragment that is included (with the include directive) by all the main Makefile.in files. > So I think it shows that it wouldn't hurt to use ".SUFFIXES =" and the > other rules from the gcc Makefile. I couldn't manage to get rid of the > %.{y,l,w} -> %.c implicit rules though no matter what I tried. Calling > make with the -r flag was the only way. At this point the returns are > minimal though, so I don't think we should worry about it. Thanks, Pedro Alves
On 2016-11-16 14:58, Pedro Alves wrote: > On 11/16/2016 07:38 PM, Simon Marchi wrote: > >> I did some experiments, here's the time it takes to run make in the >> gdb/ >> directory with nothing to re-build. The other number is the number of >> lines printed when running make -d. It gives a rough idea of the >> amount >> of operations make does. >> >> Note that these results are by changing both gdb/Makefile.in and >> gdb/gdbserver/Makefile.in. That's fair, since the -r applies >> recursively as well. >> >> Baseline: 2.5 seconds, 2306335 lines >> With .SUFFIXES: 0.7 seconds, 307706 lines >> With .SUFFIXES and the other %:: rules: 0.6 seconds, 255386 lines >> With -r flag (make -r): 0.5 seconds, 160682 lines > > That's a nice speedup. Presumably if you change gdb/doc/ and > gdb/testsuite/ too, the number without -r gets even closer to > the -r number. Right, but not by much I think. The implicit rules are mostly for yacc, lex and c files. There isn't much target matching those in testsuite and doc. > If it works, I think it'll be nice to put the > ".SUFFIXES and the other %:: rules" bits in a shared makefile fragment > that > is included (with the include directive) by all the main Makefile.in > files. Good idea.
On 2016-11-16 14:10, Pedro Alves wrote: > IMO, whether to explicitly remove default suffixes from the > the implicit rule suffixes list for efficiency is a separate > subject, since we're not currently doing it either. > > Just to be sure none of the default suffix rules is necessary, > can you confirm: > > 1. that "make -r" (from scratch) still works. "make -r" from scratch from the top-level fails in the readline directory: ar: readline.o: No such file or directory It seems like readline relies on implicit rules. It shouldn't be affected by gdb disabling them though. I did a "make" in the readline directory to make it build, then resume the top-level build with "make -r", and it finished cleanly. > 2. that "make -r diststuff" in the gdb build dir still works. The commands completes successfully, so it looks good. Still, perhaps Joel should be a little bit more careful when doing the next release to make sure nothing it missing. > If the above work, then this is OK with me to push in. Just to be clear, this patchset does not disable the default suffix rules, so I don't think it was really necessary to check that for this patch. But at least we know it's safe for when we'll want to disable them. Thanks, Simon
On 11/17/2016 04:52 PM, Simon Marchi wrote: > On 2016-11-16 14:10, Pedro Alves wrote: >> IMO, whether to explicitly remove default suffixes from the >> the implicit rule suffixes list for efficiency is a separate >> subject, since we're not currently doing it either. >> >> Just to be sure none of the default suffix rules is necessary, >> can you confirm: >> >> 1. that "make -r" (from scratch) still works. > > "make -r" from scratch from the top-level fails in the readline directory: > > ar: readline.o: No such file or directory > > It seems like readline relies on implicit rules. It shouldn't be > affected by gdb disabling them though. I did a "make" in the readline > directory to make it build, then resume the top-level build with "make > -r", and it finished cleanly. > >> 2. that "make -r diststuff" in the gdb build dir still works. > > The commands completes successfully, so it looks good. Still, perhaps > Joel should be a little bit more careful when doing the next release to > make sure nothing it missing. > >> If the above work, then this is OK with me to push in. > > Just to be clear, this patchset does not disable the default suffix > rules, so I don't think it was really necessary to check that for this > patch. But at least we know it's safe for when we'll want to disable them. You've changed .pot etc. rules which aren't triggered by a normal build, so I wanted to be sure that they weren't now working after the patch just because we'd happen to pick the default rules instead of the new patterns. So I think it was useful testing. In any case, it works, so I'm happy. :-) Thanks, Pedro Alves
diff --git a/gdb/Makefile.in b/gdb/Makefile.in index f53b121..fe10a8d 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1122,7 +1122,7 @@ DISTSTUFF = $(YYFILES) generated_files = config.h observer.h observer.inc ada-lex.c jit-reader.h \ $(GNULIB_H) $(NAT_GENERATED_FILES) gcore -.c.o: +%.o: %.c $(COMPILE) $< $(POSTCOMPILE) @@ -1801,7 +1801,6 @@ ada-exp.o: ada-exp.c # Rules for generating translated message descriptions. Disabled by # autoconf if the tools are not available. -.SUFFIXES: .po .gmo .pox .pot .PHONY: all-po install-po uninstall-po clean-po update-po $(PACKAGE).pot all-po: $(CATALOGS) @@ -1812,14 +1811,14 @@ update-po: $(CATALOGS:.gmo=.pox) # N.B. We do not attempt to copy these into $(srcdir). The snapshot # script does that. -.po.gmo: +%.gmo: %.po -test -d po || mkdir po $(GMSGFMT) --statistics -o $@ $< # The new .po has to be gone over by hand, so we deposit it into # build/po with a different extension. If build/po/$(PACKAGE).pot # exists, use it (it was just created), else use the one in srcdir. -.po.pox: +%.pox: %.po -test -d po || mkdir po $(MSGMERGE) $< `if test -f po/$(PACKAGE).pot; \ then echo po/$(PACKAGE).pot; \ @@ -1880,8 +1879,7 @@ po/$(PACKAGE).pot: force # Strictly speaking c-exp.c should therefore depend on # Makefile.in, but that was a pretty big annoyance. -.SUFFIXES: .y .l -.y.c: +%.c: %.y rm -f $@ $@.tmp $(SHELL) $(YLWRAP) $< y.tab.c $@ -- $(YACC) $(YFLAGS) && mv $@ $@.tmp \ || (rm -f $@; false) @@ -1897,7 +1895,7 @@ po/$(PACKAGE).pot: force -e 's/YY_NULL/YY_NULLPTR/g' \ < $@.tmp > $@ rm -f $@.tmp -.l.c: +%.c: %.l if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \ $(FLEX) -o$@ $< && \ rm -f $@.new && \ diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index a1f4675..c25d21e 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -256,7 +256,7 @@ FLAGS_TO_PASS = \ # All generated files which can be included by another file. generated_files = config.h $(GNULIB_H) -.c.o: +%.o: %.c $(COMPILE) $< $(POSTCOMPILE)