# Copyright (c) 1995, 1996, 1997 Jeffrey A. Uphoff
# Adapted for linux-nfs build tree by Olaf Kirch, 1996.
#
# NSM for Linux.
#

# Uncomment for embedded client-side simulation functions.
SIMUL	= -DSIMULATIONS

# Set level of DEBUG.
# Undefined is normal, 1 is debug logging, > 1 gives a bit more logging
# and puts the state files into /tmp rather than the regular place.
DEBUG	= -DDEBUG=1

##################################################################
#	no user-serviceable parts below this line
##################################################################
PROGRAM	= statd
PREFIX	= rpc.
OBJS	= $(SRCS:.c=.o)
CCOPTS	= $(DEBUG) $(SIMUL) -Wno-unused
#LDOPTS	= -static

SRCS	= $(RPCSRCS) $(SIMSRCS) \
	  callback.c notlist.c log.c misc.c monitor.c notify.c simu.c \
	  stat.c statd.c state.c svc_run.c rmtcall.c
HDRS	= $(RPCHDRS) $(SIMHDRS)

RPCSRCS	= sm_inter_clnt.c sm_inter_svc.c sm_inter_xdr.c
RPCHDRS	= sm_inter.h

ifdef SIMUL
SIMSRCS	= sim_sm_inter_clnt.c sim_sm_inter_svc.c
SIMHDRS	= sim_sm_inter.h
SRCS   += simulate.c
endif

include $(TOP)rules.mk

$(RPCHDRS) $(RPCSRCS):	sm_inter.x
	$(RM) sm_inter.h sm_*.c
	$(RPCGEN) -h -o sm_inter.h $<
	$(RPCGEN) -l -o sm_inter_clnt.c $<
	$(RPCGEN) -m -o sm_inter_svc.c $<
	$(RPCGEN) -c -o sm_inter_xdr.c $<

$(SIMHDRS) $(SIMSRCS):	sim_sm_inter.x
	$(RM) sim_sm_inter.h sim_sm_*.c 
	$(RPCGEN) -h -o sim_sm_inter.h $<
	$(RPCGEN) -l -o sim_sm_inter_clnt.c $<
	$(RPCGEN) -m -o sim_sm_inter_svc.c $<

clean distclean::
	$(RM) $(RPCSRCS) $(RPCHDRS) $(SIMSRCS) $(SIMHDRS)
