This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor/6521: -MG creates dependency with wrong path
Zack Weinberg wrote:-
> I'm not entirely sure I understand this.
>
> I've never really liked -MG; it is too inflexible. With <> it does
> something fairly silly, as Robert points out; but with "" it does
> something equally silly, which is to assume that splatting whatever
> string the user provided into the dependency list will work. (It does
> _not_ assume they live in the same directory as the source file;
> consider split source and build trees. The current behavior is
> more likely to work in practice than the documented one, but...
Good point, I'd not thought of that. I tend to think, though, that
-MG should never really be being used with <>, so whatever we do
isn't that important. That makes me like Robert's patch as it
deletes code, and does what is documented after all.
> The behavior under discussion predates cpplib, incidentally.
>
> It seems to me that we should leave -MG alone, since there are
> undoubtedly Makefiles out there depending on every last quirk of its
> semantics (remember all the fallout the last time we decided to
> improve the semantics of the -M switches?). We should instead come up
> with a new way to do it that lets the user say where the generated
> file is expected to turn up... perhaps -Mx <path> puts all the
> dependencies on generated files in <path>. (Where 'x' is some
> appropriate letter; I am too tired to think of a good one right now.)
Hmm, I guess. We have too many options, really. It's a shame -MG
can't die. Fancy doing it with your "closing same file twice" patch?
8-)
> Come to think of it, -MG and -MP clash. We should mark entries added
> to the list by -MG and not generate phony targets for them under -MP,
> or Make will pitch a fit about multiple rules for the same target.
You mean because the missing file presumably has a make rule specifying
how to generate it elsewhere?
Neil.