Makefile:为什么在调用它之前要执行命令序列?

Makefile:为什么在调用它之前要执行命令序列?

在 makefile 下,${PATH}/CMD0.log 由 CMD0 生成。check_file
是用于检查 CMD0.log 警告的命令序列。首先,它将检查 CMD0.log 是否存在。
运行时make clean; make,它显示 CMD0.log 不存在。
由于日志是由 CMD0 生成的,因此不确定为什么 check_file 在 CMD0 之前执行。

...
define check_file =
    if test -f ${PATH}/CMD0.log; then
        $(eval WARNING = $(shell grep "WARNING.*" ${PATH}/file.log))
    fi
endef 
...
${OUTPUTS0}: ${INPUTS0}
   @echo ""
   @echo "[INFO] STEP0";
   @date '+%Y_%m%d_%H%M'
   ... CMD0 -log CMD0.log ...
   @$(check_file)

丝网印刷

-> make clean ; make
grep: ./log/CMD0.log: No such file or directory

[INFO] STEP0
2021_0303_0025

make -d | tee make.log丝网印刷

     Finished prerequisites of target file `target'.
    Must remake target `target'.
grep: ./log/CMD0.log: No such file or directory
Invoking recipe from makefile:137 to update target `target'.
Putting child 0x26490c0 (target) PID 18792 on the chain.
Live child 0x26490c0 (target) PID 18792 

Reaping winning child 0x26490c0 PID 18792 
Live child 0x26490c0 (target) PID 18793 
[INFO] STEP0
Reaping winning child 0x26490c0 PID 18793 
Live child 0x26490c0 (target) PID 18810 
2021_0303_0957

相关内容