# Turn this option on if using a SGI Iris running IRIX.
# IRIX does not appear to define sgttyb anywhere :-(
#OPTS0= -D_IRIX

# Version 1.94 has changed the strings_to_key function so that it is
# now compatible with MITs when the string is longer than 8 characters.
# If you wish to keep the old version, uncomment the following line.
# This will affect the -E/-D options on des(1).
#OPTS1= -DOLD_STR_TO_KEY

# This #define specifies the use of an alternative D_ENCRYPT macro in
# ecb_encrypt.  The choice of macro can make a %20 difference in the
# speed.  Unfortunatly the choise of the best macro appears to be very
# dependant on the compiler and the machine in question.
# For the following combinations use the ALT_ECB option.
# Sparc 2 (cc -O4), sun 3/260 (cc -O4)
# For the following combinations do not use the ALT_ECB option.
# Sparc 2 (gcc2 -O2), sun 3/260 (cc -O2), mvax2 (cc -O), MSDOS (Turbo Cv2)
# For other machines, experiment with changing the option and run
# ./speed to see which is faster.
# DO NOT TURN THIS OPTION ON WHEN COMPILING THIS CODE ON A 64 BIT MACHINE
OPTS2= -DALT_ECB # is faster with atarist + gcc

OPTS= $(OPTS0) $(OPTS1) $(OPTS2)
#CC=cc
#CFLAGS= -g $(OPTS)
AR=gcc-ar
CC=gcc
CFLAGS= -O2 $(OPTS) -fomit-frame-pointer


OBJS=	cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \
	qud_cksm.o rand_key.o read_pwd.o set_key.o str2key.o \
	enc_read.o enc_writ.o fcrypt.o cfb_enc.o \
	3ecb_enc.o ofb_enc.o 3cbc_enc.o

LIB=	des.olb

all: $(LIB) destest.ttp rpw.ttp des.ttp speed.ttp

$(LIB):	$(OBJS)
	rm -f $(LIB)
	$(AR) sr $(LIB) $(OBJS)

destest.ttp: destest.o des.olb
	$(CC) $(CFLAGS) -o destest.ttp destest.o des.olb

rpw.ttp: rpw.o des.olb
	$(CC) $(CFLAGS) -o rpw.ttp rpw.o des.olb

speed.ttp: speed.o des.olb
	$(CC) $(CFLAGS) -o speed.ttp speed.o des.olb

des.ttp: des.o des.olb
	$(CC) $(CFLAGS) -o des.ttp des.o des.olb
	xstrip -k $@

# DO NOT DELETE THIS LINE -- make depend depends on it.
