# SKIP Source Code License Statement:
# ------------------------------------------------------------------
#   Copyright
#   Sun Microsystems, Inc.
# 
# 
#   Copyright (C) 1994, 1995 Sun Microsystems, Inc.  All Rights
#   Reserved.
# 
#   Permission is hereby granted, free of charge, to any person
#   obtaining a copy of this software and associated documentation
#   files (the "Software"), to deal in the Software without
#   restriction, including without limitation the rights to use,
#   copy, modify, merge, publish, distribute, sublicense, and/or sell
#   copies of the Software or derivatives of the Software, and to 
#   permit persons to whom the Software or its derivatives is furnished 
#   to do so, subject to the following conditions:
# 
#   The above copyright notice and this permission notice shall be
#   included in all copies or substantial portions of the Software.
# 
#   The Software must not be transferred to persons who are not US
#   citizens or permanent residents of the US or exported outside
#   the US (except Canada) in any form (including by electronic
#   transmission) without prior written approval from the US
#   Government. Non-compliance with these restrictions constitutes
#   a violation of the U.S. Export Control Laws.
# 
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
#   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
#   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
#   NONINFRINGEMENT.  IN NO EVENT SHALL SUN MICROSYSTEMS, INC., BE LIABLE
#   FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
#   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
#   CONNECTION WITH THE SOFTWARE OR DERIVATES OF THIS SOFTWARE OR 
#   THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# 
#   Except as contained in this notice, the name of Sun Microsystems, Inc.
#   shall not be used in advertising or otherwise to promote
#   the sale, use or other dealings in this Software or its derivatives 
#   without prior written authorization from Sun Microsystems, Inc.

#pragma ident "@(#)Makefile	1.13 95/11/17 Sun Microsystems"

include ../../../Makefile.defs

DES_ECB = ../des_ecb

DEFS	= $(OS) $(K_FLAGS)
INCS	= -I$(COMM_INC) -I$(DES_ECB)
SCC	= $(CC) $(INCS) $(DEFS)
MODS	= $(K_DIR)/skip_des_ede_k2 $(K_DIR)/skip_des_ede_k3
WRAPOS5	= $(K_DIR)/desedek2_wrapper.o
WRAP1OS5= $(K_DIR)/desedek3_wrapper.o

.INIT:
	@[ -d $(K_DIR) ] || mkdir -p $(K_DIR)


all:	$(MODS)

$(K_DIR)/skip_des_ede_k2: \
	$(K_DIR)/des.o $(K_DIR)/des_ede_cbc.o \
	$(K_DIR)/dessp.o $(K_DIR)/des_ede_ecb.o $(WRAPOS$(MAJOR_OS))
	ld -r -o $@ $(K_DIR)/des_ede_cbc.o $(K_DIR)/des_ede_ecb.o \
		$(K_DIR)/des.o $(K_DIR)/dessp.o $(WRAPOS$(MAJOR_OS))
$(K_DIR)/skip_des_ede_k3: \
	$(K_DIR)/des.o $(K_DIR)/des_ede_cbc.o \
	$(K_DIR)/dessp.o $(K_DIR)/des_ede_ecb.o $(WRAP1OS$(MAJOR_OS))
	ld -r -o $@ $(K_DIR)/des_ede_cbc.o $(K_DIR)/des.o \
		$(K_DIR)/des_ede_ecb.o $(K_DIR)/dessp.o $(WRAP1OS$(MAJOR_OS))

$(K_DIR)/des_ede_cbc.o: des_ede_cbc.c ../../include/skip_crypt.h
	$(SCC) -o $@ -c des_ede_cbc.c

$(K_DIR)/des.o: $(DES_ECB)/des.c $(DES_ECB)/des.h
	$(SCC) -o $@ -c $(DES_ECB)/des.c

$(K_DIR)/dessp.o: $(DES_ECB)/dessp.c $(DES_ECB)/des.h
	$(SCC) -o $@ -c $(DES_ECB)/dessp.c

$(K_DIR)/des_ede_ecb.o: des_ede_ecb.c $(SYSINC)
	$(SCC) -o $@ -c des_ede_ecb.c

$(WRAPOS5): desedek2_wrapper.c \
	$(COMM_INC)/skip_crypt.h $(COMM_INC)/bdcmod.h \
	$(COMM_INC)/skip_sysv.h
	$(SCC) -o $@ -c desedek2_wrapper.c

$(WRAP1OS5): desedek3_wrapper.c \
	$(COMM_INC)/skip_crypt.h $(COMM_INC)/bdcmod.h \
	$(COMM_INC)/skip_sysv.h
	$(SCC) -o $@ -c desedek3_wrapper.c
clean:
	@$(RM) -rf  $(K_DIR)
	@-$(SCCSCLEAN)

cleanall:
	@$(RM) -rf *bin.*
	@-$(SCCSCLEAN)
