# ***************************************************************
#     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 methods used from optsrc/methods/
# updated for v1.5 JGOFS software clh, November 4, 1998
#
# mod 18 Mar 1999: clh
#    parametrize switches and dependencies,
#    use newer structure with routines in library and .h in include/
#
TOPLEVEL =  ../../
LIBDIR = ../lib/
INCDIR = ../include/
METHBINDIR  = ${TOPLEVEL}methods/
SRCDIR = ./
SWITCHES =	-DMYADDR='"${MYADDR}"' \
		-DOPTIONSERVER='"${OPTIONSERVER}"' \
		-DINFOSERVER='"${INFOSERVER}"' \
		-DDIRSERVER='"${DIRSERVER}"' \
		-DBUTTONIMAGESDIR='"${BUTTONIMAGESDIR}"'

DEPENDS =  ${INCDIR}outer.h \
	${SRCDIR}outer.c \
	${LIBDIR}jgofs.a \
	${INCDIR}default.h \
	${INCDIR}inner.h    

TODO = ${METHBINDIR}optdef    \
       ${SRCDIR}c2f.o         \
       ${METHBINDIR}optnm     \
       ${METHBINDIR}optrs

all: ${TODO}

#
# jgofs.a included on methods so that outer can get 
#	path_info_routines and outer_util
#

${METHBINDIR}optdef:${SRCDIR}def.c ${DEPENDS} 
	@-test -d ${METHBINDIR} || mkdir ${METHBINDIR}
	$(CC) ${CFLAGS} \
		${SWITCHES} \
		-DOPTIONS='"${INCDIR}default.h"' \
		-DINNEROPTIONS='"${INCDIR}inner.h"' \
		-I${INCDIR} \
	        ${SRCDIR}outer.c \
		${SRCDIR}def.c \
		${LIBDIR}jgofs.a -o $@

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

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

${SRCDIR}c2f.o:${SRCDIR}c2f.c
	${CC} -c ${SRCDIR}c2f.c

clean:
	-rm ${SRCDIR}def.o ${SRCDIR}nm.o ${SRCDIR}rs.o \
	${SRCDIR}outer.o  \
	${TODO}
