#     The MB-system:	Makefile.template  1/12/98
#	$Id: Makefile.template 1985 2012-09-11 08:02:53Z caress $
#
#     Copyright (c) 1998-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/gsf directory level
# Author:	D. W. Caress
# Date:		January 12, 1998
#
# $Log: Makefile.template,v $
# Revision 5.1  2006/03/06 21:35:24  caress
# Changed libproj and libgsf to libmbproj and libmbgsf.
#
# Revision 5.0  2003/07/27 20:52:51  caress
# Release 5.0.0
#
# Revision 4.4  2002/04/06 02:50:59  caress
# Release 5.0.beta16
#
# Revision 4.3  2001/06/30 17:36:01  caress
# Fixed problem with cc.
#
# Revision 4.2  2000/09/30  07:19:33  caress
# Snapshot for Dale.
#
# Revision 4.1  1998/10/07  19:36:35  caress
# Added ranlib.
#
# Revision 4.0  1998/10/04  04:30:25  caress
# MB-System version 4.6beta
#
#
#

### 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 = -g -DIRIX
ARCHIVE = ar rcv
#
# *** LEAVE EVERYTHING ELSE BELOW ALONE ***

### make all makes the gsf library, man page, and associated include files
all:	$(LIBDIR)/libmbgsf.a \
	$(INCDIR)/gsf.h $(INCDIR)/gsf_ft.h \
	$(INCDIR)/gsf_enc.h $(INCDIR)/gsf_dec.h \
	$(BINDIR)/dump_gsf

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

### link the executables
$(BINDIR)/dump_gsf:	dump_gsf.o $(LIBDIR)/libmbgsf.a
	$(CC) $(CFLAGS) dump_gsf.o $(LIBDIR)/libmbgsf.a $(LFLAGS) \
		-o $(BINDIR)/dump_gsf

### put together the library
$(LIBDIR)/libmbgsf.a:	gsf.o gsf_dec.o gsf_enc.o gsf_indx.o gsf_info.o
	$(ARCHIVE) $(LIBDIR)/libmbgsf.a \
		gsf.o gsf_dec.o gsf_enc.o gsf_indx.o gsf_info.o
	ranlib $(LIBDIR)/libmbgsf.a

### compile the source files
gsf.o:      gsf.c $(INCDIR)/gsf.h gsf_dec.h gsf_enc.h gsf_ft.h gsf_indx.h
	$(CC) -c $(CFLAGS) gsf.c
gsf_dec.o:  gsf_dec.c $(INCDIR)/gsf.h gsf_dec.h gsf_enc.h gsf_ft.h gsf_indx.h
	$(CC) -c $(CFLAGS) gsf_dec.c
gsf_enc.o:  gsf_enc.c $(INCDIR)/gsf.h gsf_dec.h gsf_enc.h gsf_ft.h gsf_indx.h
	$(CC) -c $(CFLAGS) gsf_enc.c
gsf_indx.o: gsf_indx.c $(INCDIR)/gsf.h gsf_dec.h gsf_enc.h gsf_ft.h gsf_indx.h
	$(CC) -c $(CFLAGS) gsf_indx.c
gsf_info.o: gsf_info.c $(INCDIR)/gsf.h gsf_dec.h gsf_enc.h gsf_ft.h gsf_indx.h
	$(CC) -c $(CFLAGS) gsf_info.c
dump_gsf.o:	dump_gsf.c $(INCDIR)/gsf.h gsf_dec.h gsf_enc.h gsf_ft.h gsf_indx.h
	$(CC) -c $(CFLAGS) dump_gsf.c

### copy the include files to the include file directory
$(INCDIR)/gsf.h:	gsf.h
	cp gsf.h $(INCDIR)/gsf.h
	chmod 664 $(INCDIR)/gsf.h
$(INCDIR)/gsf_ft.h:	gsf_ft.h
	cp gsf_ft.h $(INCDIR)/gsf_ft.h
	chmod 664 $(INCDIR)/gsf_ft.h
$(INCDIR)/gsf_enc.h:	gsf_enc.h
	cp gsf_enc.h $(INCDIR)/gsf_enc.h
	chmod 664 $(INCDIR)/gsf_enc.h
$(INCDIR)/gsf_dec.h:	gsf_dec.h
	cp gsf_dec.h $(INCDIR)/gsf_dec.h
	chmod 664 $(INCDIR)/gsf_dec.h
