#     The MB-system:	Makefile.template  5/23/94
#	$Id: Makefile.template 1862 2010-06-07 00:26:46Z caress $
#
#     Copyright (c) 1993-2009 by
#     David W. Caress (caress@mbari.org)
#       Monterey Bay Aquarium Research Institute
#       Moss Landing, CA 95039
#     and Dale N. Chayes (dale@ldeo.columbia.edu)
#       Lamont-Doherty Earth Observatory
#       Palisades, NY  10964
#
#     See README file for copying and redistribution conditions.
#
# Makefile template for MB-system at the src/utilities directory level
# Author:	D. W. Caress
# Date:		May 23, 1994
#
# $Log: Makefile.template,v $
# Revision 5.32  2009/03/13 07:05:58  caress
# Release 5.1.2beta02
#
# Revision 5.31  2009/03/02 18:54:40  caress
# Fixed pixel size problems with mbmosaic, resurrected program mbfilter, and also updated copyright dates in several source files.
#
# Revision 5.30  2008/12/31 08:47:38  caress
# Updates towards release 5.1.1
#
# Revision 5.29  2008/09/20 00:57:41  caress
# Release 5.1.1beta23
#
# Revision 5.28  2008/07/10 18:16:33  caress
# Proceeding towards 5.1.1beta20.
#
# Revision 5.26  2008/05/13 20:23:56  caress
# Added mbabsorption.
#
# Revision 5.25  2008/02/12 02:49:51  caress
# Added new program mbabsorption.
#
# Revision 5.24  2007/10/08 16:48:07  caress
# State of the code on 8 October 2007.
#
# Revision 5.23  2006/09/11 18:55:53  caress
# Changes during Western Flyer and Thomas Thompson cruises, August-September
# 2006.
#
# Revision 5.22  2006/03/06 21:42:34  caress
# Changed libproj and libgsf to libmbproj and libmbgsf.
#
# Revision 5.21  2006/02/03 21:10:39  caress
# Working on supporting water column datagrams in Simrad formats.
#
# Revision 5.20  2006/01/18 15:16:06  caress
# Had to link some programs with both gmtlib and pslib to work with GMT 4.1.
#
# Revision 5.19  2006/01/06 18:19:58  caress
# Working towards 5.0.8
#
# Revision 5.18  2005/11/05 01:07:54  caress
# Programs changed to register arrays through mb_register_array() rather than allocating the memory directly with mb_realloc() or mb_malloc().
#
# Revision 5.17  2005/06/04 06:32:07  caress
# Added program mb7k2jstar.
#
# Revision 5.16  2004/12/02 06:39:28  caress
# Fixes while supporting Reson 7k data.
#
# Revision 5.15  2004/10/18 03:37:49  caress
# Added libpsl to GMT related programs.
#
# Revision 5.14  2004/10/06 19:10:51  caress
# Release 5.0.5 update.
#
# Revision 5.13  2004/06/18 04:08:41  caress
# Adding support for segy i/o and working on support for Reson 7k format 88.
#
# Revision 5.12  2004/05/21 23:51:19  caress
# Progress supporting Reson 7k data, including support for extracing subbottom profiler data.
#
# Revision 5.11  2003/07/27 20:50:28  caress
# Release 5.0.0
#
# Revision 5.10  2003/03/10 20:01:59  caress
# Added mr1pr library.
#
# Revision 5.9  2002/09/19 00:28:12  caress
# Release 5.0.beta23
#
# Revision 5.8  2002/08/21 00:57:11  caress
# Release 5.0.beta22
#
# Revision 5.7  2002/07/20 20:56:55  caress
# Release 5.0.beta20
#
# Revision 5.6  2002/05/02 04:01:37  caress
# Release 5.0.beta17
#
# Revision 5.5  2002/02/22 09:07:08  caress
# Release 5.0.beta13
#
# Revision 5.4  2001/11/15 22:58:02  caress
# Reordered program building.
#
# Revision 5.3  2001/10/12  21:08:10  caress
# Added mbdatalist
#
# Revision 5.2  2001/06/29  22:50:23  caress
# Atlas Hydrosweep DS2 raw data and SURF data formats.
#
# Revision 5.1  2001/03/22  21:14:16  caress
# Trying to make release 5.0.beta0.
#
# Revision 5.0  2001/01/22  08:07:07  caress
# Version 5.0.beta01
#
# Revision 4.21  2000/12/10  20:30:44  caress
# Version 5.0.alpha02
#
# Revision 4.20  2000/09/30  07:22:17  caress
# Snapshot for Dale.
#
# Revision 4.19  2000/03/08  00:06:36  caress
# Release 4.6.10
#
# Revision 4.18  1999/12/29  00:35:11  caress
# Release 4.6.8
#
# Revision 4.17  1998/12/17  22:52:10  caress
# MB-System version 4.6beta4
#
# Revision 4.16  1998/10/05 19:19:24  caress
# MB-System version 4.6beta
#
# Revision 4.15  1997/09/17  19:21:33  caress
# Removed hsbath.
#
# Revision 4.14  1997/09/12  18:54:47  caress
# Moved mb_rt.c to src/mbrt directory.
#
# Revision 4.13  1997/04/21  17:19:14  caress
# MB-System 4.5 Beta Release.
#
# Revision 4.13  1997/04/17  15:14:38  caress
# MB-System 4.5 Beta Release
#
# Revision 4.12  1996/04/22  13:23:05  caress
# Now have DTR and MIN/MAX defines in mb_define.h
#
# Revision 4.11  1995/08/07  17:39:23  caress
# Moved to GMT 3
#
# Revision 4.10  1995/04/25  20:03:07  caress
# Replaced surfunc.c with zgrid.c
#
# Revision 4.9  1995/03/23  16:29:34  caress
# Added -Olimit flag for compiling mbgrid.c under IRIX
#
# Revision 4.8  1995/02/14  21:20:26  caress
# Added new sidescan processing programs.
#
# Revision 4.7  1995/01/04  17:08:14  caress
# Added mbhistogram
#
# Revision 4.6  1994/11/21  20:40:18  caress
# Fixed mblevitus target so changing Makefile causes remake
# of mblevitus.
#
# Revision 4.5  1994/11/21  19:05:43  caress
# Added mb_rt for gradient raytracing with mbbath.
#
# Revision 4.4  1994/10/31  20:24:03  caress
# Change man pages from section 1 to l.
#
# Revision 4.3  1994/10/31  20:17:32  caress
# Change man pages from section 1 to l.
#
# Revision 4.2  1994/10/31  18:47:28  caress
# Changed man pages from section 1 to section l.
#
# Revision 4.1  1994/10/21  13:03:49  caress
# Release V4.0
#
# Revision 4.0  1994/05/24  02:34:15  caress
# First cut.
#
#

