当前位置:网站首页>黑猫带你学Makefile第6篇:Makefile重要规则
黑猫带你学Makefile第6篇:Makefile重要规则
2022-08-08 19:06:00 【黑猫学长呀】
本文结合个人工作/学习经验、网络资料辛苦整理/撰写而成,禁止转载。
本文所在专栏《黑猫带你学Makefile》
1 文件命名
通常“GNUmakefile”、“makefile”、“Makefile”,但主要用“makefile”、“Makefile”。
当然,你可以使用别的文件名来书写Makefile,比如:“Make.Linux”,“Make.Solaris”,“Make.AIX”等,如果要指定特定的Makefile,你可以使用make的“-f”和“–file”参数,如:make -f Make.Linux或make --file Make.AIX。
2 Makefile的工作流程
输入make后:
- make会在当前目录下找名字叫“Makefile”或“makefile”的文件。
- 如果找到,它会找文件中的第一个目标文件(target),在上面的例子中,他会找到“edit”这个文件,并把这个文件作为最终的目标文件。
- 如果edit文件不存在,或是edit所依赖的后面的 .o 文件的文件修改时间要比edit这个文件新,那么,他就会执行后面所定义的命令来生成edit这个文件。
- 如果edit所依赖的.o文件也存在,那么make会在当前文件中找目标为.o文件的依赖性,如果找到则再根据那一个规则生成.o文件。(这有点像一个堆栈
边栏推荐
- 工程 (六) ——PointNet点云分类
- 【761. Special binary sequence】
- 分布式文件系统fastDFS
- Implement the entire process of Mock API with tools
- Vue program of web cache problem after packaging
- BP neural network
- Codeforces Round #725 (Div. 3)
- Advanced CAD practice (2)
- Is it safe to open an account with Qiniu Business School?Is it reliable to open an account?
- [BJDCTF2020]Easy MD5
猜你喜欢
The difference between Redis' memory elimination strategy and expired deletion strategy
Performance optimization | CPU power management from the perspective of ping delay
企业进行知识共享的好处有哪些?
【kali-权限提升】(4.2.6)社会工程学工具包(上):中间人攻击原理
卡通渲染的历史
FastDFS distributed file system
synApps -- Autosave
干货:从零设计高并发架构
Rethinking HTAP database caused by rereading GPDB and TiDB papers
Fortinet new cloud native protection products launched amazon cloud platform of science and technology
随机推荐
Codeforces Round #707 (Div. 2) C(抽屉原理)
Dry goods: design high concurrency architecture from scratch
FastDFS distributed file system
Word清除格式在哪里?Word清除格式使用方法
对话框管理器第六章:消息循环中的细节
leetcode 240.搜索二维矩阵II 分治思想
证券开户选哪个券商平台比较好,哪个更安全
Laravel queue consumption instance and timed task add task consumption
Codeforces Round #722 (Div. 2)
Learn about layered architecture & SOA architecture together
What are the benefits of knowledge sharing for businesses?
Salesforce开发之 apex操作批准过程(Approval Process)
nyoj714 Card Trick(第六届河南省程序设计大赛)
工程 (六) ——PointNet点云分类
synApps -- Autosave
CAD进阶练习(二)
PyTorch入门:(二)Tensorboard的使用
架构设计基本原则
Oracle存储修改以前的历史记录,怎么查找?
软件测试基础笔记