This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix make 3.81 build errors
- From: Alan Hayward <Alan dot Hayward at arm dot com>
- To: Andreas Schwab <schwab at suse dot de>, Simon Marchi <simark at simark dot ca>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Mon, 19 Feb 2018 16:39:52 +0000
- Subject: Re: [PATCH] Fix make 3.81 build errors
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan dot Hayward at arm dot com;
- Nodisclaimer: True
- References: <2254C28C-A28A-4720-A573-CFC2BA60C5A1@arm.com> <mvmo9klq7qx.fsf@suse.de>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
> On 19 Feb 2018, at 16:11, Andreas Schwab <schwab@suse.de> wrote:
>
> On Feb 19 2018, Alan Hayward <Alan.Hayward@arm.com> wrote:
>
>> Make rules in make 3.81 are parsed slightly different than newer
>> versions of make.
>
> Probably this change:
>
> * WARNING: Backward-incompatibility!
> The pattern-specific variables and pattern rules are now applied in the
> shortest stem first order instead of the definition order (variables
> and rules with the same stem length are still applied in the definition
> order). This produces the usually-desired behavior where more specific
> patterns are preferred. To detect this feature search for 'shortest-stem'
> in the .FEATURES special variable.
>
Make sense. But I’m still confused as to exactly why the IPA rules are
getting hit.
Thanks for the explanation.
> On 19 Feb 2018, at 16:16, Simon Marchi <simark@simark.ca> wrote:
>
> Hi Alan,
>
> I hit this problem with GNU Make 3.81 before, there's a comment in the gdbserver Makefile:
>
> # Note: Between two matching pattern rules, GNU Make 3.81 chooses the first one.
> # Therefore, this one needs to be before "%.o: %.c" for it to be considered for
> # files such as linux-amd64-ipa.o generated from linux-amd64-ipa.c.
> #
> # Later versions of GNU Make choose the rule with the shortest stem, so it would
> # work in any order.
>
> So to please Make 3.81, you need to order rules from the more specific (shorter stem)
> to the more general (longer stem) if you want it to pick up the more specific rule.
> That means putting "common/%.o: ../common/%.c" before "%.o: %.c".
>
> I think there's a way to do it while keeping related rules a bit more together. What
> about the patch below? I moved a bit more than necessary (e.g. the arch/ rule) to put
> all rules for things that go into the gdbserver binary together and have a similar order
> for both gdbserver and the IPA.
>
Thanks for the patch.
I’m happy with this. It’s makes the makefile tidier than with my fix.
I’ve tested it on my builds and it works fine for me (make 3.81, make 4) x (x86, aarch32).
I would have made my patch look a little neater, but I really didn’t want to touch more than I had to.
Alan.