### sets locations of vital objects
BINDIR = ../../bin
LIBDIR = ../../lib
INCDIR = ../../include

# *** CHANGE THESE TO FIT YOUR LOCAL ENVIRONMENT ***
#
# Locations of GMT libraries, binaries, and include files:
GMTLIBDIR = /usr/local/mbsystem/lib
GMTINCDIR = /usr/local/gmt/src
NETCDFINCDIR = /usr/local/netcdf/include
#
# Locations of FFTW libraries, binaries, and include files:
FFTWLIBDIR = /usr/local/fftw/lib
FFTWINCDIR = /usr/local/fftw/include
#
# Location of Levitus annual database file
LEVITUS = /usr/local/mbsystem/share/Levitus82.dat
# 
# Compilers 
CC = cc 
#
# Compile and load flags:
CFLAGS = -O2
LFLAGS = -lm
BIGFLAG = -Olimit 2000

### set gsflib - could be version supplied with MB-System or other installation
GSFLIB  = $(LIBDIR)/libmbgsf.a
GSFINCDIR  = $(INCDIR)

### set projlib - could be version supplied with MB-System or other installation
PROJLIB  = $(LIBDIR)/libmbproj.a
#
# *** LEAVE EVERYTHING ELSE BELOW ALONE ***

### make all makes the MB-system utilites and man pages
all:	$(BINDIR)/mbformat \
	$(BINDIR)/mbdefaults \
	$(BINDIR)/mbdatalist \
	$(BINDIR)/mbinfo \
	$(BINDIR)/mbset \
	$(BINDIR)/mbprocess \
	$(BINDIR)/mbcopy \
	$(BINDIR)/mblist \
	$(BINDIR)/mbnavlist \
	$(BINDIR)/mbsvplist \
	$(BINDIR)/mbbackangle \
	$(BINDIR)/mbclean \
	$(BINDIR)/mbareaclean \
	$(BINDIR)/mbhistogram \
	$(BINDIR)/mbgrid \
	$(BINDIR)/mbmosaic \
	$(BINDIR)/mblevitus \
	$(BINDIR)/mbrollbias \
	$(BINDIR)/mbextractsegy \
	$(BINDIR)/mbsegylist \
	$(BINDIR)/mbsegyinfo \
	$(BINDIR)/mbsegygrid \
	$(BINDIR)/mbsegypsd \
	$(BINDIR)/mbauvnavusbl \
	$(BINDIR)/mbgetesf \
	$(BINDIR)/mbneptune2esf \
	$(BINDIR)/mbps \
	$(BINDIR)/mbstripnan \
	$(BINDIR)/mbrollbias \
	$(BINDIR)/mb7k2jstar \
	$(BINDIR)/mb7kpreprocess \
	$(BINDIR)/mbrolltimelag	\
	$(BINDIR)/mbauvloglist\
	$(BINDIR)/mb7k2ss \
	$(BINDIR)/mbabsorption \
	$(BINDIR)/mbdumpesf\
	$(BINDIR)/mbtime \
	$(BINDIR)/mbctdlist \
	$(BINDIR)/mbfilter \
	$(BINDIR)/mbroutetime \
	$(BINDIR)/mbsm20002gsf

