#### include configury here
BUILDTOP=../..
OTHERSRCS=f_cbc.c f_cksum.c f_pcbc.c f_sched.c f_ecb.c f_parity.c f_tables.c
OTHEROBJS=f_cbc.o f_cksum.o f_pcbc.o f_sched.o f_ecb.o f_parity.o f_tables.o

DESSRCS= key_sched.c $(OTHERSRCS) debug_decl.c \
	quad_cksum.c random_key.c read_password.c \
	string_to_key.c weak_key.c new_rnd_key.c util.c 

SRCS=   des_internal.h \
	key_test.c testit.c verify.c epc_encrypt.c \
	cbc_noop.c enc.c ${DESSRCS}

OBJS= $(OTHEROBJS) key_sched.o debug_decl.o \
	quad_cksum.o random_key.o read_password.o \
	string_to_key.o weak_key.o  new_rnd_key.o util.o 

CODE=$(SRCS) tables.h

# install_library_target(des,$(DESOBJS),$(DESSRCS),)
all:: libdes.a

libdes.a: $(OBJS)
	$(RM) $@.bak
	-$(MV) $@ $@.bak
	$(ARCHIVE) $@ $(OBJS)
	$(RANLIB) $@

clean::
	$(RM) libdes.a
	$(RM) $(OBJS)

install::
	$(INSTALLLIB) libdes.a $(DESTDIR)$(LIBDIR)/libdes.a
	$(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libdes.a
	$(RANLIB)    $(DESTDIR)$(LIBDIR)/libdes.a
	$(CHMOD) 444 $(DESTDIR)$(LIBDIR)/libdes.a
## 


## verify that the library correctly implements the DES standard.  
## Run this after any change to the source.

all:: verify key_test testit

verify: verify.o libdes.a
	$(CC) $(CFLAGS) -o $@ $@.o libdes.a $(BSDLIB)

key_test: key_test.o libdes.a
	$(CC) $(CFLAGS) -o $@ $@.o libdes.a $(BSDLIB)

testit: testit.o libdes.a
	$(CC) $(CFLAGS) -o $@ $@.o libdes.a $(BSDLIB)

check:: testit verify
	./verify
	time ./testit -n50000 10 20

clean::
	$(RM) verify verify.o key_test key_test.o testit testit.o

