GCC formatting question

Programming, for all ages and all languages.
Post Reply
sawdust
Member
Member
Posts: 51
Joined: Thu Dec 20, 2007 4:04 pm

GCC formatting question

Post by sawdust »

When I compile using gcc, the output is something like

Code: Select all

gcc-linux -m32 -Wall -Os -fomit-frame-pointer -fno-common -ffreestanding -fno-strict-aliasing -Wno-unused  -nostdinc -imacros ../../build/i386/config.h -I../../arch/i386/include -I../../fwcore/drvInc -I/opt/crosstool/gcc-3.3.6-glibc-2.3.2/i386-unknown-linux-gnu/lib/gcc-lib/i386-unknown-linux-gnu/3.3.6/include -MD -c fault.c -o fault.o

gcc-linux -m32 -Wall -Os -fomit-frame-pointer -fno-common -ffreestanding -fno-strict-aliasing -Wno-unused  -nostdinc -imacros ../../build/i386/config.h -I../../arch/i386/include -I../../fwcore/drvInc -I/opt/crosstool/gcc-3.3.6-glibc-2.3.2/i386-unknown-linux-gnu/lib/gcc-lib/i386-unknown-linux-gnu/3.3.6/include -MD -c tscdelay.c -o tscdelay.o
What should I do to output something like this

Code: Select all

gcc-linux -m32 -o fault.o ../../arch/i386/fault.c
gcc-linux -m32 -o tscdelay.o ../../arch/i386/tscdelay.c
TIA
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: GCC formatting question

Post by Solar »

Not sure what you're wondering about, here. There are a couple of compiler flags set, several of them quite necessary (-Wall, and -ffreestanding -nostdinc too if you're doing OS work). Didn't you set them yourself, somewhere - in your Makefile, for example?

How is the compiler executed by you?
Every good solution is obvious once you've found it.
sawdust
Member
Member
Posts: 51
Joined: Thu Dec 20, 2007 4:04 pm

Re: GCC formatting question

Post by sawdust »

Solar wrote:Not sure what you're wondering about, here. There are a couple of compiler flags set, several of them quite necessary (-Wall, and -ffreestanding -nostdinc too if you're doing OS work). Didn't you set them yourself, somewhere - in your Makefile, for example?
Yes I set them in the Makefile. Question is, is there some 'echo off' option to minimize the output?
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: GCC formatting question

Post by DeletedAccount »

SanEliza : Cmon , Elucidate you thoughts :D
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: GCC formatting question

Post by DeletedAccount »

Redirect output to /dev/null , but i do no think that is a very good thing to do
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: GCC formatting question

Post by Solar »

What you see is "make" printing each command it executes to output before actually executing it. That is default behaviour. By adding "@" to the Makefile command line, you set this to "off". You can then add an echo-line of your own chosing to keep track of progress.

Code: Select all

%.o: %.c Makefile
            @echo " CC	-c $< -o $@"
            @$(CC) $(CFLAGS) -c $< -o $@
/dev/null is too radical for my tastes.
Every good solution is obvious once you've found it.
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Re: GCC formatting question

Post by JackScott »

Biggest problem with /dev/null is that then your error messages go there too, which is of course the last thing you want to do with them. Out of preference, I would have them turn my screen pink and start playing "Barbie Girl" by Aqua, just so I noticed properly.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: GCC formatting question

Post by Solar »

Have you ever tried colorgcc?
Every good solution is obvious once you've found it.
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Re: GCC formatting question

Post by JackScott »

Nope, but I've just apt-getted it. Thanks for pointing that out. With some suitable modification, it might be able to play Aqua music too!

Hmmm... different Aqua songs for different error types? :D
sawdust
Member
Member
Posts: 51
Joined: Thu Dec 20, 2007 4:04 pm

Re: GCC formatting question

Post by sawdust »

Solar wrote:

Code: Select all

%.o: %.c Makefile
            @echo " CC	-c $< -o $@"
            @$(CC) $(CFLAGS) -c $< -o $@
Wow! This served my purpose. Thanks a lot... =D>
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: GCC formatting question

Post by JamesM »

Solar wrote:Have you ever tried colorgcc?
I love colorgcc. I have a ported version that works out of the box for pedigree's build system. Om nom nom.
Post Reply