#     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 in the src/gmt directory level
# Author:	D. W. Caress
# Date:		May 23, 1994
#
# $Log: Makefile.template,v $
# Revision 5.4  2009/03/13 07:05:58  caress
# Release 5.1.2beta02
#
# Revision 5.3  2006/03/06 21:34:42  caress
# Changed libproj and libgsf to libmbproj and libmbgsf.
#
# Revision 5.2  2006/01/11 07:25:53  caress
# Working towards 5.0.8
#
# Revision 5.1  2004/10/18 03:50:51  caress
# Added libpsl to GMT related programs.
#
# Revision 5.0  2003/07/27 20:52:44  caress
# Release 5.0.0
#
# Revision 4.17  2003/03/10 07:39:29  caress
# Added mr1pr library.
#
# Revision 4.16  2002/07/20 20:44:07  caress
# Release 5.0.beta20
#
# Revision 4.15  2002/02/22 09:05:09  caress
# Release 5.0.beta13
#
# Revision 4.14  2001/06/30 17:35:20  caress
# Fixed problem with cc
#
# Revision 4.13  2001/03/22  21:03:31  caress
# Trying to make release 5.0.beta0.
#
# Revision 4.12  2000/09/30  07:19:12  caress
# Snapshot for Dale.
#
# Revision 4.11  2000/03/08  00:06:53  caress
# Release 4.6.10
#
# Revision 4.10  1998/10/29  20:54:29  caress
# Added chmod to copy of mb_contour.h
#
# Revision 4.9  1998/10/04  04:18:07  caress
# MB-System version 4.6beta
#
# Revision 4.8  1997/09/16  13:23:50  caress
# Fixed typos.
#
# Revision 4.7  1996/04/22  13:18:44  caress
# Now have DTR and MIN/MAX defines in mb_define.h
#
# Revision 4.6  1995/08/07  17:31:39  caress
# Moved to GMT V3.
#
# Revision 4.5  1995/06/22  17:32:25  caress
# Made mbswath.o dependent on mb_format.h
#
# Revision 4.4  1994/10/31  19:34:00  caress
# Changing man pages to .manl instead of .l to avoid make
# calling lex.
#
# Revision 4.3  1994/10/31  14:59:51  caress
# Changed man pages from section 1 to l
#
# Revision 4.2  1994/10/21  11:34:20  caress
# Release V4.0
#
# Revision 4.1  1994/06/13  20:18:05  caress
# Added make mbcontourfilter.o
#
# Revision 4.0  1994/05/24  02:31:58  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 = /ocean/mgg/gmt2/sun4/lib
GMTINCDIR = /ocean/mgg/gmt2/src
NETCDFINCDIR = /ocean/mgg/netcdf/include
#
# Compilers
CC = cc
#
# Compile and load flags:
CFLAGS = -O2
LFLAGS = -lm

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

### 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 macros and man pages
all:	$(BINDIR)/mbcontour \
	$(BINDIR)/mbswath \
	$(BINDIR)/mbgrdtiff 

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

### link or copy the executables
$(BINDIR)/mbcontour: mbcontour.o \
		$(LIBDIR)/libmbio.a  \
		$(PROJLIB) \
		$(GSFLIB) \
		$(LIBDIR)/libsapi.a  \
		$(LIBDIR)/libmr1pr.a  \
		$(LIBDIR)/libmbaux.a \
		$(LIBDIR)/libmbps.a
	$(CC) $(CFLAGS) mbcontour.o \
		$(LIBDIR)/libmbio.a \
		$(PROJLIB) \
		$(GSFLIB) \
		$(LIBDIR)/libsapi.a \
		$(LIBDIR)/libmr1pr.a  \
		$(LIBDIR)/libmbaux.a \
		$(LIBDIR)/libmbps.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a $(GMTLIBDIR)/libgmtps.a \
		$(LFLAGS) -o $(BINDIR)/mbcontour
$(BINDIR)/mbswath: mbswath.o \
		$(LIBDIR)/libmbio.a  \
		$(LIBDIR)/libmbaux.a \
		$(PROJLIB) \
		$(GSFLIB) \
		$(LIBDIR)/libsapi.a \
		$(LIBDIR)/libmr1pr.a
	$(CC) $(CFLAGS) mbswath.o \
		$(LIBDIR)/libmbio.a  \
		$(LIBDIR)/libmbaux.a \
		$(PROJLIB) \
		$(GSFLIB) \
		$(LIBDIR)/libsapi.a \
		$(LIBDIR)/libmr1pr.a  \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a $(GMTLIBDIR)/libgmtps.a \
		$(LFLAGS) -o $(BINDIR)/mbswath
$(BINDIR)/mbgrdtiff: mbgrdtiff.o \
		$(LIBDIR)/libmbio.a 
	$(CC) $(CFLAGS) mbgrdtiff.o \
		$(LIBDIR)/libmbio.a \
		$(GMTLIBDIR)/libgmt.a $(GMTLIBDIR)/libpsl.a $(GMTLIBDIR)/libgmtps.a \
		$(LFLAGS) -o $(BINDIR)/mbgrdtiff

### compile the source files
mbcontour.o:	mbcontour.c $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mb_aux.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) mbcontour.c
mbswath.o:	mbswath.c $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mb_format.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mbswath.c
mbgrdtiff.o:	mbgrdtiff.c $(INCDIR)/mb_status.h $(INCDIR)/mb_define.h $(INCDIR)/mb_format.h
	$(CC) -c $(CFLAGS) -I$(GMTINCDIR) -I$(NETCDFINCDIR) mbgrdtiff.c

