ignoring at (@) symbol in makefiles

后端 未结 6 1113
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 09:20

In makefiles, a line prefixed with an at symbols disables the print of the output. I have a makefile where every line is prefixed with an at, but for debug I need to see wha

6条回答
  •  醉梦人生
    2020-12-15 09:27

    Disabling the @ in front of a make script is useful, however sometimes it is too noisy when the make script is very long. Another debugging technique is to turn on a shell feature that echoes commands just before they execute. This obviates a need to manipulate @ or .SILENT. Consider an example Makefile:

    test:
        @blah; \
        : ... lots of script commands ... ; \
        : Start debugging here ; \
        set -x; \
        : ... script segment to debug ... ; \
        set +x; \
        : Stop debugging here ; \
        : ... lots of script commands ... ;
    

    This is likely non-portable since it depends on features present in the shell that executes the script, but portability is not really that important for debugging (if it works for you).

提交回复
热议问题