gcc -M -MM -MQ -MF -MT -MD
静态模式规则对一个较大工程的管理非常有用。它可以对整个工程的同一类文件的重建规则进行一次定义,而实现对整个工程中此类文件指定相同的重建规则。比如,可
以用来描述整个工程中所有的.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的更多相关文章
- /MT /MD /ML /MTd /MDd /MLd 的区别
Multithreaded Libraries Performance The single-threaded CRT is no longer ( in vs2005 ) available. Th ...
- Linux Makefile 生成 *.d 依赖文件及 gcc -M -MF -MP 等相关选项说明【转】
转自:https://blog.csdn.net/qq1452008/article/details/50855810 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog. ...
- Linux Makefile 生成 *.d 依赖文件及 gcc -M -MF -MP 等相关选项说明
1. 为什么要使用后缀名为 .d 的依赖文件? 在 Makefile 中, 我们的依赖关系可能需要包含一系列的头文件.比如main.c 源文件内容如下: #include "stdio.h& ...
- GCC使用
GCC的选项 如何指定GCC的默认头 文件路径 Linux系统的头文件 和库文件搜索路径 头文件 库文件 运行时动态库的搜索路径 GCC的选项 -c 只生成目标文件(.o),不连接. % gcc -c ...
- 如何指定GCC的默认头文件路径
如何指定GCC的默认头文件路径 网上偶搜得之,以之为宝:)原地址:http://blog.chinaunix.net/u/28781/showart.php?id=401631============ ...
- GCC 环境变量 & eclipse CDT 头文件配置
转:http://blog.csdn.net/statdm/article/details/7751000 GCC 环境变量 & eclipse CDT 头文件配置 在unix 下使用e ...
- 使用-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 ...
- Machine Learning : Pre-processing features
from:http://analyticsbot.ml/2016/10/machine-learning-pre-processing-features/ Machine Learning : Pre ...
- 一个通用的Makefile (转)
据http://bbs.chinaunix.net/thread-2300778-1-1.html的讨论,发现还是有很多人在问通用Makefile的问题,这里做一个总结.也作为以后的参考. ...
随机推荐
- [CF983E]NN country
题意:给一棵树,有许多条巴士线路$(a_i,b_i)$(巴士在路径上每个点都会停车),多次询问从一点到另一点最少要坐多少次巴士 首先dfs一遍预处理出一个点向上坐$2^k$次巴士能到的最浅点,于是我们 ...
- POI 设置Excel样式(转)
POI 设置Excel样式 POI中可能会用到一些需要设置EXCEL单元格格式的操作小结: 先获取工作薄对象: HSSFWorkbook wb = new HSSFWorkbook(); HSSFSh ...
- [Markdown]纯文本标记语言MarkdowPad2--MD语法知识
##1.标题 代码 注:# 后面保持空格 # h1 ## h2 ### h3 #### h4 ##### h5 ###### h6 ####### h7 // 错误代码 ######## h8 // ...
- 权限管理-RBAC
(一)RBAC 通过用户与角色关联,角色与操作的关联实现用户与操作的关联 (二)权限细分 (三)数据库设计 (四)程序设计 (五)权限与应用程序 (1)应用URL实现程序权限控制 (2)应用code实 ...
- apk打包
1.在导航栏中选择Builder->Generate Signed Apk 2.新建点击Creat new... 3.注意路径后面写apk的名字(这个名字将会显示在手机软件的下方)
- 获取OS X中App Store更新后的安装包(如XCode)
如果宿舍有好几个人需要更新一些大的软件,如XCode,会占用很大的带宽. 为了节省带宽,我们可以在1台电脑上更新完后,获取存放在系统暂存区的更新的安装包,然后通过局域网或Airdrop的方式轻松分 ...
- oracle 百万行数据优化查询
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使 ...
- Drupal 7.31 SQL Injection Exp
#-*- coding:utf-8 -*- import urllib2,sys import hashlib # Calculate a non-truncated Drupal 7 compa ...
- 单元测试 2 & 初识模块3
单元测试 - 创建测试用例 单元测试是什么? (老鸟可以无视下面这段话.) hi,新同学们,咱们的PHP代码里满布着好多函数和类,经常互相调用,你改的一个函数/方法可能是"比较底层" ...
- 安装Scala 找不到或无法加载主类 scala.tools.nsc.MainGenericRunner 错误
对于安装Scala时 找不到或无法加载主类 scala.tools.nsc.MainGenericRunner 错误,不管是linux还是window系统,原因很大可能是scala的安装路径中出现空格 ...