Hi, It's a bit offtopic, but as mplayer also include(d) .depend support, it isn't not so much... 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. i've checked mplayer source, and it also includes some files from subdirs, the ones in SRCS_MENCODER, for example libvo/aclib.c. g5:~/mplayer arpi$ grep aclib .depend aclib.o: libvo/aclib.c config.h cpudetect.h libvo/fastmemcpy.h so it's also incorrectly created .depend, make will not recompile aclib.o if any of its dependencies change! any ideas? is it a known gcc bug, a feature or what? workarounds? A'rpi
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
Hi,
Hmmmm. From my gcc manual page:
es, it's written a few lines bellow
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?
try this: gcc -MM libvo/aclib.c what's the output? A'rpi
On Mon, May 15, 2006 at 12:14:09AM +0200, Arpi wrote:
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?
try this:
gcc -MM libvo/aclib.c
what's the output?
cerebus:~/src/mplayer/main$ gcc -I/home/diego/src/mplayer/main -MM libvo/aclib.c aclib.o: libvo/aclib.c /home/diego/src/mplayer/main/config.h \ /home/diego/src/mplayer/main/cpudetect.h libvo/fastmemcpy.h Diego
On Sunday 14 May 2006 23:23, Arpi wrote:
any ideas? is it a known gcc bug, a feature or what? workarounds?
I recently noticed the same odd behaviour of gcc -MM so I decided to switch to makedepend (from X11). makedepend -f- -- -Y $(CFLAGS) -- libvo/aclib.c 2>/dev/null works as expected. Except for one _very_ annoying bug in makedepend. If it searches for "somefile.h" that has to be included, it does not look in the directory where the sourcefile resides first, but instead it looks in the directory from which makedepend was called. For most things, that works fine, but it is not what a decent cpp would do and its output is plain wrong when both the rootdir and the subdir contain a header-file with the same name. For example, libaf/af_sweep.c : libaf/af_sweep.o: config.h libaf/af.h libaf/af_mp.h mp_msg.h cpudetect.h libaf/af_sweep.o: libaf/control.h libaf/af_format.h af_sweep.c includes both "config.h" (which is libaf/config.h) and "../config.h" (which is config.h) but makedepend fails to see the difference. --Ivo
participants (3)
-
Arpi -
Diego Biurrun -
Ivo