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 make cd ../build ../source-tree/configure CFLAGS=-O3 make 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. Cheers, Ralf