#
#
#                         DES SOFTWARE PACKAGE
#                             Version 2.2
#
#                                        _
# Copyright (c) 1990,1991,1992,1993 Stig Ostholm.
# All Rights Reserved
#
#
# The author takes no responsibility of actions caused by the use of this
# software package and does not guarantee the correctness of the functions.
#
# This software package may be freely distributed for non-commercial purpose
# as long as the copyright notice is kept. Any changes made should be
# accompanied by a comment indicating who made the change, when it was made
# and what was changed.
#
# This software package, or any parts of it, may not be used or in any way
# re-distributed for commercial purpose without the authors permission.
# The author keeps the right to decide between of what is commercial and
# what is non-commercial purpose.
#
# Restrictions due to national laws governing the use, import or export of
# cryptographic software is the responsibility of the software user/importer/
# exporter to follow.
#
#
#                                              _
#                                         Stig Ostholm
#                                         Chalmers University of Technology
#                                         Department of Computer Engineering
#                                         S-412 96 Gothenburg
#                                         Sweden
#                                         ----------------------------------
#                                         Email: ostholm@ce.chalmers.se
#                                         Phone: +46 31 772 1703
#                                         Fax:   +46 31 772 3663
#

  TOPDIR = ..
  DESLIB = ${TOPDIR}/lib/libdes.a


#      CC = gcc
# Please, look at the comments in env.h before using this define.
 DEFINES =
INCLUDES = -I${TOPDIR}/include -I${TOPDIR}/config/include -I${TOPDIR}/lib/misc
   CCOPT = -O
   CCOPT = -g
  CFLAGS = ${CCOPT} ${DEFINES} ${INCLUDES}
 LDFLAGS = ${DESLIB}

 INSTALL = install -c

      RM = rm -f
      MV = mv
    ECHO = echo

  BINDIR =

   SRCS1 = crypt.c io.c pad.c file.c mode.c tab_mode.c getivec.c
   OBJS1 = crypt.o io.o pad.o file.o mode.o tab_mode.o getivec.o \
	   crypt_core.o crypt_compat.o

   SRCS2 = key.c
   OBJS2 = key.o \
	   key_core.o key_compat.o

   SRCS3 = str.c getkey.c core.c compat.c \
	   tab_compat.c tab_core.c
   OBJS3 = str.o getkey.o core.o compat.o

    SRCS = ${SRCS1} ${SRCS2} ${SRCS3}
    OBJS = ${OBJS1} ${OBJS2} ${OBJS3}


   PROGS = descrypt deskey


# This rule should be defined in all make programs.
#
#.c.o:
#	${CC} ${CFLAGS} -c $* $<

all	: ${PROGS}


descrypt: ${OBJS1} ${OBJS3} ${DESLIB}
	${CC} ${CCOPT} -o $@ ${OBJS1} ${OBJS3} ${LDFLAGS}

deskey	: ${OBJS2} ${OBJS3} ${DESLIB}
	${CC} ${CCOPT} -o $@ ${OBJS2} ${OBJS3} ${LDFLAGS}


install	: ${PROGS}
	@if [ "${BINDIR}" ]; then \
		for P in ${PROGS}; do \
			${ECHO} ${INSTALL} -s $$P ${BINDIR}; \
			${INSTALL} -s $$P ${BINDIR}; \
		done \
	else \
		${ECHO} 'Define destination directory (BINDIR = destination)'; \
		exit 1; \
	fi


clean	:
	${RM} ${PROGS} *.o core a.out tmp.c tmp.h *.NEW *.BAK


depend	:
	${TOPDIR}/util/mkdepend.sh ${MFLAGS} 'CC=${CC}' 'CFLAGS=${CFLAGS}' 'RM=${RM}' -f Makefile ${SRCS}


crypt_compat.o : tab_compat.c
	${RM} tab_compat.o
	${CC} ${CFLAGS} -DCRYPT -c tab_compat.c
	${MV} tab_compat.o $@

key_compat.o : tab_compat.c
	${RM} tab_compat.o
	${CC} ${CFLAGS} -DKEY -c tab_compat.c
	${MV} tab_compat.o $@

crypt_core.o : tab_core.c
	${RM} tab_core.o
	${CC} ${CFLAGS} -DCRYPT -c tab_core.c
	${MV} tab_core.o $@

key_core.o : tab_core.c
	${RM} tab_core.o
	${CC} ${CFLAGS} -DKEY -c tab_core.c
	${MV} tab_core.o $@


# To keep old make programs happy.
crypt.o	: crypt.c
key.o	: key.c

str.o	: str.c

core.o	: core.c
io.o	: io.c
pad.o	: pad.c
file.o	: file.c
mode.o	: mode.c
compat.o: compat.c

tab_mode.o: tab_mode.c

getkey.o: getkey.c
getivec.o: getivec.c

# DEPEND
#
# Don not change the lines below, run make depend
#
