0

Below makefile, ${PATH}/CMD0.log is generated by CMD0.
check_file is command sequence to check warnings from CMD0.log. First it will check if CMD0.log exists.
When run make clean; make, it shows CMD0.log doesn't exist.
Since the log is generated by CMD0, not sure why check_file is executed before 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)

Screen print

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

[INFO] STEP0
2021_0303_0025

make -d | tee make.log screen print

     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
7
  • If I'm understanding you, makefiles have to be rerunable. you generally make and then make install for simple deployments, and what happens if somthing went wrong, or you are updating an existing install? Commented Mar 2, 2021 at 23:46
  • Try adding the -d parm to make and see if make is doing what you expect it to. And try running just make -d clean first, see if that is behaving, then try make -d and review. Commented Mar 2, 2021 at 23:52
  • @FrankThomas: it's for FPGA bit generation, since I run make clean, it's a clean build, not updating existing run.
    – Fisher
    Commented Mar 3, 2021 at 9:11
  • @MarkStewart, tried -d, still can't figure out what's wrong.
    – Fisher
    Commented Mar 3, 2021 at 9:13
  • 1
    I thought CMD0 -log CMD0.log is supposed to create the log. Removing the command will all the more not make it appear where you want it. My point is maybe you're looking in the wrong place (./log/CMD0.log) when you grep. Commented Mar 3, 2021 at 9:46

0

You must log in to answer this question.

Browse other questions tagged .