CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/../crypto/des -I$(srcdir)/../../include/kerberosIV

##DOSBUILDTOP = ..\..
##DOSLIBNAME=libdes425.lib
##DOS!include $(BUILDTOP)\config\windows.in

.c.o:
	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
@SHARED_RULE@

OBJS=	cksum.$(OBJEXT)		\
	des.$(OBJEXT)		\
	enc_dec.$(OBJEXT)	\
	key_parity.$(OBJEXT)	\
	key_sched.$(OBJEXT)	\
	new_rnd_key.$(OBJEXT)	\
	pcbc_encrypt.$(OBJEXT)	\
	quad_cksum.$(OBJEXT)	\
	random_key.$(OBJEXT)	\
	read_passwd.$(OBJEXT) \
	str_to_key.$(OBJEXT)	\
	unix_time.$(OBJEXT)     \
	util.$(OBJEXT)		\
	weak_key.$(OBJEXT)	\
	k4_glue.$(OBJEXT)

SRCS=	$(srcdir)/cksum.c	\
	$(srcdir)/des.c		\
	$(srcdir)/enc_dec.c	\
	$(srcdir)/key_parity.c	\
	$(srcdir)/key_sched.c	\
	$(srcdir)/new_rnd_key.c	\
	$(srcdir)/pcbc_encrypt.c	\
	$(srcdir)/quad_cksum.c	\
	$(srcdir)/random_key.c	\
	$(srcdir)/read_passwd.c \
	$(srcdir)/str_to_key.c \
	$(srcdir)/unix_time.c   \
	$(srcdir)/util.c	\
	$(srcdir)/weak_key.c	\
	$(srcdir)/k4_glue.c

LIB_SUBDIRS= .
LIBDONE= DONE
#
# Depends on libcrypto.
#
DEPLIBS=$(TOPLIBD)/libcrypto.$(SHEXT)
SHLIB_LIBS=-lcrypto
SHLIB_LDFLAGS= $(LDFLAGS) @SHLIB_RPATH_DIRS@
SHLIB_LIBDIRS= @SHLIB_LIBDIRS@

EXT_LIB= libdes425.a $(TOPLIBD)/libcrypto.a
DEPKLIB= $(TOPLIBD)/libcrypto.a

all:: all-$(WHAT)

all-unix:: shared $(OBJS)
all-mac:: $(OBJS)
all-windows:: $(OBJS)

shared:
	mkdir shared

verify: verify.o libdes425.a $(DEPKLIB)
	$(CC) -o $@ verify.o $(LDFLAGS) $(EXT_LIB)

check:: check-$(WHAT)

check-unix:: verify
	./verify -z
	./verify -m
	./verify

check-windows::

clean:: clean-$(WHAT)
	$(RM) verify$(EXEEXT) verify.$(OBJEXT)

clean-unix::
	$(RM) shared/*

clean-mac::
clean-windows::

libdes425.$(STEXT): $(OBJS)
	$(RM) $@
	$(ARADD) $@ $(OBJS)
	$(RANLIB) $@

install:: libdes425.a
	$(INSTALL_DATA) libdes425.a $(DESTDIR)$(KRB5_LIBDIR)/libdes425.a
	$(RANLIB) $(DESTDIR)$(KRB5_LIBDIR)/libdes425.a

clean::
	$(RM) libdes425.$(LIBEXT) libdes425.bak