### make clean removes the object files
clean:
	rm -f *.o

### link the executables
$(BINDIR)/mbformat:	mbformat.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbformat.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbformat
$(BINDIR)/mbdefaults:	mbdefaults.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbdefaults.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbdefaults
$(BINDIR)/mbdatalist:	mbdatalist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbdatalist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbdatalist
$(BINDIR)/mbinfo:	mbinfo.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbinfo.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbinfo
$(BINDIR)/mbcopy:	mbcopy.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbcopy.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbcopy
$(BINDIR)/mblist:	mblist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mblist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mblist
$(BINDIR)/mbclean:	mbclean.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbclean.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbclean
$(BINDIR)/mbareaclean:	mbareaclean.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbareaclean.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbareaclean
$(BINDIR)/mbgrid:	mbgrid.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbgrid.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a \
		$(LFLAGS) -o $(BINDIR)/mbgrid
$(BINDIR)/mbmosaic:	mbmosaic.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbmosaic.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a \
		$(LFLAGS) -o $(BINDIR)/mbmosaic
$(BINDIR)/mblevitus:	mblevitus.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mblevitus.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mblevitus
$(BINDIR)/mbrollbias:	mbrollbias.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbrollbias.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbrollbias
$(BINDIR)/mbgetesf:	mbgetesf.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbgetesf.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbgetesf
$(BINDIR)/mbneptune2esf:	mbneptune2esf.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbneptune2esf.o $(LIBDIR)/libmbio.a $(LFLAGS) $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a $(LFLAGS) \
		-o $(BINDIR)/mbneptune2esf
$(BINDIR)/mbps:	mbps.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbps.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a $(GMTLIBDIR)/libgmtps.a \
		$(LFLAGS) -o $(BINDIR)/mbps
$(BINDIR)/mbstripnan:	mbstripnan.o
	$(CC) $(CFLAGS) mbstripnan.o $(LFLAGS) -o $(BINDIR)/mbstripnan
$(BINDIR)/mbhistogram:	mbhistogram.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbhistogram.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mbhistogram
$(BINDIR)/mbbackangle:	mbbackangle.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a 
	$(CC) $(CFLAGS) mbbackangle.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a \
		$(LFLAGS) -o $(BINDIR)/mbbackangle
