MakeFIle $@,$^,$<
来源:互联网 发布:淘宝人工客服打不进去 编辑:程序博客网 时间:2024/06/06 01:10
Makefile $@, $^, $<
$@ 表示目标文件
$^ 表示所有的依赖文件
$< 表示第一个依赖文件
$? 表示比目标还要新的依赖文件列表
如一个目录下有如下文件:
按照 Makefile 规则规规矩矩的写:
改为用上述符号进行替代:
$@ 表示目标文件
$^ 表示所有的依赖文件
$< 表示第一个依赖文件
$? 表示比目标还要新的依赖文件列表
如一个目录下有如下文件:
$ ls
hello.c hi.c main.c Makefile
按照 Makefile 规则规规矩矩的写:
main: main.o hello.o hi.o
gcc -o main main.o hello.o hi.o
main.o: main.c
cc -c main.c
hello.o: hello.c
cc -c hello.c
hi.o: hi.c
cc -c hi.c
clean:
rm *.o
rm main
改为用上述符号进行替代:
main: main.o hello.o hi.o
gcc -o $@ $^
main.o: main.c
cc -c $<
hello.o: hello.c
cc -c $<
hi.o: hi.c
cc -c $<
clean:
rm *.o
rm main
beyes@debian:~/makefile_test/semicolon/real$ make
cc -c main.c
cc -c hello.c
cc -c hi.c
gcc -o main main.o hello.o hi.o
beyes@debian:~/makefile_test/semicolon/real$ ls
hello.c hello.o hi.c hi.o main main.c main.o Makefile
0 0
- Makefile
- Makefile
- makefile
- makefile
- makefile
- Makefile
- Makefile
- Makefile
- Makefile
- Makefile
- Makefile
- makefile
- Makefile
- makefile
- Makefile
- makefile
- makefile
- makefile
- Ini antara usaha dal
- treelistwidget
- Centos7 - devstack快速安装openstack
- JSP执行流程和JSP的内置对象request和session解析比较
- super的使用
- MakeFIle $@,$^,$<
- Java的包
- How to solve TFS slow response problem?
- leetcode 179: Largest Number
- HTML中的id作用
- 02-mac上修改MySQL密码
- Interface
- Plist 文件详解 (一)
- savefile