This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/4] Makefile: Replace old suffix rules with pattern rules


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]