# /research/software/scorpion/documentation/compilehandler.htm

originally: http://www.oclc.org/research/software/scorpion/documentation/compilehandler.htm

# Compiling Scorpion

Before you begin

First, you must make sure that the following Makefiles have the correct values for some of their variables.

- handlers/Keep.Makefile
- handlers/Makefile.tmpl
- other/Keep.Makefile
- other/Makefile.tmpl
- src/Keep.Makefile
- src/Makefile.tmpl

There are only a few for each file, and they are clearly listed at the top.

Makefile distribution

Included with Scorpion is a home-built mechanism to ease Makefile distribution. The Perl script d_make.pl is the distribution "engine". It will look for a file called Makefile.tmpl in some directory and distribute this file to all subdirectories, renaming it Makefile and making a single modification to each copy. d_make.pl looks in Makefile.tmpl for a line matching `/^SUBDIRS=/` and then, for each directory, a list of its subdirectories is appended to this line. If there is a directory that requires a Makefile different from the template, it can be created and named Keep.Makefile. d_make.pl will use the unmodified contents of that file to create the Makefile in that directory.

d_make.pl will accept a directory on the command-line. It will look in this directory for Makefile.tmpl and begin the recursive distribution in that directory. If no directory is given, it will use `$ENV{PWD}`.

For instance, to compile the main Scorpion code, `cd` into the scorpion/ directory. Then run `d_make.pl src`. Alternatively, you could `cd` into the scorpion/src/ directory and then run `../d_make.pl`. They have the same effect. After running one of those commands, the Makefiles will have been distributed throughout the main Scorpion source tree. To run `make`, however, you'll have to be in the scorpion/src/ directory. Assuming the pears.jar, gwen.jar and Dbutils.jar are in scorpion/lib/, you'll be able to compile Scorpion.

Compiling your record set handler

It will probably be simplest if you create your source directory under the handlers/ directory. You can put your code in the ORG/ sub-directory, or you can create your own (com, edu, etc..). If you create your own, add it to the SUBDIRS line in handlers/Keep.Makefile. If your Record Set Handler has dependencies beyond scorpion.jar and Dbutils.jar, add them to the J_ARGS line of handlers/Makefile.tmpl and then run d_make.pl. After d_make.pl has been run, `cd` into the handlers directory and run `make jar` to compile the source and create a jar file.