thisconfigdir=.
myfulldir=kdc
mydir=.
BUILDTOP=$(REL)$(U)
# -DUSE_RCACHE - enable replay cache for KDC
# -DNOCACHE    - disable lookaside cache, which is used to resend previous
#                response to replay (i.e., *don't* define this if you
#                define USE_RCACHE)
# These are now set in configure.in.
DEFINES = # -DNOCACHE
RUN_SETUP = @KRB5_RUN_ENV@
PROG_LIBPATH=-L$(TOPLIBD) $(KRB4_LIBPATH)
PROG_RPATH=$(KRB5_LIBDIR)

all:: krb5kdc rtest

# DEFINES = -DBACKWARD_COMPAT $(KRB4DEF)

LOCALINCLUDES = @KRB4_INCLUDES@ -I.
SRCS= \
	kdc5_err.c \
	$(srcdir)/dispatch.c \
	$(srcdir)/do_as_req.c \
	$(srcdir)/do_tgs_req.c \
	$(srcdir)/kdc_util.c \
	$(srcdir)/kdc_preauth.c \
	$(SRCTOP)/lib/kadm5/logger.c \
	$(srcdir)/main.c \
	$(srcdir)/network.c \
	$(srcdir)/sock2p.c \
	$(srcdir)/policy.c \
	$(srcdir)/extern.c \
	$(srcdir)/replay.c \
	$(srcdir)/kerberos_v4.c

OBJS= \
	kdc5_err.o \
	dispatch.o \
	do_as_req.o \
	do_tgs_req.o \
	kdc_util.o \
	kdc_preauth.o \
	logger.o \
	main.o \
	network.o \
	sock2p.o \
	policy.o \
	extern.o \
	replay.o \
	kerberos_v4.o

RT_OBJS= rtest.o \
	kdc_util.o \
	policy.o \
	extern.o

depend:: kdc5_err.c

logger.c: $(SRCTOP)/lib/kadm5/logger.c
	$(RM) $@
	$(CP) $(SRCTOP)/lib/kadm5/logger.c $@

logger.o: logger.c

kdc5_err.c: kdc5_err.et

kdc5_err.h: kdc5_err.et

kdc5_err.o: kdc5_err.h

krb5kdc: $(OBJS) $(KADMSRV_DEPLIBS) $(KRB4COMPAT_DEPLIBS)
	$(CC_LINK) -o krb5kdc $(OBJS) $(KADMSRV_LIBS) $(KRB4COMPAT_LIBS)

rtest: $(RT_OBJS) $(KADM_COMM_DEPLIBS) $(KRB5_BASE_DEPLIBS)
	$(CC_LINK) -o rtest $(RT_OBJS) $(KADM_COMM_LIBS) $(KRB5_BASE_LIBS) 

check-unix:: rtest
	KRB5_CONFIG=$(SRCTOP)/config-files/krb5.conf ; export KRB5_CONFIG ;\
	$(RUN_SETUP) $(srcdir)/rtscript > test.out
	cmp test.out $(srcdir)/rtest.good
	$(RM) test.out

install::
	$(INSTALL_PROGRAM) krb5kdc ${DESTDIR}$(SERVER_BINDIR)/krb5kdc
	$(INSTALL_DATA) $(srcdir)/krb5kdc.M ${DESTDIR}$(SERVER_MANDIR)/krb5kdc.8

clean::
	$(RM) kdc5_err.h kdc5_err.c krb5kdc logger.c rtest.o rtest

