http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45809

           Summary: Canonicalize file names output during dependency
                    generation
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: preprocessor
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: konrad.schw...@siemens.com


I have a make file responsible for files in several directories (say
main_dir, other_dir).

The files in these directories include header files using relative paths:

----other_dir/source.c
# include "../main_dir/header.h"
----

GCC, invoked with -MMD, produces dependency files of the form

----other_dir/source.d
../other_dir/source.o:\
    ../other_dir/../main_dir/header.h
----

These dependency files are included via

----Makefile
-include ../other_dir/*.d
----

If header.h is generated using a rule of the form

----Makefile
header.h: header.m4
        m4 header.m4 > header.h
----

(GNU) make fails to realize that a change to header.m4 requires a rebuild
of ../other_dir/source.o, since make uses string compares to identify targets
with prerequisites.

Pseudo-targets in Make require this sort of comparison.

Were GCC to canonicalize the file names in the dependency files it generates:

----other_dir/source.d
../other_dir/source.o:\
     header.h
----

this problem would be solved.

Reply via email to