views:

179

answers:

5

How I stop make from saying make: Nothing to be done for 'all'. or make: 'file' is up to date? I'd like my build to be silent when it's not doing anything - there are other places where echo is called to track build progress, so this message is just cluttering things up. I am currently silencing it like this:

all: dependency1 dependency2
    @:

Something tells me there must be a better way. Any ideas?

Edit:

I would like to keep command echo working when it does need to build something, however. A good example of what I'm hoping for is along the lines of --no-print-directory, but I can't find any other flags to shut up selected messages.

A: 

You might try...

$ make -q || make

The advantage of doing it this way is that nothing is printed when there is nothing to do but make produces the normal output when it does need to proceed...

DigitalRoss
I think that will make what is already a not great system not much better; certainly the solution I'm currently using is less invasive. A null build currently takes about 90 seconds, so doubling that probably isn't going to go over well with other developers.
Carl Norum
+1  A: 

Maybe make -s?

Vinko Vrsalovic
Wow. That was easy; the option wasn't described as doing that in the man page, that's for sure.
Carl Norum
That's because it does more than just that...
Vinko Vrsalovic
I will, unfortunately, have to not use this method. When debugging the build system, it's a big pain to turn off a flag, but easy to delete an @ on a line. Historical reasons... (read: garbage build system).
Carl Norum
A: 

To quote (from memory) from the old make(1) man page, BUGS section: There are some things you can't get make to shut up about. Meanwhile, the -s or --silent option may help.

mpez0
A: 

make 2>&1 | egrep -v 'Nothing to be done|up to date'

Mike D.
Seriously? How is that a better way than what I am already doing? I think most people would argue it's worse; since I can't dump errors to a log file anymore.
Carl Norum
Well, if `bash` had a way to feed `stderr` into another process's `stdin`, I would have recommended that. But you were asking to make two messages go away, and that does it at the cost of splitting `stderr` and `stdout` for logging purposes, which was a feature you didn't mention wanting to keep. Personally, when I log `make`'s output, I merge `stdout` and `stderr` first so I have some idea, when reading the file, which errors happened at which step, so it didn't look like a real loss anyway.
Mike D.
If you want to be perfectionist about it, you're going to either have to patch `make` to add a flag to drop those two messages, or write a nontrivial wrapper program (in Perl, Python, C, whatever) which spawns the `make` process, filters its `stderr`, and passes `stdout` through unchanged. The answer I suggested seemed like the simplest way to go. Sorry it's not good enough for you.
Mike D.
+1  A: 

So after a couple days of reading around the web, it looks like there isn't any better way than what I'm doing. Some people recommended something along the lines of:

all: dependency1 dependency2 | silent

silent:
    @:

That is, just depending on the silent target would be enough to quiet things down. Since I didn't come up with any other workable solutions, I'm going with what I have.

Carl Norum