[Bug preprocessor/28810] gcc -MD -MP doesn't add phony rule for source file

vz-gcc at zeitlins dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 4 15:17:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28810

Vadim Zeitlin <vz-gcc at zeitlins dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vz-gcc at zeitlins dot org

--- Comment #4 from Vadim Zeitlin <vz-gcc at zeitlins dot org> ---
I don't understand the rationale of comment:1. When a source file is renamed
(and not removed), it makes perfect sense to still have the object file in a
makefile.

E.g. I'm using a build system which generates GNUmakefiles with rules of the
form

libname_file.o: subdir/file.cpp
        $(CXX) -MD -MP ... -o $@ $<

and if file.cpp is moved to subdir2/file.cpp, the build gets broken because the
existing libname_file.d has a dependency on subdir/file.cpp but no dummy rule
for this file.

It's obviously not going to solve my problem now, but I think it would be great
to remove the existing exception from -MP or, perhaps, add some new -MPP
switch.


More information about the Gcc-bugs mailing list