#1486 sdcc -MM no working correctly


I use something like the following to generate dependency files when building
sdcc -MM foo.c

but I have found that -MM is not excluding system headers, and works the like -M.

$ ~/sdcc/bin/sdcc -MM foo.c
foo.rel: foo.c /home/steven/sdcc/bin/../share/sdcc/include/stdio.h \ /home/steven/sdcc/bin/../share/sdcc/include/stdarg.h \ /home/steven/sdcc/bin/../share/sdcc/include/sdcc-lib.h \ /home/steven/sdcc/bin/../share/sdcc/include/asm/mcs51/features.h foo.h

This could be a problem with how sdcc passes options intended for the preprocessor to sdcpp as I've found that the following works...
sdcpp -MM foo.c

$ ~/sdcc/bin/sdcpp -MM foo.c
foo.rel: foo.c foo.h

This provides a workround in many cases, but the expectation is that sdcc should pass -MM to the preprocessor (like gcc does). Hence I'm calling this as a bug rather than a feature request.

All the above with snapshot #5253 on Linux.


  • Steven Borley

    Steven Borley - 2008-11-05

    example source code

  • Steven Borley

    Steven Borley - 2008-11-05

    Just after posing I noticed another symptom while trying to implement a workround.

    It seems that passing an include path to the system files to sdcpp we get the same problem

    sdcpp -DC8051F305 -I/home/steven/sdcc/share/sdcc/include -MM foo.c
    foo.rel: foo.c /home/steven/sdcc/share/sdcc/include/stdio.h \ /home/steven/sdcc/share/sdcc/include/stdarg.h \ /home/steven/sdcc/share/sdcc/include/sdcc-lib.h \ /home/steven/sdcc/share/sdcc/include/asm/default/features.h foo.h

    I'm now in the belief that this is a sdcpp bug (rather than how sdcc passes options to sdcpp).

    According to the manual:
    "-MM Like ‘-M’ but the output mentions only the user header files included with ‘#include “file"’. System
    header files included with ‘#include <file>’ are omitted."

    Thus my #include <stdio.h> in foo.c should be ignore regardless of whether it's found on the include path or not.

  • Borut Ražem

    Borut Ražem - 2008-11-06
    • milestone: --> fixed
    • assigned_to: nobody --> borutr
    • status: open --> closed-fixed
  • Borut Ražem

    Borut Ražem - 2008-11-06

    Fixed in svn revision #5257.



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks