thisconfigdir=.
myfulldir=lib/krb4
mydir=.
BUILDTOP=$(REL)$(U)$(S)$(U)
DEFINES = -I$(srcdir)/../../include/kerberosIV

##DOS##BUILDTOP = ..\..
##DOS##LIBNAME=$(OUTPRE)krb4.lib
##DOS##OBJFILE=$(OUTPRE)krb4.lst

LIB=krb4
LIBMAJOR=2
LIBMINOR=0
RELDIR=krb4

# Depends on libk5crypto, libkrb5, KRB4_CRYPTO_LIB and _et_list...
# Depends on libkrb5, expect to find
#	krb5_init_context, krb5_free_context, profile_get_values
#
KRB4_CRYPTO_LIBS=-ldes425

SHLIB_EXPDEPS = \
	$(TOPLIBD)/libdes425$(SHLIBEXT) \
	$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
	$(TOPLIBD)/libkrb5$(SHLIBEXT)
SHLIB_EXPLIBS=-lkrb5 -lcom_err -ldes425 -lk5crypto
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)

EHDRDIR=$(BUILDTOP)$(S)include

OBJS	= \
	$(OUTPRE)cr_auth_repl.$(OBJEXT) \
	$(OUTPRE)cr_ciph.$(OBJEXT) \
	$(OUTPRE)cr_tkt.$(OBJEXT) \
	$(OUTPRE)debug.$(OBJEXT) \
	$(OUTPRE)decomp_tkt.$(OBJEXT) \
	$(OUTPRE)err_txt.$(OBJEXT) \
	$(OUTPRE)g_ad_tkt.$(OBJEXT) \
	$(OUTPRE)g_in_tkt.$(OBJEXT) \
	$(OUTPRE)g_phost.$(OBJEXT) \
	$(OUTPRE)g_pw_in_tkt.$(OBJEXT) \
	$(OUTPRE)g_pw_tkt.$(OBJEXT) \
	$(OUTPRE)g_tkt_svc.$(OBJEXT) \
	$(OUTPRE)gethostname.$(OBJEXT) \
	$(OUTPRE)getst.$(OBJEXT) \
	$(OUTPRE)kname_parse.$(OBJEXT) \
	$(OUTPRE)mk_auth.$(OBJEXT) \
	$(OUTPRE)mk_err.$(OBJEXT) \
	$(OUTPRE)mk_priv.$(OBJEXT) \
	$(OUTPRE)mk_req.$(OBJEXT) \
	$(OUTPRE)mk_safe.$(OBJEXT) \
	$(OUTPRE)month_sname.$(OBJEXT) \
	$(OUTPRE)one.$(OBJEXT) \
	$(OUTPRE)pkt_cipher.$(OBJEXT) \
	$(OUTPRE)pkt_clen.$(OBJEXT) \
	$(OUTPRE)rd_err.$(OBJEXT) \
	$(OUTPRE)rd_priv.$(OBJEXT) \
	$(OUTPRE)rd_safe.$(OBJEXT) \
	$(OUTPRE)send_to_kdc.$(OBJEXT) \
	$(OUTPRE)stime.$(OBJEXT) \
	$(OUTPRE)rd_preauth.$(OBJEXT) \
	$(OUTPRE)mk_preauth.$(OBJEXT) \
	$(OSOBJS) $(CACHEOBJS) $(SETENVOBJS) $(STRCASEOBJS) $(SHMOBJS) \
	$(LIB_KRB_HOSTOBJS) $(SERVER_KRB_OBJS) $(NETIO_OBJS) $(REALMDBOBJS)

