oscego
oscego

Reputation: 369

Suppressing output from my Makefile

I have ;

 default :
           gcc -o function function.c

When I type make in terminal, following message is emitted

         user@user-laptop:~/Desktop$ make
         gcc -o function function.c 
         user@user-laptop:~/Desktop$  

But I want

         user@user-laptop:~/Desktop$ make
         user@user-laptop:~/Desktop$  

How can I do that?

Upvotes: 26

Views: 14629

Answers (3)

user14222280
user14222280

Reputation:

To tell Make to be quiet/silent for all the targets, put the following at the top of a Makefile, which will work as though make --silent was used without requiring one to provide the switch on command line.

Works with GNU Make on Linux, I am not sure about all the other Make variants.

MAKEFLAGS += --silent

Upvotes: 3

Pubby
Pubby

Reputation: 53067

You can use make --silent (at least for GNU make)

Upvotes: 16

Mat
Mat

Reputation: 206861

Use an @ to quiet the output:

default:
    @gcc -o ...

You can find the documentation here: Recipe echoing. (Or you can invoke make with make -s to suppress all echoing.)

Upvotes: 37

Related Questions