参考:
示例:
- 默认目标
Makefile中的第一个目标会被作为其默认目标
- PHONY 伪目标
.PHONY:clean
当前目录不论是否有clean文件,make clean 都会执行Makefile中clean任务。
- make -n
-n Print the commands that would be executed, but do not execute them.
- 命令必须以tab 键开始
target:prerequisites
command
- Makefile 示例
msg = "hello maker" #变量
build:
# 注释会在控制台输出,相当于echo
@# 注释不会会在控制台输出,相当于关闭回声
-echh "出错,但继续执行下面指令"
@echo ${msg} #隐藏echo命令
+echo “执行make -n时也会被执行”
test:build
echo "test"
run:test
echo "run"
clean:
echo "clean"
网友评论