Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Makefile: silence the "make[N]:" line specifically

Part of my makefile has the following code:

target.o:
        cd dir; $(MAKE)

Where the file target.o has its own makefile inside of directory dir. During compiling, I get the following output lines:

make[1]: Entering directory `dir'
ifort -c target.f -o target.o
make[1]: Leaving directory `dir'

I would like to silent the first and third output lines but keep the second. Adding the -s to the make in the main makefile eliminates the first and third but also the one I want to keep.

(1) Is there a way to do this?

(2) Is there a reason why doing this might not be such a good idea?

like image 558
Nordico Avatar asked Dec 05 '14 14:12

Nordico


1 Answers

You want $(MAKE) --no-print-directory.

-w, --print-directory Print the current directory.

--no-print-directory Turn off -w, even if it was turned on implicitly.

You cannot silence only part of a command. The @ prefix is all-or-nothing.

You can echo anything you want of course (this is how the autotools silent output works for example, silence the default make output and then output GEN target.file or whatever).

like image 138
Etan Reisner Avatar answered Oct 03 '22 01:10

Etan Reisner