[GRASS5] modifying? gmake rules for c++ code
N.J. Hardebol
harj at geo.vu.nl
Mon Jul 14 16:51:12 EDT 2003
Hello,
In the mail of 4-7 Glynn Clements explained me that a Grass Module can be
most easily made by compiling it within the grass source tree. He also
mentioned that c++ source files possibly offer problems since the grass
build mechanism doe currently not handlee c++. Gcc/g++ will probably work
since no differnece in c & c++ compilers.
lynn Clements Wrote
> typically you would add your code to the GRASS source tree, along with
> a Gmakefile; that way, all of the relevant make variables will be
> defined. However, the GRASS build mechanism currently doesn't handle
> C++ (at least, not in 5.0.2; the CVS HEAD version has some C++
> support, but it isn't guaranteed; it probably won't work if your C++
> compiler is significantly different to your C compiler, although
> gcc/g++ will probably work).
> The easiest way to get the Gmakefile correct is to copy one from
> another module which uses the same libraries (i.e. if you are using
> g3d, copy the Gmakefile from a module which uses g3d).
I've done this with some good results, it relative easy to compile new
modules by simple modifactions of makefiles.
However at the moment I'm trying to compile a geophysical routine that uses
several g3d functions and some problems with compiling the c++ source within
the grass tree arises.
We have tried to setup a make-rule to compile cpp files within the grass
source tree.
I have found the rules to compile *.f and *.c files in the gmake.sh script
located in grass5.0.2/src/CMD/generic/
Obviously the section between lines 268-306 needs to be expanded with the
rule to compile a *.cpp file.
The rule is considered to be rougly the same as for *.c files, however with
additional flag "-XC++".
However we don't fully comprehend the lines 282-284 that uses the sed and
awk commands, which seem to filter out the *.f and *.c files based on their
suffix.
Could anybody please indicate how these lines have to be changed, so that
also object files can be build from *.cpp files.
Or has anybody modified the gmake5 gmake.sh rules to compile *.cpp source
code.
Best regards,
Nico
_______________________________________________
grass5 mailing list
grass5 at grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5
More information about the grass-dev
mailing list