[GRASSLIST:4353] Re: .gislock woes & success

Glynn Clements glynn.clements at virgin.net
Wed Aug 21 18:17:33 EDT 2002


John Kodis wrote:

> > I don't think that it's possible to pass compiler options when running
> > gmake5. However, you can set options when running configure, by
> > setting various environment variables (e.g. CFLAGS, LDFLAGS), as in:
> > 
> > 	CFLAGS='-O2 -g -mcpu=athlon' ./configure ...
> 
> With most automake generated makefiles these flags can be altered at
> compile time as well.  Just use, for example:
> 
>  	make CFLAGS='-O2 -g -mcpu=athlon'

1. GRASS isn't normally compiled by invoking "make" directly;
compilation is performed by the "gmake5" script. AFAICT, gmake5 passes
"extra" (trailing) arguments to "make".

2. The effects of specifying CFLAGS at configure time and specifying
it at compile time differ.

The setting of CFLAGS at configure time determines the "base" setting,
which is reflected into the variable COMPILE_FLAGS in the makefile
fragments which are used to generate the actual makefiles.

The actual value of CFLAGS which is used at compile time includes a
number of other flags, as well as those from COMPILE_FLAGS:

CFLAGS      = -I$(INCLUDE_DIR) $(COMPILE_FLAGS) $(EXTRA_CFLAGS) $(USE_TERMIO)

Passing CFLAGS to "make" would override this definition, so any
setting would have to include all of the necessary flags.

This includes $(EXTRA_CFLAGS), which is set in individual Gmakefiles
to provide any extra flags which are necessary for that particular
module (e.g. a module which uses the PNG library will have
"EXTRA_CFLAGS=$(PNGINC)" so that the PNG headers can be located, etc).

3. There is an alternate build mechanism in the "mk" directory. 
Advantages include:

+ Closer to "conventional" build mechanisms.
+ May be easier to understand.
+ Allows the use of a separate build directory.
+ Can be used to build shared versions of the key libraries (Linux only).

Disadvantages include:

+ Not the "official" build mechanism.
+ Only works with GNU make, AFAIK.
+ Not as widely tested as "gmake5".

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-user mailing list