![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Makefile
coderchenjingui
失眠爱好者!
展开
-
伪目标.PHONY
这次只有一个main.cpp和一个Makefile文件。 main.cpp #include using namespace std; int main() { cout<<"hello world!"<<endl; return 0; } Makefile main:main.o g++ -o main main.o main.o:main.cpp g++ -c -o mai原创 2013-04-09 17:49:56 · 1532 阅读 · 0 评论 -
Makefile变量---简单的文本替换
这次的试验,只有一个Makefile,别的没有任何文件,通过一个伪目标show来演示变量的使用,好奇葩啊。 cc=gcc src=a.c b.c .PHONY:show show: @echo $(cc) @echo $(src)执行make show,将会显示 gcc a.c b.c so easy。。。 echo前面为什么要加上@呢? .PHONY:reaso原创 2013-04-09 18:22:59 · 3484 阅读 · 0 评论 -
初识Makefile
三个文件,hello.h hello.cpp main.cpp hello.h #ifndef MAKE_FILE_OO1 #define MAKE_FILE_001 void printHello(); #endif hello.cpp #include #include "hello.h" using namespace std; void printHello原创 2013-04-09 16:42:07 · 991 阅读 · 0 评论 -
让Makefile自动推导依赖关系
用到4个文件:hello.h hello.cpp main.cpp Makefile hello.h #ifndef MAKE_FILE_TEST #define MAKE_FILE_TEST void hello(); #endif hello.cpp #include #include "hello.h" using namespace std; void hello() {原创 2013-04-11 14:00:34 · 2841 阅读 · 0 评论 -
Makefile文件的重建过程
最近在理解Makefile自动推导依赖关系时,总感觉理解不动。原因是对Makefile的重建过程不清楚。所以学习一下。 感谢《GNU make中文手册》。 下面时书中makefile文件重建的原文: Makefile 可由其它文件生成,例如 RCS 或 SCCS 文件。如果 Makefile 由其它文 件重建,那么在 make 在开始解析这个 Makefile 时需要重新读取更原创 2013-04-11 22:00:11 · 2326 阅读 · 0 评论 -
Makefile定义变量 = 和 := 的区别
Makefile中变量的定义有两种方式。 第一种: = 例如name=chen info=$(name) 第二种: := 例如name=chen info:=$(name) 这两种定义变量的区别主要是对引用的其它变量的展开时机不同。 第一种方式:使用= name=chen info=$(name) 在这种方式中,info的值就是“$(name)”这个字符串,它的展开一原创 2013-04-12 14:11:16 · 1530 阅读 · 0 评论