11

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?

Nordico
  • 1,226
  • 2
  • 15
  • 31
  • 6
    `$(MAKE) --no-print-directory`? – Etan Reisner Dec 05 '14 at 15:05
  • Thank you, that worked. Also: is there a way to silent just one of the two commands in `cd dir; $(MAKE) --no-print-directory`? Or a way to separate them in two lines but keep working on the same shell? – Nordico Dec 05 '14 at 15:11

1 Answers1

21

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).

Community
  • 1
  • 1
Etan Reisner
  • 77,877
  • 8
  • 106
  • 148