This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Compiling without -g


> Jonathan Buzzard <jab@hex.prestel.co.uk> writes:
> 
> > I grabed a copy of egcs-1.0.1 in order to get a better C++ compiler than
> > gcc-2.7.2. However without going round editting all the Makefiles is
> > there anyway to stop it using the -g flag everywhere as I am a little
> > short on disk space. 

Warning: you don't want to compile your libraries without -g, or your
users won't be able to debug fully (even if they use -g for their own
code, the lack of -g in the libraries will mean, for instance, that
the debugger things iostreams, strings, etc are unknown classes).

> Here's what I do sometimes:
> 
> find -type f |
> 	xargs grep -l 'FLAGS[	 ]*=' |
> 	xargs perl -p -i -e 's#(-O\d?|-g)\b#-O#g if (/FLAGS\s*=/)'

You don't need to edit the makefiles; it suffices to say, for example

make CFLAGS=-O2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]