[Top][All Lists]

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

Re: Alternative compiling for debug/optimized code?

From: Stepan Kasal
Subject: Re: Alternative compiling for debug/optimized code?
Date: Thu, 8 Dec 2005 14:26:15 +0100
User-agent: Mutt/1.4.1i


On Thu, Dec 08, 2005 at 10:24:26AM +0100, Daniel Kraft wrote:
> 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
> ...

with Automake, the situation is very similar; you are supposed to call

make CFLAGS=-O2
make CFLAGS=-g

> Using automake the default compiler flags seem to be -g -O2;

To be more exact: if you don't specify CFLAGS as an argument to the make,
a default value applies.
This default value is defined at configure time:

./configure CFLAGS=-O2  [...]

If you don't define the "default value for CFLAGS" as an argument to
./configure, then it deaults to "-g -O2".

To sum up:
1) give "CFLAGS=-O2" as an argument to ./configure
2) use CFLAGS=-g instead of make=debug

Yes, there are some difference:
With your old solution, the package maintainer prepared make=opt and such.

With the solution proposed above, _the user_ has to specify the values
when compiling the package.  It looks more complicated, but it is more
standard: it should work with all packages which behave according GNU
Condig Standards.

Hope this helps,
        Stepan Kasal

reply via email to

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