dependencies for sources in sub dirs.

Tobias Grimm listaccount@e-tobi.net
Thu Nov 10 00:17:00 GMT 2005


Hello!

Using gcc 4.0.2, I have the following problem:

Calling "gcc -MM src/foo.c" results in:

foo.o: src/foo.c src/bar.h

But IMHO that's wrong. The manpage says:

       -MT target
           Change the target of the rule emitted by dependency
generation.  By
           default CPP takes the name of the main input file, including any
           path, deletes any file suffix such as .c, and appends the plat-
           form's usual object suffix.  The result is the target.

"By default CPP takes the name of the main input file, including any
path" !!!

So I would assume to get this:

src/foo.o: src/foo.c src/bar.h

But I don't and so the generated dependencies are useless.

Is this a bug in gcc or the manpage, or am I doing something wrong? How
can I force gcc to include the path in the target? -MT is not an option,
because I have several different subdirectories.

Hope someone knows an answer....

Regards,

Tobias



More information about the Gcc-help mailing list