GNU Make silent by default

If you define the target .SILENT:, then make will not echo anything. It's usually best to guard the definition, so you can easily turn it off:

ifndef VERBOSE
.SILENT:
endif

Now by default, make will print nothing, but if you run make VERBOSE=1, it will print.

Note that despite the statement in the manual claiming that .SILENT is obsolete -- if properly guarded, it is generally much better (more useful and flexible) than @.

The .SILENT target should not be the first on your Makefile, otherwise make will use it by default.


According to GNU Make's manual, you can use special target .SILENT.

Note that the manual says that:

.SILENT is essentially obsolete since ‘@’ is more flexible.

But it seems to work as expected. The following code silences the all target:

.SILENT:

hoge:
    echo hoge

The following example silences only the hoge target:

.SILENT: hoge

hoge:
    echo hoge

fuga:
    echo fuga

You can add --silent in the MAKEFLAGS variable at the beginning of your Makefile:

MAKEFLAGS += --silent

all:
    echo foobar

.PHONY: all

And you will have:

$ make
foobar