文件组成
#<目标名称>:<前置依赖>
# \t<需要执行的命令>
例
objects :=hello.o main.o
main:$(objects)
gcc $(objects) -o main
main.o:hello.h
hello.o:hello.h
# .PHONY : clean
clean:
-rm $(objects) main
注:hello.h 无法自动更新,需手动导入
通过clean清除无关文件
#<目标名称>:<前置依赖>
# \t<需要执行的命令>
objects :=hello.o main.o
main:$(objects)
gcc $(objects) -o main
main.o:hello.h
hello.o:hello.h
# .PHONY : clean
clean:
-rm $(objects) main
注:hello.h 无法自动更新,需手动导入
通过clean清除无关文件

被折叠的 条评论
为什么被折叠?