[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternative compiling for debug/optimized code?

From: Ralf Wildenhues
Subject: Re: Alternative compiling for debug/optimized code?
Date: Thu, 8 Dec 2005 13:37:26 +0100
User-agent: Mutt/1.5.11

Hi Daniel,

* Daniel Kraft wrote on Thu, Dec 08, 2005 at 10:24:26AM CET:
> Prior to using the GNU build system (especially automake) I used my own plain
> Makefiles which set compiler flags like -g, -O2
> or -Ds enabling assertions depending on a variable set on commandline. So it 
> was
> possible to compile debugging/optimized code just by changing the 
> make-command:
> make mode=opt
> make mode=debug
> ...
> Using automake the default compiler flags seem to be -g -O2;

Nope.  The (autoconf-provided, by the way) default is -O2 if accepted,
and -g added to that, if also accepted by the compiler.  These choices
are tested at configure time.

> but most of th time I don't need debug code, so I want to disable that
> -g - option.

So standard way with Automake-using projects would be: you make a debug
build tree and a normal (optimized) build tree:

mkdir build-debug build
cd build-debug
../source-tree/configure CFLAGS=-g

cd ../build
../source-tree/configure CFLAGS=-O3

With a bit of luck, you'll only have to run configure once per build
tree, and automatic rebuilding rules will take care of everything else.

I have build trees I configured years ago, and still regularly use.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]