SRCS = \
	$(srcdir)/cr_auth_repl.c \
	$(srcdir)/cr_ciph.c \
	$(srcdir)/cr_tkt.c \
	$(srcdir)/debug.c \
	$(srcdir)/decomp_tkt.c \
	$(srcdir)/g_ad_tkt.c \
	$(srcdir)/g_pw_in_tkt.c \
	$(srcdir)/g_phost.c \
	$(srcdir)/g_pw_tkt.c \
	$(srcdir)/g_tkt_svc.c \
	$(srcdir)/getst.c \
	$(srcdir)/gethostname.c \
	$(srcdir)/kname_parse.c \
	$(srcdir)/err_txt.c \
	$(srcdir)/g_in_tkt.c \
	$(srcdir)/mk_auth.c \
	$(srcdir)/mk_err.c \
	$(srcdir)/mk_priv.c \
	$(srcdir)/mk_req.c \
	$(srcdir)/mk_safe.c \
	$(srcdir)/month_sname.c \
	$(srcdir)/one.c \
	$(srcdir)/pkt_cipher.c \
	$(srcdir)/pkt_clen.c \
	$(srcdir)/rd_err.c \
	$(srcdir)/rd_priv.c \
	$(srcdir)/rd_safe.c \
	$(srcdir)/send_to_kdc.c \
	$(srcdir)/stime.c \
	$(srcdir)/rd_preauth.c \
	$(srcdir)/mk_preauth.c \
	$(srcdir)/unix_time.c \
	$(OSSRCS) $(CACHESRCS) $(SETENVSRCS) $(STRCASESRCS) $(SHMSRCS) \
	$(LIB_KRB_HOSTSRCS) $(SERVER_KRB_SRCS) $(NETIO_SRCS) $(REALMDBSRCS)

STLIBOBJS  = $(OBJS)
STOBJLISTS=OBJS.ST

#
# These objects implement the time computation routines.
#
OSOBJS = $(OUTPRE)unix_time.$(OBJEXT)
OSSRCS = $(srcdir)/unix_time.c

##DOS##OSOBJS = $(OUTPRE)win_time.obj

#
# These objects implement ticket cacheing for Unix.  They are
# replaced by other files when compiling for Windows or Mac.
#
CACHESRCS=$(srcdir)/tf_util.c $(srcdir)/dest_tkt.c $(srcdir)/in_tkt.c \
	$(srcdir)/tkt_string.c $(srcdir)/g_tf_fname.c \
	$(srcdir)/g_tf_realm.c $(srcdir)/g_cred.c $(srcdir)/save_creds.c
CACHEOBJS=$(OUTPRE)tf_util.$(OBJEXT) $(OUTPRE)dest_tkt.$(OBJEXT) $(OUTPRE)in_tkt.$(OBJEXT) \
	$(OUTPRE)tkt_string.$(OBJEXT) $(OUTPRE)g_tf_fname.$(OBJEXT) $(OUTPRE)g_tf_realm.$(OBJEXT) \
	$(OUTPRE)g_cred.$(OBJEXT) $(OUTPRE)save_creds.$(OBJEXT)

##DOS##CACHEOBJS = $(OUTPRE)memcache.$(OBJEXT)

#
# These objects implement Kerberos realm<->host database lookup.
# They read config files and/or network databases in various ways
# on various platforms.
#

CNFFILE = g_cnffile
##DOS##CNFFILE = win_store

REALMDBSRCS= $(srcdir)/$(CNFFILE).c $(srcdir)/g_krbhst.c $(srcdir)/g_krbrlm.c \
	$(srcdir)/g_admhst.c $(srcdir)/realmofhost.c 
REALMDBOBJS= $(OUTPRE)$(CNFFILE).$(OBJEXT) $(OUTPRE)g_krbhst.$(OBJEXT) $(OUTPRE)g_krbrlm.$(OBJEXT) \
	$(OUTPRE)g_admhst.$(OBJEXT) $(OUTPRE)realmofhost.$(OBJEXT) 

#
# These objects are only used on server or debug implementations of Kerberos,
# and they cause some major or minor sort of trouble for some
# client-only platform (Mac or Windows).
#
SERVER_KRB_SRCS=$(srcdir)/klog.c $(srcdir)/kuserok.c $(srcdir)/log.c \
		$(srcdir)/kntoln.c $(srcdir)/fgetst.c $(srcdir)/rd_svc_key.c \
		$(srcdir)/cr_err_repl.c $(srcdir)/rd_req.c \
		$(srcdir)/g_svc_in_tkt.c $(srcdir)/recvauth.c \
		krb_err.c $(srcdir)/ad_print.c \
		$(srcdir)/cr_death_pkt.c $(srcdir)/kparse.c \
		$(srcdir)/put_svc_key.c $(srcdir)/sendauth.c 
SERVER_KRB_OBJS=$(OUTPRE)klog.$(OBJEXT) $(OUTPRE)kuserok.$(OBJEXT) $(OUTPRE)log.$(OBJEXT) \
		$(OUTPRE)kntoln.$(OBJEXT) \
		$(OUTPRE)fgetst.$(OBJEXT) $(OUTPRE)rd_svc_key.$(OBJEXT) $(OUTPRE)cr_err_repl.$(OBJEXT) \
		$(OUTPRE)rd_req.$(OBJEXT) $(OUTPRE)g_svc_in_tkt.$(OBJEXT) $(OUTPRE)recvauth.$(OBJEXT) \
		$(OUTPRE)krb_err.$(OBJEXT) $(OUTPRE)ad_print.$(OBJEXT) $(OUTPRE)cr_death_pkt.$(OBJEXT) \
		$(OUTPRE)kparse.$(OBJEXT) $(OUTPRE)put_svc_key.$(OBJEXT) $(OUTPRE)sendauth.$(OBJEXT)
#
# These objects are included on Unix and Windows (for kstream and kadm)
# but not under Mac (there are no file descriptors).
#
NETIO_SRCS=$(srcdir)/netread.c $(srcdir)/netwrite.c
NETIO_OBJS=$(OUTPRE)netread.$(OBJEXT) $(OUTPRE)netwrite.$(OBJEXT)

#
# These objects glue the Kerberos library to the operating system
# (time-of-day access, etc).  They are replaced in Mac and Windows
# by other _glue.* routines.
#
LIB_KRB_HOSTSRCS=$(srcdir)/unix_glue.c
LIB_KRB_HOSTOBJS=$(OUTPRE)unix_glue.$(OBJEXT)

##DOS##LIB_KRB_HOSTOBJS=$(OUTPRE)win_glue.obj

ARCHIVEARGS= $@ $(OBJS)

CODE=$(SRCS) Makefile.in krb_err.et

# We want *library* compiler options...
DBG=$(DBG_LIB)


all-unix:: krb_err.h includes all-liblinks

##DOS##LIBOBJS = $(OBJS)

# comp_et_depend(krb_err)
krb_err.h:: krb_err.et
krb_err.c: krb_err.et

depend:: krb_err.h
depend:: $(CODE) 

includes:: krb_err.h
	if cmp krb_err.h $(EHDRDIR)/krb_err.h >/dev/null 2>&1; then :; \
	else \
		(set -x; $(RM) $(EHDRDIR)/krb_err.h; \
		 $(CP) krb_err.h $(EHDRDIR)/krb_err.h) ; \
	fi

clean-unix::
	$(RM) $(EHDRDIR)/krb_err.h



#install-unix::
#	$(INSTALL_DATA) krb_err.h $(DESTDIR)$(KRB5_INCDIR)/kerberosIV/krb_err.h


DEFINES = $(FALLBACK) $(OLD_SRVTAB) $(OLD_KLOGIN) -I$(srcdir)/../../include/kerberosIV

clean:: 
	-$(RM) $(OBJS)

clean-:: clean-unix

clean-unix::
	-$(RM) krb_err.c
	-$(RM) krb_err.h
	-$(RM) ../../include/kerberosIV/krb_err.h

clean-unix:: clean-liblinks clean-libs clean-libobjs


check-unix:: $(TEST_PROGS)
check-mac:: $(TEST_PROGS)
check-windows::


install-unix:: install-libs
