Suppose, you have the following C-File (input.c), empty.h is just an empty file:
#include "empty.h" void dummy(void) { } Issue the command: gcc -c input.c -MD -MT foo.o -o input.o The content of input.d is: foo.o input.o: input.c empty.h but I would expect: foo.o: input.c empty.h which also is the output of "gcc -c input.c -MD -MT foo.o" The documentation says: -MD: [...] if used without `-E', each `-o' is understood to specify a target object file. OK, but: -MT: [...] An `-MT' option will set the target to be exactly the string you specify. I would prefer that -MT always overwrites the targets (as it does with -M and -MM). I tested also with gcc 3.4.4 and 3.4.6 and the behaviour is the same as with 4.1.1 -- Summary: -MT doesn't overwrite the default target when used with -M(M)D and -o Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: c dot matuszewski at gmx dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31851