This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/28810] New: gcc -MD -MP doesn't add phony rule for source file
- From: "carlton at bactrian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Aug 2006 20:21:20 -0000
- Subject: [Bug preprocessor/28810] New: gcc -MD -MP doesn't add phony rule for source file
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When I generate depends using gcc -MD -MP, it generates a dependency
for the object file on the source file and all the headers. It also
generates an empty dependency for each header (to handle the case where
the header has gone away - that's the point of -MP).
It doesn't, however, do that for the main source file. This behavior,
admittedly, is documentented in the manual; the manual doesn't give a reason
for this choice.
And it's causing problems for me: if I move the main source file (without
moving the corresponding object file, an admittedly rare occurrence), then
make refuses to rebuild my object file, because the dependency generated
by GCC on the old source file still exists.
If there's a reason for GCC's current behavior, then I can live with it -
I don't move a source file (without also moving the corresponding
object file!) nearly as often as I move headers. But if there's
no particular reason, then I think the current behavior is suboptimal.
I've seen this over a range of GCC releases, including 3.2.3 and 4.1.1.
--
Summary: gcc -MD -MP doesn't add phony rule for source file
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: carlton at bactrian dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28810