This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb: replace suffix rules with pattern rules
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 13 Jan 2014 20:18:28 -0500
- Subject: Re: [PATCH] gdb: replace suffix rules with pattern rules
- Authentication-results: sourceware.org; auth=none
- References: <1389563743-29311-1-git-send-email-patrick at parcs dot ath dot cx> <871u0b3btt dot fsf at fleche dot redhat dot com>
On Mon, Jan 13, 2014 at 2:45 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Patrick" == Patrick Palka <patrick@parcs.ath.cx> writes:
>
> Patrick> Suffix rules (e.g. .c.o:) are error-prone and may not interact
> Patrick> well with GNU make's -r/--no-builtin-rules flag. Replace them
> Patrick> with otherwise-equivalent pattern rules (e.g. %.o: %.c).
>
> Despite appearances, gdb's use of GNU make features is constrained to
> parallel check and, if GNU make is available, dependency tracking. That
> is, in theory you can do a "one-off" build of gdb using some other make.
I see. That explains why e.g. static pattern rules are not used either.
> I wouldn't mind requiring GNU make -- gcc has done it for years without
> adverse effects -- but it isn't currently the case.
>
> TBH I am not sure how you'd go about getting this sort of change
> approved.
>
> Patrick> As a result of this change, one can now successfully build gdb/ with
> Patrick> make's -r flag which improves build time by a bit.
>
> There's a zillion other directories to cope with in the tree.
> Does make -r work in all of them except gdb?
> If so, how?
Not all. The directories whose makefiles are generated by automake
work under make -r and so do the ones that don't use suffix rules at
all. The ones generated by
automake work because automake makes sure to explicitly populate the
.SUFFIXES target with the relevant file extensions. The gdb/ makefile
doesn't work
under make -r essentially because it relies on a ".c.o:" suffix rule
but the file extensions .c and .o are not in .SUFFIXES. (So, a
portable variant of the above patch would be to make sure to add .c
and .o into the .SUFFIXES target, leaving the suffix rules in place.)
Likewise for one or two other makefiles in the tree, suchas the one
under readline/.
I was not aware of the concern about portability. I'll repost a
portable version of the patch once I submit my copyright assignment.