Suppress and ignore output for Makefile?

前端 未结 2 1576
说谎
说谎 2020-12-24 01:00

I know that the @ prefix suppresses output from a shell command in Makefiles, and also that the - prefix will ignore errors from a shell command. I

2条回答
  •  不思量自难忘°
    2020-12-24 01:15

    GNU make does allow you to combine both @ and -:

    all:
            @-exit 1
    

    Running this with gmake 3.81 produces this output:

    gmake: [all] Error 1 (ignored)

    As you can see, the command is not echoed, and the error is ignored as expected.

提交回复
热议问题