#     The MB-system:	Makefile.template  7/27/2003
#	$Id: Makefile.template 1862 2010-06-07 00:26:46Z caress $
#
#     Copyright (c) 2003-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/mbview directory level
# Author:	D. W. Caress
# Date:		August 31, 2002
#
# $Log: Makefile.template,v $
# Revision 5.13  2009/03/13 07:05:58  caress
# Release 5.1.2beta02
#
# Revision 5.12  2008/11/16 21:51:18  caress
# Updating all recent changes, including time lag analysis using mbeditviz and improvements to the mbgrid footprint gridding algorithm.
#
# Revision 5.11  2007/11/16 17:26:56  caress
# Progress on MBeditviz
#
# Revision 5.10  2007/10/08 16:32:08  caress
# Code status as of 8 October 2007.
#
# Revision 5.9  2007/06/17 23:27:30  caress
# Added NBeditviz.
#
# Revision 5.8  2006/12/15 21:42:49  caress
# Incremental CVS update.
#
# Revision 5.7  2006/04/11 19:17:04  caress
# Added a profile capability.
#
# Revision 5.6  2006/03/06 21:41:02  caress
# Changed libproj and libgsf to libmbproj and libmbgsf.
#
# Revision 5.5  2005/02/10 02:50:00  caress
# Removed mbeditviz and updated usage message for mbgrdviz.
#
# Revision 5.4  2005/02/02 08:23:52  caress
# Added lots of functionality to mbview.
#
# Revision 5.3  2004/12/02 06:36:32  caress
# Fixes while supporting Reson 7k data.
#
# Revision 5.1  2004/01/06 21:04:12  caress
# Added mbeditviz
#
# Revision 5.0  2003/12/02 20:20:35  caress
# Making version number 5.0
#
# Revision 1.2  2003/11/07 01:12:44  caress
# Added routes, sites, and nav. Also now calculates color and scaling for points only as needed.
#
# Revision 1.1  2003/09/23 21:22:00  caress
# Adding first cut on mbview to cvs.
#
#
### 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 = /sw/lib
GMTINCDIR = /sw/include
NETCDFINCDIR = /sw/include
#
# Locations of Motif include files and libraries:
MOTIFINCDIR = /sw/include
MOTIFLIBS = -L/sw/lib -L/usr/X11R6/lib -lXm -lXt -lX11
#
# Locations of OpenGL libraries:
OPENGLLIBS = -lGLU -lGL
#
# Compilers 
CC = cc 
#
# Compile and load flags:
CFLAGS = -g -I/usr/include/X11R6 -DDARWIN -DGMT3_3
LFLAGS = -lm -L/usr/local/netcdf/lib -lnetcdf
ARCHIVE = ar rcv

### 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 executable and man page
all: $(INCDIR)/mbview.h $(LIBDIR)/libmbview.a $(BINDIR)/mbgrdviz $(BINDIR)/mbeditviz

### make the library
$(LIBDIR)/libmbview.a:	MB3DView.o \
		MB3DSiteList.o\
		MB3DRouteList.o\
		MB3DNavList.o\
		mbview_callbacks.o\
		mbview_process.o \
		mbview_plot.o \
		mbview_primary.o \
		mbview_secondary.o \
		mbview_pick.o \
		mbview_profile.o \
		mbview_site.o \
		mbview_route.o\
		mbview_nav.o \
		mb_glwdrawa.o \
		Mb3dsdg.o \
		mb3dsoundings_callbacks.o \
		MBpedit.o \
		mbpingedit_callbacks.o
	$(ARCHIVE) $(LIBDIR)/libmbview.a \
		MB3DView.o \
		MB3DSiteList.o\
		MB3DRouteList.o\
		MB3DNavList.o\
		mbview_callbacks.o \
		mbview_process.o \
		mbview_plot.o \
		mbview_primary.o \
		mbview_secondary.o \
		mbview_pick.o \
		mbview_profile.o \
		mbview_site.o \
		mbview_route.o\
		mbview_nav.o \
		mb_glwdrawa.o \
		Mb3dsdg.o \
		mb3dsoundings_callbacks.o \
		MBpedit.o \
		mbpingedit_callbacks.o
	ranlib $(LIBDIR)/libmbview.a

### link the executables
$(BINDIR)/mbgrdviz: mbgrdviz_main.o \
		mbgrdviz_bxutils.o \
		mbgrdviz_callbacks.o \
		mbgrdviz_creation.o \
		$(LIBDIR)/libmbview.a \
		$(LIBDIR)/libmbio.a \
		$(LIBDIR)/libmbaux.a \
		$(PROJLIB) \
		$(LIBDIR)/libsapi.a \
		$(LIBDIR)/libmr1pr.a  \
		$(LIBDIR)/libmbps.a \
		$(LIBDIR)/libmbxgr.a \
		$(GSFLIB) \
		$(GMTLIBDIR)/libpsl.a
	$(CC) $(CFLAGS) mbgrdviz_main.o \
		mbgrdviz_bxutils.o \
		mbgrdviz_callbacks.o \
		mbgrdviz_creation.o \
		$(LIBDIR)/libmbview.a \
		$(LIBDIR)/libmbio.a \
		$(LIBDIR)/libmbaux.a \
		$(PROJLIB) \
		$(LIBDIR)/libsapi.a \
		$(LIBDIR)/libmr1pr.a  \
		$(LIBDIR)/libmbxgr.a \
		$(GSFLIB) \
		$(GMTLIBDIR)/libgmt.a \
		$(GMTLIBDIR)/libpsl.a \
		$(OPENGLLIBS) $(MOTIFLIBS) $(LFLAGS) -o $(BINDIR)/mbgrdviz
