[skill][makefile] makefile 常用内容记录
其实,makefile有点复杂。
文档看了又看,还是要经常翻,做个记录备忘 :)
与 implicit rule 相对应的有 pattern rules 和 suffix rules
Compiling C programs
n.o is made automatically from n.c with a recipe of the form ‘$(CC) $(CPPFLAGS) $(CFLAGS) -c’. Compiling C++ programs
n.o is made automatically from n.cc, n.cpp, or n.C with a recipe of the form ‘$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c’.
We encourage you to use the suffix ‘.cc’ for C++ source files instead of ‘.C’.
Linking a single object file
n is made automatically from n.o by running the linker (usually called ld) via the C compiler. The precise recipe
used is ‘$(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS)’. This rule does the right thing for a simple program with only one source file. It will also do the right thing
if there are multiple object files (presumably coming from various other source files), one of which has a name
matching that of the executable file. Thus, x: y.o z.o
when x.c, y.c and z.c all exist will execute: cc -c x.c -o x.o
cc -c y.c -o y.o
cc -c z.c -o z.o
cc x.o y.o z.o -o x
rm -f x.o
rm -f y.o
rm -f z.o
In more complicated cases, such as when there is no object file whose name derives from the executable file name,
you must write an explicit recipe for linking.
CFLAGS
Extra flags to give to the C compiler. CXXFLAGS
Extra flags to give to the C++ compiler. CPPFLAGS
Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers). LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker, ‘ld’, such as -L.
Libraries (-lfoo) should be added to the LDLIBS variable instead. LDLIBS
Library flags or names given to compilers when they are supposed to invoke the linker, ‘ld’.
LOADLIBES is a deprecated (but still supported) alternative to LDLIBS. Non-library linker flags,
such as -L, should go in the LDFLAGS variable.
定义一个空的 recipe 就可以取消隐含命令:
%.o : %.s
生成 *.o 的隐式命令,就被取消了。
2. 更新所有目标文件
以前是这样的: 先 make clean 然后 make。现在我们这样 make -B
‘-B’
‘--always-make’
Consider all targets out-of-date. GNU make proceeds to consider targets and their prerequisites using
the normal algorithms; however, all targets so considered are always remade regardless of the status
of their prerequisites. To avoid infinite recursion, if MAKE_RESTARTS (see Other Special Variables)
is set to a number greater than this option is disabled when considering whether to remake
makefiles (see How Makefiles Are Remade).
3. 使用隐含规则的时候,make,只会打印如下信息:
由于项目工程makefile有好多自定义内容,也许此段内容有错误。
[root@okk msre_engine]# make -B
CC ee_re_util.o
CC ee_pcre.o
CC mt_rand.o
CC utils.o
CC ruledb.o
可是,我们有时候需要看编译参数。我还不知道怎么打印,即使用--debug也不打印。
但是,可以用dry-run来临时解决这个问题。就是只打印不执行的意思。
‘-n’
‘--just-print’
‘--dry-run’
‘--recon’
Print the recipe that would be executed, but do not execute it (except in certain circumstances). See Instead of
Executing Recipes.
[skill][makefile] makefile 常用内容记录的更多相关文章
- [skill][git] git 常用操作记录
傻瓜入门: step by step : https://try.github.io/levels/1/challenges/1 一本书: https://git-scm.com/book/en/v2 ...
- django-xadmin常用内容记录
自定义菜单名称: 1 修改app下的 apps.py文件 添加 class OperationConfig(AppConfig): name = 'operation' verbose_name = ...
- WPF DataGrid常用属性记录
WPF DataGrid常用属性记录 组件常用方法: BeginEdit:使DataGrid进入编辑状态. CancelEdit:取消DataGrid的编辑状态. CollapseRowGroup:闭 ...
- Cs231n课堂内容记录-Lecture 3 最优化
Lecture 4 最优化 课程内容记录: (上)https://zhuanlan.zhihu.com/p/21360434?refer=intelligentunit (下)https://zhua ...
- Cs231n课堂内容记录-Lecture2-Part2 线性分类
Lecture 3 课程内容记录:(上)https://zhuanlan.zhihu.com/p/20918580?refer=intelligentunit (中)https://zhuanlan. ...
- 前端常用功能记录(二)—datatables表格(转)
前端常用功能记录(二)—datatables表格 并不是所有的后台开发都有美工和前端工程师来配合做页面,为了显示数据并有一定的美感,jQuery的DataTables插件对于像我这样的前端菜鸟来说真是 ...
- MVC中验证码的实现(经常用,记录备用)
一.目录 1.多层架构+MVC+EF+AUTOFAC+AUTOMAPPER: 2.MVC中验证码的实现(经常用,记录备用) 3.Ligerui首页的快速搭建 二 正文 Ok,我们的验证码开始,这篇文章 ...
- Centos下磁盘管理的常用命令记录(如查找大文件)
Centos下磁盘管理的常用命令记录 查看系统磁盘空间占用,使用命令: df -h 结果: 查看磁盘inode使用情况,如果inode用完了,磁盘就没法写入新的内容了: df -i 结果: 如何查找磁 ...
- android布局常用属性记录
android布局常用属性记录 http://blog.csdn.net/xn4545945/article/details/7717086这里有一部分别人总结的其余的: align:对齐 par ...
随机推荐
- Git 审查更改
但查看提交详细资料后,Jerry 实现字符串的长度不能为负数,所以他决定改变my_strlen函数的返回类型. Jerry 使用git日志命令来查看日志信息. [jerry@CentOS projec ...
- 点云PCL中小细节
计算点与点之间的距离的平局距离 double computeCloudResolution (const pcl::PointCloud<PointType>::ConstPtr & ...
- 使用 GCD 实现倒计时效果
效果如下: ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController @p ...
- MyBatis Generator使用com.mysql.cj.jdbc.Driver遇到的问题
MyBatis Generator使用com.mysql.cj.jdbc.Driver Mybatis Generator 1.3.5 新建了一个decision库,并创建了一张user表 impor ...
- python日志,一个改版SMTPHandler
1.官方logging包的SMTPHandler不支持ssl的邮箱,修改成兼容ssl以支持大部分国内邮箱. 2.增加一个频率控制的参数,比如要设置一个报警邮件,异常时候通知我们,但假设1分钟内异常几千 ...
- Linux设备驱动剖析之Input(一)
前言 以前在移植Qt到开发板上时只知道在配置文件中需要指定触摸屏的设备文件/dev/input/event0,仅此而已.直到一年半前突然想到用红外遥控器控制Tiny6410开发板上的Android系统 ...
- 排序算法--选择排序(Selection Sort)_C#程序实现
排序算法--选择排序(Selection Sort)_C#程序实现 排序(Sort)是计算机程序设计中的一种重要操作,也是日常生活中经常遇到的问题.例如,字典中的单词是以字母的顺序排列,否则,使用起来 ...
- URL中的空格
如果URL中带空格,在浏览器中可以显示,但是如果访问比如 UIImage 获取图片的时候就会出现BAD URL. 解决: NSString* urlText = @"70.84.58.40/ ...
- TensorFlow—softmax_cross_entropy_with_logits函数详解
softmax_cross_entropy_with_logits函数原型: tf.nn.softmax_cross_entropy_with_logits(labels=y, logits=pred ...
- Linux Kafka集群管理工具kafka-manager的安装使用
一.kafka-manager简介 kafka-manager是目前最受欢迎的kafka集群管理工具,最早由雅虎开源,用户可以在Web界面执行一些简单的集群管理操作.具体支持以下内容: 管理多个集群 ...