原理
空着
测试
在当前不创建include的文件夹以及makefile文件。
用户@主机:~/makefileT$ tree
.
└── makefile
0 directories, 1 file
使用include测试
编写如下makefile文件。
include $(CURDIR)/001/001.mk
all:
@echo "makefile"
执行make命令。
用户@主机:~/makefileT$ make
makefile:2: /home/*** 略 ***/makefileT/001/001.mk: No such file or directory
make: *** No rule to make target '/home/zw0055916/CTest/makefileT/001/001.mk'. Stop.
使用-include测试
编写如下makefile文件。
-include $(CURDIR)/001/001.mk
all:
@echo "makefile"
执行make命令。
用户@主机:~/makefileT$ make
makefile
测试结果
使用-include:即使没有这个文件也继续执行。
使用include:没有这个文件,make退出报错。