Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide compiling message in Makefile?

Tags:

linux

makefile

The linux kernel I compile only prints message like:

CC  .....
LD [M] ....

How can I hide the compiling message printed out by make and output what I want? Where can I find the portion of code which does this in kernel Makefile?

like image 539
Amumu Avatar asked Mar 27 '12 05:03

Amumu


People also ask

How do I hide the output of my Makefile?

If you want to inhibit the display of commands during a particular make run, you can use the -s option. If you want to inhibit the display of all command lines in every run, add the special target . SILENT to your makefile .

What is $@ in Makefile?

The file name of the target of the rule. If the target is an archive member, then ' $@ ' is the name of the archive file. In a pattern rule that has multiple targets (see Introduction to Pattern Rules), ' $@ ' is the name of whichever target caused the rule's recipe to be run.

How do I stop Makefile echo?

The ' -s ' or ' --silent ' flag to make prevents all echoing, as if all recipes started with ' @ '. A rule in the makefile for the special target .

What is the make command in Linux?

The Linux make command is used to build and maintain groups of programs and files from the source code. In Linux, it is one of the most frequently used commands by the developers. It assists developers to install and compile many utilities from the terminal.


1 Answers

In short, prepend '@'.

What the kernel makefiles do is rather more complicated, but it boils down to something like this:

%.o: %.c
    @echo [CC] $@
    @gcc -o $@ -c $<

Look at the GNU Make manual. GNU Make really is quite well documented, and if you're doing a lot of work with it it's worth the effort to read it through.

like image 142
Kristof Provost Avatar answered Oct 27 '22 01:10

Kristof Provost