静态模式规则对一个较大工程的管理非常有用。它可以对整个工程的同一类文件的重建规则进行一次定义,而实现对整个工程中此类文件指定相同的重建规则。比如,可
以用来描述整个工程中所有的.o 文件的依赖规则和编译命令。通常的做法是将生成同一类目标的模式定义在一个 make.rules 的文件中。在工程各个模块的 Makefile 中包含
此文件。

gcc

-M: 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 name of the source file with any suffix replaced
with object file suffix and with any leading directory parts removed. If there are many included files then the rule is split into
several lines using \-newline. The rule has no commands.

-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.

-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.

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.

If -MD is used in conjunction with -E, any -o switch is understood to specify the dependency output file, but if used without -E, each
-o is understood to specify a target object file.

Since -E is not implied, -MD can be used to generate a dependency output file as a side-effect of the compilation process.

gcc -M -MM -MQ -MF -MT -MD的更多相关文章

  1. /MT /MD /ML /MTd /MDd /MLd 的区别

    Multithreaded Libraries Performance The single-threaded CRT is no longer ( in vs2005 ) available. Th ...

  2. Linux Makefile 生成 *.d 依赖文件及 gcc -M -MF -MP 等相关选项说明【转】

    转自:https://blog.csdn.net/qq1452008/article/details/50855810 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog. ...

  3. Linux Makefile 生成 *.d 依赖文件及 gcc -M -MF -MP 等相关选项说明

    1. 为什么要使用后缀名为 .d 的依赖文件? 在 Makefile 中, 我们的依赖关系可能需要包含一系列的头文件.比如main.c 源文件内容如下: #include "stdio.h& ...

  4. GCC使用

    GCC的选项 如何指定GCC的默认头 文件路径 Linux系统的头文件 和库文件搜索路径 头文件 库文件 运行时动态库的搜索路径 GCC的选项 -c 只生成目标文件(.o),不连接. % gcc -c ...

  5. 如何指定GCC的默认头文件路径

    如何指定GCC的默认头文件路径 网上偶搜得之,以之为宝:)原地址:http://blog.chinaunix.net/u/28781/showart.php?id=401631============ ...

  6. GCC 环境变量 & eclipse CDT 头文件配置

     转:http://blog.csdn.net/statdm/article/details/7751000 GCC 环境变量 & eclipse CDT 头文件配置   在unix 下使用e ...

  7. 使用-MM生成include指令和依赖生成(make include directive and dependency generation with -MM)

    I want a build rule to be triggered by an include directive if the target of the include is out of d ...

  8. Machine Learning : Pre-processing features

    from:http://analyticsbot.ml/2016/10/machine-learning-pre-processing-features/ Machine Learning : Pre ...

  9. 一个通用的Makefile (转)

    据http://bbs.chinaunix.net/thread-2300778-1-1.html的讨论,发现还是有很多人在问通用Makefile的问题,这里做一个总结.也作为以后的参考.       ...

随机推荐

  1. [BZOJ4316]小C的独立集(圆方树DP)

    题意:求仙人掌图直径. 算法:建出仙人掌圆方树,对于圆点直接做普通的树上DP(忽略方点儿子),方点做环上DP并将值直接赋给父亲. 建图时有一个很好的性质,就是一个方点在邻接表里的点的顺序正好就是从环的 ...

  2. [BZOJ 1794] Linear Garden

    Link: BZOJ 1794 传送门 Solution: IOI2008官方题解:传送门 要求序号,其实就是算字典序比其小的序列个数 从而使用数位$dp$的思想来解题,关键在于维护序列要$balan ...

  3. [Codeforces 26E] MultiThreading

    Brief Intro: 给你n个数,每个数有2*CNT[i]个,让你构造一个序列 使得最终的Y值为W(其余见题面) Solution: 就是一道纯构造的题目: 先把特殊情况特殊处理,接下来考虑一般情 ...

  4. [Codeforces 19E] Fiary

    Brief Intro: 给定一个无向图,询问删去哪条边能使得剩下的图为一个二分图,输出所有结果 Algorithm: 关于二分图的重要性质:一个图为二分图的充要条件为其中没有奇环 1.如果没有奇环, ...

  5. 将Java程序打jar包并运行

    1)接着上篇博客继续说手动编译之后,将代码打成jar包,然后直接“java -jar lz.jar"运行不成功的问题.还是先上代码: 这个是Demo类: package org.lz.dem ...

  6. iOS 多线程之NSOperation篇举例详解

    这篇博客是接着总篇iOS GCD NSOperation NSThread等多线程各种举例详解写的一个支篇.总篇也包含了此文的链接.本文讲解的知识点有NSBlockOperationClick,队列, ...

  7. Android Studio 中修改versionCode跟versionName

    在Android Studio 中修改versionCode 跟versionName最写了一个新版的软件准备发布到应用平台上,但是versionCode和versionName的值一直修改不成功,在 ...

  8. 修改 CentOS 6.3 时区 和 时间

    1.查看当前时区和时间 date -R 2.CentOS中时区是以文件形式存在,当前时区文件位于 /etc/localtime 其他时区文件位于 /usr/share/zoneinfo下,其中中国时区 ...

  9. 电脑(台式机||笔记本)开机password忘记通用解决方法

    方法:直接制作一个老毛桃装机版u盘启动盘 网址:老毛桃官网 步骤:依照网址的解说,将制作好的U盘插入到电脑的usb插口.执行Windows 登入password破解菜单,搜索password所在的盘符 ...

  10. python - ImportError: No module named pywintypes

    must restart the python shell to avoid this issue after pywin32 installed