#     The MB-system:	Makefile.template  3/7/2003
#	$Id: Makefile.template 1770 2009-10-19 17:16:39Z caress $
#
#     Copyright (c) 2003 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/mr1pr directory level
# The source code in src/mr1pr derives from and is copyright by
# the University of Hawaii.
# 
# Author:	Roger Davis, University of Hawaii (MR1PR library)
# Author:	D. W. Caress (MB-System implementation)
# Date:		March 7, 2003
#
# $Log: Makefile.template,v $
# Revision 5.4  2009/03/13 07:05:58  caress
# Release 5.1.2beta02
#
# Revision 5.3  2006/01/11 07:46:15  caress
# Working towards 5.0.8
#
# Revision 5.2  2003/07/27 20:50:15  caress
# Release 5.0.0
#
# Revision 5.1  2003/04/17 21:12:03  caress
# Release 5.0.beta30
#
# Revision 5.0  2003/03/11 19:09:14  caress
# Initial version.
#
#
#
#

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

# *** CHANGE THESE TO FIT YOUR LOCAL ENVIRONMENT ***
# 
# Compilers 
CC = cc 
#
# Compile and load flags:
CFLAGS = -O2
ARCHIVE = ar rcv
#
# *** LEAVE EVERYTHING ELSE BELOW ALONE ***

### make all makes the mbaux library and associated include files
all:	 $(INCDIR)/mr1pr.h \
	$(INCDIR)/mr1pr_defines.h \
	$(LIBDIR)/libmr1pr.a 

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

### put together the libraries
$(LIBDIR)/libmr1pr.a:	\
		io.o \
		iov1.o \
		misc.o \
		memalloc.o  
	$(ARCHIVE) $(LIBDIR)/libmr1pr.a \
		io.o \
		iov1.o \
		misc.o \
		memalloc.o  
	ranlib $(LIBDIR)/libmr1pr.a

### compile the source files
io.o:	io.c $(INCDIR)/mr1pr_defines.h
	$(CC) -c $(CFLAGS) io.c
iov1.o:	iov1.c $(INCDIR)/mr1pr_defines.h
	$(CC) -c $(CFLAGS) iov1.c
misc.o:	misc.c $(INCDIR)/mr1pr_defines.h $(INCDIR)/mem.h
	$(CC) -c $(CFLAGS) misc.c
memalloc.o:	memalloc.c $(INCDIR)/mr1pr_defines.h $(INCDIR)/mem.h
	$(CC) -c $(CFLAGS) memalloc.c

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