# makefile.stats  30 Dec 99.  WJS
#
#  15 Apr 00.  Add SYSLIB.  WJS
#
# Assumes jgofs 1.5 distribution and that this file,
#    along with the sources, is in optsrc/* under the jgofs root.
#
# Can be run standalone if:
#	1) jgofs_root/opt-build-env has been executed first in context of
#	   this process (ie, cd jgofs_root; source opt-build-env)
#	2) jgofs.a library has already been built
#
# 14 Dec 2000 clh
#  make ready for a dataserver to use
#  -- all references to optsrc above change to src
#  -- similarly refs to opt-build-env become build-env
#  -- and method becomes stats, not optstats
#
TOPLEVEL = ../../
METHBINDIR  = ${TOPLEVEL}methods
INCDIR = ../include
OUTERSRCDIR = ../methods
SRCDIR = .
LIBDIR  = ../lib

METHOD = ${METHBINDIR}/stats

#	Files which need to be compiled in order to build stats
OBJ =   ${OUTERSRCDIR}/outer.c \
	${SRCDIR}/stats.c

#	.h files (or other included files) on which inner or outer depend
INCLUDED_FILES = ${INCDIR}/default.h \
		 ${INCDIR}/inner.h \
		 ${INCDIR}/outer.h

#	libraries required
LIB_LIST = ${LIBDIR}/jgofs.a
SYSLIB_LIST = -lm

#	Method-specific compilation flags
METHOD_CFLAGS = 

#	Compilation switches
SWITCHES = -DOPTIONS='"${INCDIR}/default.h"' \
           -DINNEROPTIONS='"${INCDIR}/inner.h"' \
	   -DMYADDR='"${MYADDR}"' \
	   -DOPTIONSERVER='"${OPTIONSERVER}"' \
	   -DINFOSERVER='"${INFOSERVER}"' \
	   -DDIRSERVER='"${DIRSERVER}"' \
	   -DQUOTENOLINK

#######################

all: ${METHOD}

${METHOD}:${OBJ} ${INCLUDED_FILES} ${LIB_LIST}
	@-test -d ${METHBINDIR} || mkdir ${METHBINDIR}
#		-I. used so that outer can find included files in
#		source directory if needed
		$(CC) \
			${CFLAGS} ${METHOD_CFLAGS} \
			${SWITCHES} \
			-DBUTTONIMAGESDIR='"${BUTTONIMAGESDIR}"' \
			-I${SRCDIR} \
			-I${INCDIR} \
			${OBJ} \
			${LIB_LIST} \
			${SYSLIB_LIST} \
		-o $@ 

clean:
	-rm ${SRCDIR}/stats.o \
	    ${SRCDIR}/outer.o \
	    ${METHOD}
