什么是makefile? 如何编写makefile?
makefile:一个文本形式的文件,其中包含一些规则告诉make编译哪些文件以及怎样编译这些文件,每条规则包含以下内容:
一个target,即最终创建的东西
一个和多个dependencies列表,通常是编译目标文件所需要的其他文件
需要执行的一系列commands,用于从指定的相关文件创建目标文件
make执行时按顺序查找名为GNUmakefile,makefile或者Makefile文件,通常,大多数人常用Makefile
Makefile规则:
target: dependency dependency [..] command command [..]
注意:command前面必须是制表符
例子:
editor: editor.o screen.o keyboard.o
gcc -o editor editor.o screen.o keyboard.o
editor.o : editor.c editor.h keyboard.h screen.h
gcc -c editor.c
screen.o: screen.c screen.h
gcc -c screen.c
keyboard.o : keyboard.c keyboard.h
gcc -c keyboard.c
clean:
rm editor *.o
一个target,即最终创建的东西
一个和多个dependencies列表,通常是编译目标文件所需要的其他文件
需要执行的一系列commands,用于从指定的相关文件创建目标文件
make执行时按顺序查找名为GNUmakefile,makefile或者Makefile文件,通常,大多数人常用Makefile
Makefile规则:
target: dependency dependency [..] command command [..]
注意:command前面必须是制表符
例子:
editor: editor.o screen.o keyboard.o
gcc -o editor editor.o screen.o keyboard.o
editor.o : editor.c editor.h keyboard.h screen.h
gcc -c editor.c
screen.o: screen.c screen.h
gcc -c screen.c
keyboard.o : keyboard.c keyboard.h
gcc -c keyboard.c
clean:
rm editor *.o
【什么是makefile? 如何编写makefile?】相关文章
2. 什么叫应用程序域?什么是托管代码?什么是强类型系统?什么是装箱和拆箱?什么是重载?CTS、CLS和CLR分别作何解释?
3. 创业计划书如何编写
5. 什么叫应用程序域?什么是受管制的代码?什么是强类型系统?什么是装箱和拆箱?
7. 什么是静态路由,其特点是什么?什么是动态路由,其特点是什么?
9. 什么是符号链接,什么是硬链接?符号链接与硬链接的区别是什么?
10. 什么是用户模式(User Mode)与内核模式(Kernel Mode) ?
本文来源:https://www.mianshiwenti.com/a13566.html
进入下载页面
上一篇:linux面试题参考答案(11)
下一篇:init进程的作用
﹝什么是makefile? 如何编写makefile?﹞相关内容
- 什么是表空间(tablespace)和系统表空间(System tablespace)
- 什么是表空间(tablespace)和系统表空间(System tablespace)?
- 什么是UTL_FILE, 她相关的Procedure和函数都有什么
- 什么是Oracle的同义词(synonym)? 如何创建synonym?
- 什么是典型的软件三层结构?软件设计为什么要分层?软件分层有什么好处?
- Java里面Pass by value和Pass by Reference是什么意思
- Ref与out有什么不同
- P/Invoke是什么
- 枚举和一组预处理的#define有什么不同
- 声明struct x1 { . . . }; 和typedef struct { . . . }x2;有什么不同