#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.

.KEEP_STATE:

# aes/*.s
ASM_SOURCES =	x86_64cpuid.s \
		aes-x86_64.s \
		aesni-sha1-x86_64.s \
		aesni-x86_64.s \
		bsaes-x86_64.s \
		vpaes-x86_64.s \
		modexp512-x86_64.s \
		x86_64-gf2m.s \
		x86_64-mont.s \
		x86_64-mont5.s \
		cmll-x86_64.s \
		md5-x86_64.s \
		ghash-x86_64.s \
		rc4-md5-x86_64.s \
		rc4-x86_64.s \
		sha1-x86_64.s \
		sha256-x86_64.s \
		sha512-x86_64.s

OBJECTS +=	$(ASM_SOURCES:%.s=%.o)

OBJECTS64 =	bf_enc.o \
		x86_64-gcc.o \
		cmll_misc.o \
		des_enc.o \
		fcrypt_b.o

OBJECTS += 	$(OBJECTS64)

CLEANFILES +=	$(ASM_SOURCES)

include ../Makefile.com
include ../../../Makefile.lib.64

CPPFLAGS += -DL_ENDIAN
CPPFLAGS += -DOPENSSL_IA32_SSE2
CPPFLAGS += -DOPENSSL_BN_ASM_MONT5
CPPFLAGS += -DBSAES_ASM
CPPFLAGS += -DPK11_LIB_LOCATION=\"/usr/lib/64/libpkcs11.so.1\"

# OpenSSL interface is a mess
MAPFILES =

all:  $(ROOTLIBDIR64) $(LIBS) $(LIBLINKS)

$(LIBLINKS):    FRC
	$(RM) $@; $(SYMLINK) $(DYNLIB) $@

$(ROOTLIBDIR64):
	$(INS.dir)

# sha512-x86_64.pl generates both sha512-x86_64.s and sha256-x86_64.s
# sha256-x86_64.s is generated by default
sha256-x86_64.s:	../pl/sha512-x86_64.pl
	$(PERL)  ../pl/sha512-x86_64.pl elf $@

sha512-x86_64.s:	../pl/sha512-x86_64.pl
	$(PERL)  ../pl/sha512-x86_64.pl elf $@

install: all $(ROOTLIBS64) $(ROOTLINKS64)

FRC:
