首先,你这个makefile 要链接 -Wall -pedantic -Wno-long-long 这几个库,这个由makefile 自动链接,你后面编译的时候如果缺少库的话,可在些后面继续添加.
接下来会执行 make 后面接的参数,
1、make all,会生成 check 和 bench 这两个文件,makfile 会根据后面接的参数自动匹配标签;
check 标签 生成输出文件 check ,由 ../../utils/check.c norx.c caesar.c 编译链接后生成, ./check 是运行check程序 rm check 是删除check
bench 标签 生成输出文件 bench ,由../../utils/bench.c norx.c caesar.c编译链接后生成, ./bench 是运行bench程序 rm bench 是删除bench
2、也可以单独的进行 make 编译
make debug 是执行 @ ../../utils/debug.c norx.c 后,生成 debug,执行 ./debug 后,rm debug 删除 debug
make bench 是执行 @bench ../../utils/bench.c norx.c caesar.c 后,生成 bench,执行 ./bench 后,rm bench 删除 bench
make check 是执行 @check ../../utils/check.c norx.c caesar.c 后,生成 check,执行 ./check 后,rm check 删除 check
最后的 .PHONY: check debug bench 是 为了防止生成的执行文件有冲突,同时也可以提高 makefile 的执行效率
另外补充一下 @ 这个符号是 在 make 会把其要执行的命令行在命令执行前输出到屏幕上,这样我们可以实时看到执行过程