$(BINDIR)/mbeditviz: mbeditviz_main.o \
		mbeditviz_bxutils.o \
		mbeditviz_callbacks.o \
		mbeditviz_prog.o \
		mbeditviz_creation.o \
		$(LIBDIR)/libmbview.a \
		$(LIBDIR)/libmbio.a \
		$(LIBDIR)/libmbaux.a \
		$(PROJLIB) \
		$(LIBDIR)/libsapi.a \
		$(LIBDIR)/libmr1pr.a  \
		$(LIBDIR)/libmbps.a \
		$(LIBDIR)/libmbxgr.a \
		$(GSFLIB) \
		$(GMTLIBDIR)/libgmt.a \
		$(GMTLIBDIR)/libpsl.a
	$(CC) $(CFLAGS) mbeditviz_main.o \
		mbeditviz_bxutils.o \
		mbeditviz_callbacks.o \
		mbeditviz_prog.o \
		mbeditviz_creation.o \
		$(LIBDIR)/libmbview.a \
		$(LIBDIR)/libmbio.a \
		$(LIBDIR)/libmbaux.a \
		$(PROJLIB) \
		$(LIBDIR)/libsapi.a \
		$(LIBDIR)/libmr1pr.a  \
		$(LIBDIR)/libmbxgr.a \
		$(GSFLIB) \
		$(GMTLIBDIR)/libgmt.a \
		$(GMTLIBDIR)/libpsl.a \
		$(OPENGLLIBS) $(MOTIFLIBS) $(LFLAGS) -o $(BINDIR)/mbeditviz

### compile the source files
MB3DView.o: MB3DView.c MB3DView.h mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c MB3DView.c
MB3DSiteList.o: MB3DSiteList.c MB3DSiteList.h mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c MB3DSiteList.c
MB3DRouteList.o: MB3DRouteList.c MB3DRouteList.h mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c MB3DRouteList.c
MB3DNavList.o: MB3DNavList.c MB3DNavList.h mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c MB3DNavList.c
mbview_callbacks.o: mbview_callbacks.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_callbacks.c
mbview_process.o: mbview_process.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_process.c
mbview_plot.o: mbview_plot.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_plot.c
mbview_primary.o: mbview_primary.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_primary.c
mbview_secondary.o: mbview_secondary.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_secondary.c
mbview_pick.o: mbview_pick.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_pick.c
mbview_profile.o: mbview_profile.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_profile.c
mbview_site.o: mbview_site.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_site.c
mbview_route.o: mbview_route.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_route.c
mbview_nav.o: mbview_nav.c mbview.h mbviewprivate.h
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -c mbview_nav.c
mb_glwdrawa.o: mb_glwdrawa.c mb_glwdrawa.h mb_glwdrawap.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c mb_glwdrawa.c
mbgrdviz_bxutils.o: mbgrdviz_bxutils.c
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c mbgrdviz_bxutils.c
mbgrdviz_creation.o: mbgrdviz_creation.c mbgrdviz_creation.h 
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c mbgrdviz_creation.c
mbgrdviz_main.o: mbgrdviz_main.c mbview.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c mbgrdviz_main.c
mbgrdviz_callbacks.o: mbgrdviz_callbacks.c mbview.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -I$(NETCDFINCDIR) -I$(GMTINCDIR) -c mbgrdviz_callbacks.c
Mb3dsdg.o: Mb3dsdg.c Mb3dsdg.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -I$(NETCDFINCDIR) -I$(GMTINCDIR) -c Mb3dsdg.c
mb3dsoundings_callbacks.o: mb3dsoundings_callbacks.c Mb3dsdg.h mb3dsoundingsprivate.h 
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -I$(NETCDFINCDIR) -I$(GMTINCDIR) -c mb3dsoundings_callbacks.c
MBpedit.o: MBpedit.c MBpedit.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -I$(NETCDFINCDIR) -I$(GMTINCDIR) -c MBpedit.c
mbpingedit_callbacks.o: mbpingedit_callbacks.c Mb3dsdg.h mbpingeditprivate.h 
	$(CC) $(CFLAGS) -DMBVIEW_LIBRARY -I$(INCDIR) -I$(MOTIFINCDIR) -I$(NETCDFINCDIR) -I$(GMTINCDIR) -c mbpingedit_callbacks.c
mbeditviz_bxutils.o: mbeditviz_bxutils.c
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c mbeditviz_bxutils.c
mbeditviz_creation.o: mbeditviz_creation.c mbeditviz_creation.h 
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c mbeditviz_creation.c
mbeditviz_main.o: mbeditviz_main.c $(INCDIR)/mbview.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -c mbeditviz_main.c
mbeditviz_callbacks.o: mbeditviz_callbacks.c $(INCDIR)/mbview.h
	$(CC) $(CFLAGS) -I$(INCDIR) -I$(MOTIFINCDIR) -I$(NETCDFINCDIR) -I$(GMTINCDIR) -c mbeditviz_callbacks.c
mbeditviz_prog.o: mbeditviz_prog.c $(INCDIR)/mbview.h
	$(CC) $(CFLAGS)  -DMBEDITVIZ_DECLARE_GLOBALS -I$(INCDIR) -I$(MOTIFINCDIR) -I$(NETCDFINCDIR) -I$(GMTINCDIR) -c mbeditviz_prog.c

## copy the include files to the include file directory
$(INCDIR)/mbview.h:	mbview.h
	cp mbview.h $(INCDIR)/mbview.h
	chmod 664 $(INCDIR)/mbview.h

### copy the man page to the man page directory

clean: 
	rm -f *.o