$(BINDIR)/mbnavlist:	mbnavlist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbnavlist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mbnavlist
$(BINDIR)/mbsvplist:	mbsvplist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbsvplist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mbsvplist
$(BINDIR)/mbset:	mbset.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbset.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mbset
$(BINDIR)/mbprocess:	mbprocess.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbprocess.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a \
		$(LFLAGS) -o $(BINDIR)/mbprocess
$(BINDIR)/mbextractsegy:	mbextractsegy.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbextractsegy.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mbextractsegy
$(BINDIR)/mbsegylist:	mbsegylist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbsegylist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mbsegylist
$(BINDIR)/mbsegyinfo:	mbsegyinfo.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbsegyinfo.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mbsegyinfo
$(BINDIR)/mbsegygrid:	mbsegygrid.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbsegygrid.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a \
		$(LFLAGS) -o $(BINDIR)/mbsegygrid
$(BINDIR)/mbauvnavusbl:	mbauvnavusbl.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbauvnavusbl.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mbauvnavusbl
$(BINDIR)/mb7k2jstar:	mb7k2jstar.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mb7k2jstar.o $(LIBDIR)/libmbio.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a $(LIBDIR)/libmbaux.a \
		$(LFLAGS) -o $(BINDIR)/mb7k2jstar
$(BINDIR)/mb7kpreprocess:	mb7kpreprocess.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a
	$(CC) $(CFLAGS) mb7kpreprocess.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(LFLAGS) -o $(BINDIR)/mb7kpreprocess
$(BINDIR)/mbrolltimelag:	mbrolltimelag.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a
	$(CC) $(CFLAGS) mbrolltimelag.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(LFLAGS) -o $(BINDIR)/mbrolltimelag
$(BINDIR)/mbauvloglist:	mbauvloglist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a
	$(CC) $(CFLAGS) mbauvloglist.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(LFLAGS) -o $(BINDIR)/mbauvloglist
$(BINDIR)/mb7k2ss:	mb7k2ss.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a
	$(CC) $(CFLAGS) mb7k2ss.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(GMTLIBDIR)/libgmt.a \
		$(LFLAGS) -o $(BINDIR)/mb7k2ss
$(BINDIR)/mbabsorption:	mbabsorption.o $(LIBDIR)/libmbio.a
	$(CC) $(CFLAGS) mbabsorption.o $(LIBDIR)/libmbio.a \
		$(LFLAGS) -o $(BINDIR)/mbabsorption
$(BINDIR)/mbdumpesf:	mbdumpesf.o $(LIBDIR)/libmbio.a
	$(CC) $(CFLAGS) mbdumpesf.o $(LIBDIR)/libmbio.a \
		$(LFLAGS) -o $(BINDIR)/mbdumpesf
$(BINDIR)/mbtime:	mbtime.o $(LIBDIR)/libmbio.a
	$(CC) $(CFLAGS) mbtime.o $(LIBDIR)/libmbio.a \
		$(LFLAGS) -o $(BINDIR)/mbtime
$(BINDIR)/mbctdlist:	mbctdlist.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a
	$(CC) $(CFLAGS) mbctdlist.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(LFLAGS) -o $(BINDIR)/mbctdlist
$(BINDIR)/mbfilter:	mbfilter.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a
	$(CC) $(CFLAGS) mbfilter.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(LFLAGS) -o $(BINDIR)/mbfilter
$(BINDIR)/mbroutetime:	mbroutetime.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a
	$(CC) $(CFLAGS) mbroutetime.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(LFLAGS) -o $(BINDIR)/mbroutetime
$(BINDIR)/mbsm20002gsf:	mbsm20002gsf.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a
	$(CC) $(CFLAGS) mbsm20002gsf.o $(LIBDIR)/libmbio.a $(LIBDIR)/libmbaux.a $(PROJLIB) $(GSFLIB) $(LIBDIR)/libmr1pr.a $(LIBDIR)/libsapi.a \
		$(LFLAGS) -o $(BINDIR)/mbsm20002gsf
$(BINDIR)/mbsegypsd:	mbsegypsd.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbsegypsd.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a $(FFTWLIBDIR)/libfftw3.a \
		$(LFLAGS) -o $(BINDIR)/mbsegypsd
