This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: [CPP PATCH] name of dependency target file


On Thu, Jan 04, 2001 at 09:23:05AM +0000, Nathan Sidwell wrote:
> Hi,
> 
> this patch fixes a long standing niggle of mine about the -M, -MD etc
> options. The documentation specifies that they generate the name of the
> make dependancy filename by effectively 'sed s/.o$/.d$/' on the object
> file. Unfortunately the implementation does '`basename $src` | sed
> s/.c$/.d$', and uses the default object file name for the target.
> This differs when -o is used to place the output file into a different
> directory, like 'gcc -c -o subdir/foo.o subdir/foo.c' for instance. 
> In that case you get a foo.d file naming foo.o as the target, rather
> than a subdir/foo.d file naming subdir/foo.o as one might expect.

Yes, this has been reported several times.  It was done deliberately
but I do not know why, and I agree that subdir/foo.d is preferable.

> This patch adds a cpp -Mo option to allow explicitly setting the
> target name. Adds a %.SUFFIX spec escape which allows substituting SUFFIX
> into a matched switch's args when subsequently output with %*. SUFFIX
> cannot contain space or %. Finally the cpp_options are amended to supply
> -Mo to cpp as appropriate.

I would rather you fixed the bug inside cpplib, by removing the call
to base_name from mkdeps.c:deps_calc_target.  Then #ifdef out
base_name, since it is used only from deps_calc_target.  I don't want
to remove it just yet in case it turns out that there's some critical
reason why we have to put the .d file in the current directory.

The option to explicitly set the target name is independently
desirable, but we've been calling it -MT which I think is better
mnemonically.  See http://gcc.gnu.org/ml/gcc/1999-09n/msg00742.html -
I have wanted to implement this, verbatim, since it was proposed, but
my tuit supply never seems to suffice.  Patches Welcome.

zw

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