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 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


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