SHELL=	     /bin/sh
CC=	     @CC@
INSTALL=     @INSTALL@
COMPILE_ET=  compile_et
prefix=      @prefix@
exec_prefix= @exec_prefix@
libdir=      @libdir@
sbindir=     @sbindir@
SERVERDIR=   $(sbindir)

DEFS=	@DEFS@
LIBS=	@LIBS@

INCLUDES= -I../include -I$(prefix)/include
CFLAGS=	  -O

OBJS=	announce.o conv_mgr.o dsc_enter.o dsname.o host.o interface.o \
	res_module.o rpcall.o stubs.o tfile.o tmem.o tnet.o tunix.o acl.o \
	realm.o rpc_et.o dsc_et.o

KDOBJS=	@KDOBJS@

all:	libds.a

libds.a: ${OBJS} ${KDOBJS}
	ar cruv libds.a ${OBJS} ${KDOBJS}
	@RANLIB@ libds.a

dsc_et.c: ../ets/dsc_et.et
	$(COMPILE_ET) ../ets/dsc_et.et; rm dsc_et.h

rpc_et.c: ../ets/rpc_et.et
	$(COMPILE_ET) ../ets/rpc_et.et; rm rpc_et.h

install: all
	$(INSTALL) -m 644 libds.a $(libdir)

distclean: clean
	rm -f Makefile dsc_et.c rpc_et.c

res_module.o: res_module.c
	${CC} ${CFLAGS} ${INCLUDES} ${DEFS} \
	-DSERVERDIR=\"$(SERVERDIR)\" -c $*.c

.c.o:
	${CC} ${CFLAGS} ${INCLUDES} ${DEFS} -c $*.c

clean:
	rm -rf *~ \#* *.o libds.a libdsk.a
