MD and MMD don't do what I mean

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

MD and MMD don't do what I mean

Post by skoe »

xcc's (10.4) command line switches -MD and -MMD work differently from e.g. gcc when being used together with -o. They don't include the path of the target in the rules they create. To see what I mean have a look at this example:

Code: Select all

$ find .
./obj
./src/bar.c
./include/foo.h
./Makefile

$ cat Makefile

.PHONY: all
all:
        xcc -MMD -c -target=XS1-L1A-LQ64 -I include -o obj/bar.o     src/bar.c
        gcc -MMD -c                      -I include -o obj/bar-gcc.o src/bar.c

(after make:)

$ cat obj/bar.d
bar.o: src/bar.c include/foo.h

$ cat obj/bar-gcc.d
obj/bar-gcc.o: src/bar.c include/foo.h
Is this really intended or is it a bug? I think the current behaviour is not really useful in this case.


User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

Since it is supposed to work like GCC (as far as I can see), this is a bug yeah.

You can work around it with -MF, if that exists/works in xcc.
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

MMD is intended to work like the gcc option to make it easy to use xcc with existing makefiles / build frameworks. Clearly in this case the behaviour doesn't match and this should be fixed. For now you can work around this issue by changing your command to:

Code: Select all

xcc -MMD -c -target=XS1-L1A-LQ64 -I include -o obj/bar.o src/bar.c -Xpreprocessor -MQ -Xpreprocessor obj/bar.o
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm

Post by skoe »

Thank you, this workaround is quite helpful. (Saves me some time for "make clean")