[MPlayer-dev-eng] gcc -MM bug?

Diego Biurrun diego at biurrun.de
Mon May 15 00:03:35 CEST 2006


On Sun, May 14, 2006 at 11:23:31PM +0200, Arpi wrote:
> 
> The problem: when running gcc's make-depend feature (gcc -M or -MM)
> on a file in a subdirectory, it produces wrong output, as it
> cuts out the path. example:
> 
> # gcc -MM game-egypt/math.c
> math.o: game-egypt/math.c game-egypt/paylines.h
> #
> 
> it should produce  game-egypt/math.o: game-egypt/math.c...
> 
> according to gcc manual:
> 
> By default CPP takes the name of the main input file, including any
> path, deletes any file suffix such as .c, and appends the plat-
> form's usual object suffix.  The result is the target.
> 
> tested with gcc 3.3 and 4.0, on OSX.

Hmmmm.  From my gcc manual page:

 -M  Instead of outputting the result of preprocessing, output a rule
     suitable for make describing the dependencies of the main source
     file.  The preprocessor outputs one make rule containing the object
     file name for that source file, a colon, and the names of all the
     included files, including those coming from -include or -imacros
     command line options.

     Unless specified explicitly (with -MT or -MQ), the object file name
     consists of the basename of the source file with any suffix
     replaced with object file suffix.  If there are many included files
     then the rule is split into several lines using \-newline.  The
     rule has no commands.

So it claims to only use the basename, as you observed.

cerebus:~$ gcc --version
gcc (GCC) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
cerebus:~$ gcc-3.4 --version
gcc-3.4 (GCC) 3.4.6 (Debian 3.4.6-1)
cerebus:~$ gcc-3.3 --version
gcc-3.3 (GCC) 3.3.6 (Debian 1:3.3.6-13)

All of their man pages contain the same text.

Maybe this is a difference between Apple and FSF gcc?

Diego




More information about the MPlayer-dev-eng mailing list