Bug 35061

Summary: makedepend cannot handle include files a/foo.h and b/foo.h
Product: xorg Reporter: Jörgen Grahn <grahn+x11>
Component: Build/MonolithicAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED INVALID QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: lowest    
Version: 7.4 (2008.09)   
Hardware: All   
OS: Linux (All)   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:

Description Jörgen Grahn 2011-03-06 07:37:01 UTC
I reported this as http://bugs.debian.org/584281 back in June,
but only recently got the advice to report it upstream instead.
I'll just quote my original description:

If you let makedepend generate dependencies for multiple .c files in
different directories, and two of them do

  #include "foo.h"

and expect that to mean the foo.h which is in the same directory as
the source file, makedepend will pick one of the foo.h files (and
whatever it includes) and apply as dependencies to both .c files.

To see the problem, do:

mkdir a b
echo '#include "foo.h"' > a/foo.c
echo '#include "foo.h"' > b/foo.c
echo '#include <stdlib.h>' > a/foo.h
echo '#include <stdlib.h>' > b/foo.h
makedepend -f - ?/foo.c

You will see among other things these two dependencies:
a/foo.o: a/foo.h
b/foo.o: a/foo.h # incorrect; should be b/foo.h

This bug seems to exist in all makedepends I have tried. I suppose it
comes from the optimizations mentioned in the manual page. I really
don't like it, because it will silently generate Makefiles with bogus
dependency graphs in them for what (to me at least) looks like pretty
normal source code. Such Makefiles are dangerous -- especially when
you trust them, because you let the standard tool makedepend generate
them.

If it cannot be fixed, this bug should be mentioned in the makedepend(1)
man page.
Comment 1 Adam Jackson 2018-06-12 19:09:13 UTC
Mass closure: This bug has been untouched for more than six years, and is not
obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current releases.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.