[Vm-dev] How to compile a debugging VM?
gavin at redhat.com
Tue Mar 24 20:40:34 UTC 2009
Michael van der Gulik wrote:
> On Linux, how do you tell the build scripts to make GCC compile with
> the -g flag rather than -O2 (i.e. don't optimise and leave debugging
> symbols in the VM)?
There is a (not always followed) convention for writing Makefiles where
the Make variable CFLAGS is only used for debugging flags, optimization
flags, and warning flags, and specifically _not_ used for include flags,
define flags, or any flags that are required for correct compilation.
If this convention is followed then one can do:
$ make CFLAGS=-g whatever
That is, CFLAGS is set on the Make command line. Setting CFLAGS on the
command line causes that value to override the value set in the
Makefile, if any, and Make passes this value on to the C compiler.
Unfortunately, the SqueakVM makefiles don't follow this convention in at
least a few cases. For example, in npsqueak/Makefile, several -I's are
included in CFLAGS, and when one does:
$ cd platforms/unix
$ make CFLAGS=-g
the compile of npsqueak.c fails because it can't find several include
files. If instead the -I's and -fPIC were moved to the actual compile
of npsqueak.c and npunix.c, then the convention works.
If you decide to do some Makefile editing, consider changing the
Makefiles to follow this convention, and submit a patch.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev