# ***************************************************************
#     Remember to source opt-build-env first, if you are building 
#  any sub-set of these files outside of toplevel opt-build procedure 
# ***************************************************************
#
# makefile for JGOFS OPTIONSERVER methods used from methods/
# updated for v1.5 JGOFS software clh, November 4, 1998
#
#
#               ${METHBINDIR}optdyn   \
#${METHBINDIR}dyn:dyn.o outer.o svan.o ${LIBDIR}jgofs.a
#	$(CC) dyn.o outer.o ${LIBDIR}jgofs.a  svan.o -lm  -o $@
#dyn.o:dyn.c
#svan.o:svan.c
#
TOPLEVEL =  ../../
LIBDIR = ../lib/
INCDIR = ../include/
METHBINDIR  = ${TOPLEVEL}methods/
OUTERSRCDIR = ../methods/
SRCDIR = ./
SWITCHES =	-DMYADDR='"${MYADDR}"' \
		-DOPTIONSERVER='"${OPTIONSERVER}"' \
		-DINFOSERVER='"${INFOSERVER}"' \
		-DDIRSERVER='"${DIRSERVER}"' \
		-DBUTTONIMAGESDIR='"${BUTTONIMAGESDIR}"'
#
# make outer.o in this directory for all targets to use
#
TODO = ${METHBINDIR}optmap    \
       ${METHBINDIR}coastline \
       ${METHBINDIR}grid      \
       ${SRCDIR}outer.o

all: ${TODO}

${METHBINDIR}optmap:${SRCDIR}map.o \
			${SRCDIR}remap.o \
			${SRCDIR}outer.o \
			${LIBDIR}jgofs.a
	$(CC)   ${SRCDIR}map.o \
		${SRCDIR}remap.o \
		${SRCDIR}outer.o \
		${LIBDIR}jgofs.a -lm -o $@

${SRCDIR}map.o:${SRCDIR}map.c
	$(CC) -c -DOPTIONS='"${INCDIR}default.h"'  \
		 -DINNEROPTIONS='"${INCDIR}inner.h"' \
		 -I${INCDIR} \
		 ${SRCDIR}map.c
	
${SRCDIR}remap.o:${SRCDIR}remap.c

${METHBINDIR}coastline:${SRCDIR}coast.o \
		${SRCDIR}outer.o \
		${LIBDIR}jgofs.a
	$(CC) ${SRCDIR}coast.o \
		${SRCDIR}outer.o \
		${LIBDIR}jgofs.a -o $@
${SRCDIR}coast.o:${SRCDIR}coast.c

${METHBINDIR}grid: ${SRCDIR}grid.o
	$(CC) ${SRCDIR}grid.o -o $@
${SRCDIR}grid.o:${SRCDIR}grid.c

${SRCDIR}outer.o: ${OUTERSRCDIR}outer.c \
		${INCDIR}outer.h \
		${INCDIR}default.h
	$(CC) ${CFLAGS} -c \
		-DOPTIONS='"${INCDIR}default.h"' \
		-I${INCDIR} \
		${SWITCHES} \
		${OUTERSRCDIR}outer.c \
		${LIBDIR}jgofs.a -o $@

clean:
	-rm ${SRCDIR}map.o     \
	    ${SRCDIR}remap.o   \
	    ${SRCDIR}coast.o   \
	    ${SRCDIR}grid.o    \
	${TODO}
