Building gprof was failed because of patched gmake (bundled with OSX). Follow is a patch to disable a builtin suffix rule. Index: Makefile.am =============================================================== ==== RCS file: /cvs/src/src/gprof/Makefile.am,v retrieving revision 1.26 diff -u -p -r1.26 Makefile.am --- Makefile.am 6 Apr 2006 21:49:33 -0000 1.26 +++ Makefile.am 20 Apr 2006 06:23:23 -0000 @@ -39,6 +39,9 @@ EXTRA_DIST = $(BUILT_SOURCES) bbconv. diststuff: $(BUILT_SOURCES) info $(man_MANS) +# this empry rule is a hack against gmake patched by Apple. +%.o:%.m + .m.c: awk -f $(srcdir)/gen-c-prog.awk > ./$*.c ? FUNCTION=`(echo $*|sed -e 's,.*/,,g' -e 's/_bl//')`_blurb ?
Subject: Re: New: Failed to build gprof under gmake patched by Apple. Hi Masaki, > Building gprof was failed because of patched gmake (bundled with OSX). > Follow is a patch to disable a builtin suffix rule. > diststuff: $(BUILT_SOURCES) info $(man_MANS) > > +# this empry rule is a hack against gmake patched by Apple. > +%.o:%.m > + > .m.c: > awk -f $(srcdir)/gen-c-prog.awk > ./$*.c ? > FUNCTION=`(echo $*|sed -e 's,.*/,,g' -e 's/_bl//')`_blurb ? I have applied this patch, although obviously we hope that Apple will fix their version of gmake as well. Cheers Nick
Patch applied
I don't know how the Apple specific variant of `gmake` was at the time this bug was resolved, but the relevant build rules are now part of mainline gmake http://git.savannah.gnu.org/cgit/make.git/commit/default.c?id=eda0e24ccdae279a2c12059242ef89a22c274047 but it was added as an old-style suffix rule, so this patch now does nothing (since it is not a builtin pattern rule). The two options to resolve it appear to be either disabling all builtin rules (can be done with `.MAKEFLAGS: -r`) or else change the suffix order so that '.c' comes before '.m'. The suffix order was correct before 6bf9431b7430d0c30268c62f78a940657c8d6fbe rebuilt the `makefile.in` file (maybe this was a change in the behaviour of automake?).
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=415ed2a17588f855397cc2d03aa68a79e84f77f7 commit 415ed2a17588f855397cc2d03aa68a79e84f77f7 Author: Nick Clifton <nickc@redhat.com> Date: Wed Nov 13 11:21:39 2019 +0000 Fix the rule for building C files in the gprof makefile. PR 2587 * Makefile.am: Fix rule to build .c files from .m files.
(In reply to parakleta from comment #3) > The two options to resolve it appear to be either disabling all builtin > rules (can be done with `.MAKEFLAGS: -r`) or else change the suffix order so > that '.c' comes before '.m'. Thanks for the suggestion. I have gone ahead with the second option as this makes more sense to me. Cheers Nick
Sorry, by suffix rule order this means the order of suffixes in the `.SUFFIXES:` target which is autogenerated by the `SUFFIXES` variable in the "makefile.am" file. Your change will attempt to build '.c' files from '.m' files. I'm not familiar with automake but I believe you should change the relevant line to `SUFFIXES = .c .m` and then need to rebuild the "makefile.in" file using automake.
I've just realised that changing the order of rules may not work. We want to have '.m -> .c -> .o' as the sequence without triggering '.m -> .o', and by setting '.c' before '.m' we're saying if '.c -> .o' is possible then use that, but I suspect if the '.c' file is missing or out of date the it will try the '.m -> .o' rule before trying to build the intermediate. I think this means that either the '.c' files need to be listed as explicit dependencies of the '.o' files in the case that a '.m' file exists (so bypassing the pattern and forcing the explicit sequence '.m -> .c => .o') or else disabling the rules as per my first suggestion.
(In reply to parakleta from comment #7) > I've just realised that changing the order of rules may not work. Ignore this. There is an explicit dependency on the "BUILT_SOURCES" existing which forces the '.m -> .c' step to occur before other dependency checking is performed so long as the 'all' target is used, so this is good enough. I think just changing the 'SUFFIXES = .m' to 'SUFFIXES = .c .m' and rebuilding the "makefile.in" should do it.
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=63442f6a2eff9f4c5c67099565f59c0f135aff94 commit 63442f6a2eff9f4c5c67099565f59c0f135aff94 Author: Nick Clifton <nickc@redhat.com> Date: Thu Nov 14 12:11:43 2019 +0000 Another attempt at fixing building gprof with gmake. PR 2587 * Makefile.am (SUFFIXES): Add .c. * Makefile.in: Regenerate.
(In reply to parakleta from comment #8) > I think just changing the 'SUFFIXES = .m' to 'SUFFIXES = .c .m' and > rebuilding the "makefile.in" should do it. OK, done. Plus this time I actually rebuilt Makefile.in, which I forgot last time. Doh. I have also REOPENED this PR, so that it will remain active until you can confirm that the changes are working. Cheers Nick
(In reply to cvs-commit@gcc.gnu.org from comment #4) > The master branch has been updated by Nick Clifton <nickc@sourceware.org>: > > https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git; > h=415ed2a17588f855397cc2d03aa68a79e84f77f7 > > commit 415ed2a17588f855397cc2d03aa68a79e84f77f7 > Author: Nick Clifton <nickc@redhat.com> > Date: Wed Nov 13 11:21:39 2019 +0000 > > Fix the rule for building C files in the gprof makefile. > > PR 2587 > * Makefile.am: Fix rule to build .c files from .m files. You still need to revert this change.
(In reply to Nick Clifton from comment #10) > (In reply to parakleta from comment #8) > > I think just changing the 'SUFFIXES = .m' to 'SUFFIXES = .c .m' and > > rebuilding the "makefile.in" should do it. > > OK, done. Plus this time I actually rebuilt Makefile.in, which I forgot > last time. Doh. > > I have also REOPENED this PR, so that it will remain active until you > can confirm that the changes are working. > > Cheers > Nick My autotester for mmix-knuth-mmixware cris-axis-linux-gnu cris-axis-elf running on Debian 9 x86_64 (GNU make 4.1) screams at 63442f6: ... Setting warning flags = -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Werror configure: updating cache ./config.cache checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating po/Makefile.in config.status: creating gconfig.h config.status: executing depfiles commands config.status: executing libtool commands config.status: executing default-1 commands config.status: creating po/POTFILES config.status: creating po/Makefile make[2]: *** No rule to make target 'flat_bl.c', needed by 'all'. Stop. make[2]: Entering directory '/tmp/hpautotest-binutils/cris-axis-elf/gprof' make[2]: Leaving directory '/tmp/hpautotest-binutils/cris-axis-elf/gprof' make[1]: *** [all-gprof] Error 2 Makefile:6185: recipe for target 'all-gprof' failed make[1]: Leaving directory '/tmp/hpautotest-binutils/cris-axis-elf' make: *** [all] Error 2 Makefile:850: recipe for target 'all' failed
i see failures on aarch64* too. make[1]: Entering directory `/B/gprof' make[1]: *** No rule to make target `flat_bl.c', needed by `all'. Stop. make[1]: Leaving directory `/B/gprof' make: *** [all-gprof] Error 2
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=71d3dc74309599cd9bbdfa17dcfdfd8c406a1093 commit 71d3dc74309599cd9bbdfa17dcfdfd8c406a1093 Author: Nick Clifton <nickc@redhat.com> Date: Fri Nov 15 11:52:50 2019 +0000 Revert previous delta. PR 2587 * Makefile.am: Revert change from 2019-11-13. * Makefile.in: Regenerate.
Presumably fixed.