Passing m to the driver implies e and suppresses

Info icon This preview shows pages 63–65. Sign up to view the full content.

View Full Document Right Arrow Icon
Passing ‘ -M ’ to the driver implies ‘ -E ’, and suppresses warnings with an implicit -w ’. -MM Like ‘ -M ’ but do not mention header files that are found in system header directories, nor header files that are included, directly or indirectly, from such a header. This implies that the choice of angle brackets or double quotes in an ‘ #include directive does not in itself determine whether that header will appear in ‘ -MM dependency output. This is a slight change in semantics from GCC versions 3.0 and earlier. -MF file When used with ‘ -M ’ or ‘ -MM ’, specifies a file to write the dependencies to. If no ‘ -MF ’ switch is given the preprocessor sends the rules to the same place it would have sent preprocessed output. When used with the driver options ‘ -MD ’ or ‘ -MMD ’, ‘ -MF ’ overrides the default dependency output file. -MG In conjunction with an option such as ‘ -M ’ requesting dependency generation, -MG ’ assumes missing header files are generated files and adds them to the dependency list without raising an error. The dependency filename is taken directly from the #include directive without prepending any path. ‘ -MG ’ also suppresses preprocessed output, as a missing header file renders this useless. This feature is used in automatic updating of makefiles. -MP This option instructs CPP to add a phony target for each dependency other than the main file, causing each to depend on nothing. These dummy rules work around errors make gives if you remove header files without updating the Makefile ’ to match. This is typical output: test.o: test.c test.h test.h: -MT target Change the target of the rule emitted by dependency generation. By default CPP takes the name of the main input file, deletes any directory components and any file suffix such as ‘ .c ’, and appends the platform’s usual object suffix. The result is the target.
Image of page 63

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 12: Invocation 60 An ‘ -MT ’ option will set the target to be exactly the string you specify. If you want multiple targets, you can specify them as a single argument to ‘ -MT ’, or use multiple ‘ -MT ’ options. For example, ‘ -MT ’$(objpfx)foo.o’ ’ might give $(objpfx)foo.o: foo.c -MQ target Same as ‘ -MT ’, but it quotes any characters which are special to Make. -MQ ’$(objpfx)foo.o’ ’ gives $$(objpfx)foo.o: foo.c The default target is automatically quoted, as if it were given with ‘ -MQ ’. -MD -MD ’ is equivalent to ‘ -M -MF file ’, except that ‘ -E ’ is not implied. The driver determines file based on whether an ‘ -o ’ option is given. If it is, the driver uses its argument but with a suffix of ‘ .d ’, otherwise it takes the name of the input file, removes any directory components and suffix, and applies a ‘ .d ’ suffix.
Image of page 64
Image of page 65
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern