1. make
make是个应用程序
- 解析源程序之间的依赖关系
- 根据依赖关系自动维护编译工作
- 执行宿主操作系统中的各种命令
2. makefile
makefile是一个描述文件
- 定义一系列的规则来指定源文件编译的先后顺序
- 拥有特定的语法规则,支持函数定义和函数调用
- 能够直接集成操作系统中的各种命令
3. makefile实例
//
hello:
(Tab)echo “hello makefile”
make -f mf.txt hello
功能说名:以hello关键字作为目标查找mf.txt文件,并执行hello处的命令
4. make程序的简写实例
make hello
功能说明:
以hello关键字作为目标查找makefile或Makefile文件,并执行hello处的命令
make
功能说明:
查找makefile或Makefile文件中最顶层目标,并执行最顶层目标的命令
代码
创建makefile.txt,写下
hello:
echo “hello makefile”
在终端输入:
make -f makefile.txt hello
得到输出:
输入make和make hello得到相同的结果
5. 其他实例
hello:
(tab)echo “hello makefile”
test:
(tab)echo “test”
(tab)pwd
(tab)ls
输出:
可以看出逐行命令执行