C.5. Editing "install_makefiles"

Assuming you have downloaded and unpacked the MB-System™ package, you will find the contents to include a perl script called install_makefiles. When properly configured, this script will rewrite the various "Makefile" files for proper compilation and installation of the software with the make utility.

Note

If you're not already somewhat familiar with the make utility this might all seem very confusing. From the make man page:

       The purpose of the make utility is
       to determine automatically which pieces of a large program need
       to be recompiled, and issue the commands to recompile
       them.

The make utility takes a file of instructions (called "Makefile" by default), as an argument. Information in this file provide detailed instructions for compiling portions or all of a software package, and often also includes instructions for installing the software or optionally removing installed software to prepare for a new compilation and install.

Several templates of these "Makefile" files exist in various parts of the source directory for MB-System™. Execution of the install_makefiles script simply rewrites these files to customize them for your installation.

It is best to copy the script to a new file and edit the new version. This allows one to keep a customized copy of your install_makefiles script that can be used with subsequent upgrades, usually without further editing.

cp install_makefiles install_makefiles.valslaptop

There is only a portion of the install_makefiles script that one should edit, and unfortunately, it is somewhat buried in the middle. Much of the front matter is commented out and provides several examples. The portion to edit is well marked and looks something like the following:

# **** EDIT THE PARAMETERS HERE ****
# Set the environment parameters:
$MBSYSTEM_HOME = "/usr/local/mbsystem/mbsystem5b31";
$OS = "LINUX";
$BYTESWAPPED = "YES";
$CC = "cc";
$GRAPHICAL = "YES";
$MOTIFINCDIR = "/usr/X11R6/LessTif/Motif1.2/include";
$MOTIFLIBS = "-L/usr/X11R6/LessTif/Motif1.2/lib -lXm -L/usr/X11R6/lib -lXt -lX11
";
$GMTVERSION = "3.4.2";
$GMTLIBDIR = "/usr/local/gmt/lib";
$GMTINCDIR = "/usr/local/gmt/include";
$NETCDFLIBDIR = "/usr/local/gmt/netcdf-3.5.0/lib";
$NETCDFINCDIR = "/usr/local/gmt/netcdf-3.5.0/include";
$LEVITUS = "$MBSYSTEM_HOME/share/LevitusAnnual.dat";
$PROJECTIONS = "$MBSYSTEM_HOME/share/Projections.dat";
$CFLAGS = "-g -w";
$LFLAGS = "-lm -L$NETCDFLIBDIR -lnetcdf";
#
# **** LEAVE EVERYTHING ELSE BELOW ALONE ****

A description of these parameters is included in the script and is reproduced here:

# The important parameters to be set are:
#       MBSYSTEM_HOME   Absolute path to the directory containing
#                               this file.
#       OS              Operating system (SUN, IRIX, LINUX, LYNX, 
#                               SOLARIS, HPUX, or OTHER).
#       BYTESWAPPED     If set to "YES" will enable byte swapping
#                               of input and output binary data.
#                               Otherwise byte swapping is disabled.
#                               Byte swapping needs to be enabled
#                               when installing on "little endian"
#                               machines such as PCs or VAXs.
#       CC              C compiler to be used (optional).
#       CFLAGS          Compile flags for C source files.
#       LFLAGS          Load flags for all object files.
#       GRAPHICAL       If set to "YES" will enable the installation
#                       of the Motif based graphical utilities mbedit,
#                       mbnavedit, and mbvelocitytool. If Motif 
#                       is not available but the nongraphical utilities 
#                       are desired then disable with "NO". 
#                       (optional, default is "YES")
#       MOTIFINCDIR     Location of Motif include files.
#       MOTIFLIBS       X and Motif libraries required for graphical tools.
#       GMTVERSION      Version of GMT to be used and linked with.
#                               The options are 3.0, 3.1, 3.2, or 3.3.
#                               The default is 3.3.
#       GMTLIBDIR       Location of GMT libraries libgmt.a and libpsl.a
#       GMTINCDIR       Location of GMT include files gmt.h, grd.h,
#                               and pslib.h
#       NETCDFLIBDIR    Location of NetCDF library libnetcdf.a
#       NETCDFINCDIR    Location of NetCDF include file netcdf.h
#       LEVITUS         Path for Levitus data file annual.

From the above, one can see that the parameters to be specified include compilation optimization options, paths for libraries to be linked, and references to installed software such as GMT, and NetCDF. Perhaps the most difficult details to get correct are the Motif libraries and compile flags (CFLAGS and LFLAGS). Look to the examples for guidance and write to the Dave, Dale or Val if you have questions.