# RE_SID: @(%)/usr/dosnfs/shades_SCCS/unix/pcnfsd/v2/src/SCCS/s.Makefile 1.4 92/01/27 17:59:43 SMI
#
#	@(#)Makefile	1.4	1/27/92
#
# Makefile for rpc.pcnfsd
#

BIN= rpc.pcnfsd
TST= clnt.pcnfsd

all: $(BIN) $(TST)

SVR_OBJS=  pcnfsd_svc.o pcnfsd_xdr.o pcnfsd_v1.o \
	pcnfsd_v2.o pcnfsd_misc.o pcnfsd_cache.o \
	pcnfsd_print.o

TST_OBJS= pcnfsd_clnt.o pcnfsd_test.o pcnfsd_xdr.o

SVR_SRCS= $(SVR_OBJS:.o=.c)

TST_SRCS= $(TST_OBJS:.o=.c)

HDRS= pcnfsd.h common.h

.KEEP_STATE:

.INIT: $(HDRS)

LINTFLAGS= -hbax

#
# The next line should be uncommented for SunOS and commented out for SVR4
CFLAGS= -g -DUSER_CACHE -DWTMP -DUSE_YP
# The next line should be commented for SunOS and uncommented out for SVR4
#CFLAGS= -g -D SVR4 -DSHADOW_SUPPORT
#
# The following line seems to work for SunOS and SVR4 (UHC). However
# I have seen an SVR4 setup which required that you explicitly include
# the nsl and socket libs.
#
LIBS= -lrpcsvc
#LIBS= -lrpcsvc  -lnsl -lsocket

#
# rpcgen is somewhat braindamaged when it comes to including
# extensions to initialization and to the core loop. Therefore
# once a version of the generated code and headers are solid,
# it is necessary to comment out the targets for the generated
# files:
#	pcnfsd_xdr.c
#	pcnfsd_svc.c
#	pcnfsd_clnt.c
#	pcnfsd.h
#
# These are then placed under SCCS control and hacked.
# If you are porting to a new environment and things don't
# seem to work right, you may want to see what your local
# rpcgen will generate. To do this, save the original
# files, uncomment these targets, and make. (Or just run
# rpcgen by hand.) Compare things, especially the set of
# header files fulled in.
#
#pcnfsd_xdr.c: pcnfsd.h pcnfsd.x
#	rpcgen -c pcnfsd.x -o $@ 
#
#pcnfsd_svc.c: pcnfsd.h pcnfsd.x
#	rpcgen -s udp -s tcp -I pcnfsd.x -o $@
#
#pcnfsd.h: pcnfsd.x
#	rpcgen -h pcnfsd.x -o $@
#pcnfsd_clnt.c: pcnfsd.h pcnfsd.x
#	rpcgen -l pcnfsd.x -o $@


$(BIN): $(SVR_OBJS)
	cc -o $@ $(SVR_OBJS) $(LIBS)

$(TST): $(TST_OBJS)
	cc -o $@ $(TST_OBJS) $(LIBS)

install: $(BIN)
	install -d $(DESTDIR)/usr/etc
	install -s $(BIN) $(DESTDIR)/usr/etc

tags: $(SRCS)
	ctags $(SVR_SRCS)

lint: $(SRCS)
	lint $(CFLAGS) $(LINTFLAGS) $(SVR_SRCS)
	lint $(CFLAGS) $(LINTFLAGS) $(TST_SRCS)

clean:
	rm -f $(BIN) $(SVR_OBJS) $(TST) $(TST_OBJS)