$(BINDIR)/mbprofilepsd:	mbprofilepsd.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a
	$(CC) $(CFLAGS) mbprofilepsd.o $(LIBDIR)/libmbio.a $(PROJLIB) $(LIBDIR)/libmbaux.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a $(FFTWLIBDIR)/libfftw3.a \
		$(LFLAGS) -o $(BINDIR)/mbprofilepsd

### compile the source files
mbformat.o:	mbformat.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbformat.c
mbdefaults.o:	mbdefaults.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbdefaults.c
mbdatalist.o:	mbdatalist.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbdatalist.c
mbinfo.o:	mbinfo.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbinfo.c
mbcopy.o:	mbcopy.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) -I$(GSFINCDIR) mbcopy.c
mblist.o:	mblist.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mbsys_simrad2.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) mblist.c
mbclean.o:	mbclean.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbclean.c
mbareaclean.o:	mbareaclean.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbareaclean.c
mbgrid.o:	mbgrid.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) $(BIGFLAG) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mbgrid.c
mbmosaic.o:	mbmosaic.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) $(BIGFLAG) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mbmosaic.c
mblevitus.o:	mblevitus.c $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h Makefile
	echo "	char *ifile = "'"$(LEVITUS)"'";" > levitus.h
	$(CC) -c $(CFLAGS) mblevitus.c
mbrollbias.o:	mbrollbias.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbrollbias.c
mbgetesf.o:	mbgetesf.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbgetesf.c
mbneptune2esf.o:	mbneptune2esf.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbneptune2esf.c
mbps.o:	mbps.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mbps.c
mbstripnan.o:	mbstripnan.c 
	$(CC) -c $(CFLAGS) mbstripnan.c
mbhistogram.o:	mbhistogram.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) mbhistogram.c
mbbackangle.o:	mbbackangle.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mbbackangle.c
mbnavlist.o:	mbnavlist.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbnavlist.c
mbsvplist.o:	mbsvplist.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbsvplist.c
mbset.o:	mbset.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbset.c
mbprocess.o:	mbprocess.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mbprocess.c
mbextractsegy.o:	mbextractsegy.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mb_segy.h
	$(CC) -c $(CFLAGS) mbextractsegy.c
mbsegylist.o:	mbsegylist.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mb_segy.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) mbsegylist.c
mbsegyinfo.o:	mbsegyinfo.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mb_segy.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) mbsegyinfo.c
mbsegygrid.o:	mbsegygrid.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mb_segy.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mbsegygrid.c
mbauvnavusbl.o:	mbauvnavusbl.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbauvnavusbl.c
mb7k2jstar.o:	mb7k2jstar.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mbsys_reson7k.h $(INCDIR)/mbsys_jstar.h
	$(CC) -c $(CFLAGS) mb7k2jstar.c
mb7kpreprocess.o:	mb7kpreprocess.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mbsys_reson7k.h $(INCDIR)/mbsys_jstar.h
	$(CC) -c $(CFLAGS) mb7kpreprocess.c
mbrolltimelag.o:	mbrolltimelag.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbrolltimelag.c
mbauvloglist.o:	mbauvloglist.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbauvloglist.c
mb7k2ss.o:	mb7k2ss.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mbsys_reson7k.h $(INCDIR)/mbsys_ldeoih.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mb7k2ss.c
mbabsorption.o:	mbabsorption.c $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbabsorption.c
mbdumpesf.o:	mbdumpesf.c $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbdumpesf.c
mbtime.o:	mbtime.c $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbtime.c
mbctdlist.o:	mbctdlist.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbctdlist.c
mbfilter.o:	mbfilter.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbfilter.c
mbroutetime.o:	mbroutetime.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbroutetime.c
mbsm20002gsf.o:	mbsm20002gsf.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) mbsm20002gsf.c
mbsegypsd.o:	mbsegypsd.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mb_segy.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) -I$(FFTWINCDIR) mbsegypsd.c
mbprofilepsd.o:	mbprofilepsd.c $(INCDIR)/mb_format.h $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) -I$(FFTWINCDIR) mbprofilepsd.c
