<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Michael van der Gulik wrote:
<blockquote
 cite="mid:1b61adf40903240130k1620931cpc6b4ce5e41ccec25@mail.gmail.com"
 type="cite">
  <pre wrap=""> 
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)?
  </pre>
</blockquote>
<br>
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.&nbsp;&nbsp; If this convention is followed then one can do:<br>
<blockquote>$ make CFLAGS=-g whatever<br>
</blockquote>
That is, CFLAGS is set on the Make command line.&nbsp; 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. &nbsp;
Unfortunately, the SqueakVM makefiles don't follow this convention in
at least a few cases.&nbsp;&nbsp; For example, in npsqueak/Makefile, several -I's
are included in&nbsp; CFLAGS, and when one does:<br>
<blockquote>$ cd platforms/unix<br>
$ make CFLAGS=-g<br>
</blockquote>
the compile of npsqueak.c fails because it can't find several include
files.&nbsp; If instead the -I's and -fPIC were moved to the actual compile
of npsqueak.c and npunix.c, then the convention works.<br>
<br>
If you decide to do some Makefile editing, consider changing the
Makefiles to follow this convention, and submit a patch.&nbsp; <br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-gavin...<br>
</body>
</html>