[GRASS-user] Problems compiling legacy add-on module under GRASS-5.4.1

Oops, trying again from the correct address:

Begin forwarded message:

From: Scott W Mitchell <Scott_Mitchell@carleton.ca>
Date: 27 July 2007 18:27:22 GMT-04:00
To: grassuser@grass.itc.it
Subject: Problems compiling legacy add-on module under GRASS-5.4.1

I've been sent some legacy code that is used to prepare data for an ecohydrological model, and while one of the utilities has been updated to use makefiles, the other one ("rat", short for r.average.tables) has a Gmakefile, and counts on gmake for compiling.

I am trying to move the tools to a different machine, and thought I'd use the new 5.4.1 release for this. I got these tools working on a Linux box at some point, but that was a long time ago, on who-knows-what release of GRASS 5.x.

I've successfully built the stock 5.4.1 using the separate build directory methodology.

For the next step, I THINK I've interpreted the "building other modules" instructions correctly, but hopefully if I've done something wrong someone can steer me right.

I've copied the subdirectory with the code in question in to ~/src/grass-5.4.1/src.contrib/AverageTables

I cd into by grass541build directory, and try
./gmake54 src.contrib/AverageTables

but I get:
make: *** No rule to make target `dir'. Stop.

Do I need to edit the Gmakefile to get it compatible with the "new" build mechanism?

Here's the Gmakefile:

PGM = rat
CC = gcc

OBJECTS = \
main.o \
log.o

$(PGM): $(OBJECTS)
        $(CC) $(OBJECTS) -I $(GISBASE)/include -o $(PGM) $(GISLIB) $(XDRLIB) -lm

main.o:
log.o:

clean:
        rm -f $(OBJECTS)

clobber:
        rm -f $(OBJECTS) $(PGM)

Thanks!
Scott

On Sat, 28 Jul 2007, Scott Mitchell wrote:

[...]

For the next step, I THINK I've interpreted the "building other modules" instructions correctly, but hopefully if I've done something wrong someone can steer me right.

I've copied the subdirectory with the code in question in to ~/src/ grass-5.4.1/src.contrib/AverageTables

I cd into by grass541build directory, and try
./gmake54 src.contrib/AverageTables

but I get:
make: *** No rule to make target `dir'. Stop.

Do I need to edit the Gmakefile to get it compatible with the "new" build mechanism?

Yes; it is done automatically by the "make makefiles" step when you first run make with the alternate build system. But you should be able to run it yourself as (from alternate build directory):

make ~/src/grass-5.4.1/src.contrib/AverageTables/makefile

(Note the lower case m in makefile) and that should automatically convert Gmakefile to makefile and the gmake54 script should then work.

Paul