Page 1 of 1

print compile results in makefile

Posted: Sun Sep 11, 2011 3:14 pm
by psnix
hi

how can i print compiling result in makefiles? (for example "Compiling 'test.c': [ok]" )

Re: print compile results in makefile

Posted: Sun Sep 11, 2011 5:04 pm
by Combuster
Did you try reading the appropriate documents on Makefiles and printing?

Re: print compile results in makefile

Posted: Sun Sep 11, 2011 6:14 pm
by Brynet-Inc
I really hate this trend of silencing compilation output, it's stupid.. almost as stupid as colourizing it, so don't do it.

Re: print compile results in makefile

Posted: Sun Sep 11, 2011 10:17 pm
by JackScott
Brynet-Inc wrote:I really hate this trend of silencing compilation output, it's stupid.. almost as stupid as colourizing it, so don't do it.
Apart from your opinion, why do you say that?

Re: print compile results in makefile

Posted: Sun Sep 11, 2011 10:44 pm
by Solar
Brynet-Inc wrote:I really hate this trend of silencing compilation output, it's stupid.. almost as stupid as colourizing it, so don't do it.
This is not "silencing compilation output". To the contrary - it is silencing the stupid default behaviour of make, echoing every command it executes before doing so. The effect is that you actually see the only compilation output that counts: Warnings and errors, which get drowned out in line noise with your average "I print everything I do" makefiles.

Re: print compile results in makefile

Posted: Mon Sep 12, 2011 3:28 am
by Combuster
Solar wrote:Warnings and errors, which get drowned out in line noise with your average "I print everything I do" makefiles.
Errors don't get drowned out. It's usually the last thing make does :wink: (And the recommended -Werror fixes the warnings too)

That said, I'd like to see my previous entries on the command line instead of having my screen filled with pages of compiler flags. So I replace the bloat with echo $(CC) $@ (or any other echo $(TOOL) $@)

Re: print compile results in makefile

Posted: Mon Sep 12, 2011 3:47 am
by Solar
Combuster wrote:Errors don't get drowned out. It's usually the last thing make does :wink:
I wish it were so. Do you know how often I had someone ask me something along the lines of "your makefile failed, I get an error message 'make: *** [all] error 2'"...?

What you need when 'make' fails is the first error message. This can be difficult to identify between GCC echos (especially for unskilled people, which are the ones calling you or writing you emails demanding you fix things).

Doing the "echo CC" thing has the advantage that "usual" output is clearly distinguishable from warnings, errors et al. even by those ignorant of what is actually going on.

Re: print compile results in makefile

Posted: Mon Sep 12, 2011 5:56 am
by Combuster
Solar wrote:I wish it were so. Do you know how often I had someone ask me something along the lines of "your makefile failed, I get an error message 'make: *** [all] error 2'"...?
Ah I see where you got that from. (I don't have a habit of letting the incompetent do compilation work, you have binaries for that)


Er, wait, did I just sense recursive make? from you? *ducks and runs*

Re: print compile results in makefile

Posted: Mon Sep 12, 2011 6:02 am
by Solar
Combuster wrote:Wait, did I just sense recursive make from you? *ducks and runs*
As any makefile generated by autoconf / automake. Unfortunately these two "great" tools are as unable of creating non-recursive makefiles as they are able to generate silent makefiles - not at all. :roll:

(Actually, they are able to generate silent makefiles, but only in the latest versions and with quite some non-compatible changes to the config files.)