print compile results in makefile

Programming, for all ages and all languages.
Post Reply
psnix
Member
Member
Posts: 50
Joined: Fri Oct 24, 2008 12:34 pm

print compile results in makefile

Post by psnix »

hi

how can i print compiling result in makefiles? (for example "Compiling 'test.c': [ok]" )
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: print compile results in makefile

Post by Combuster »

Did you try reading the appropriate documents on Makefiles and printing?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: print compile results in makefile

Post 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.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Re: print compile results in makefile

Post 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?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: print compile results in makefile

Post 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.
Every good solution is obvious once you've found it.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: print compile results in makefile

Post 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) $@)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: print compile results in makefile

Post 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.
Every good solution is obvious once you've found it.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: print compile results in makefile

Post 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*
Last edited by Combuster on Mon Sep 12, 2011 6:04 am, edited 1 time in total.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: print compile results in makefile

Post 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.)
Every good solution is obvious once you've found it.
Post Reply