##
## ----------------------------------------------------------------------------
## $Id: Makefile.in,v 1.9 2002/08/31 09:38:17 raif Exp $
##
## Copyright (C) 2002, Free Software Foundation, Inc.
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 of the License or (at your option) any
## later version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
## more details.
##
## You should have received a copy of the GNU General Public License along with
## this program; see the file COPYING.  If not, write to the
##
##    Free Software Foundation Inc.,
##    59 Temple Place - Suite 330,
##    Boston, MA 02111-1307
##    USA
##
## As a special exception, if you link this library with other files to produce
## an executable, this library does not by itself cause the resulting
## executable to be covered by the GNU General Public License.  This exception
## does not however invalidate any other reasons why the executable file might
## be covered by the GNU General Public License.
## ----------------------------------------------------------------------------
##
# Makefile for GNU Crypto project
#
# You are free to redistribute this file. NO WARRANTY or fitness
# for purpose is implied by this notice.
#
# !!!                                                  !!!
# !!!   MAKE EDITS TO "Makefile.in", not "Makefile"    !!!
# !!!                                                  !!!
#
# Use the "configure" command to generate the project Makefile
# from its "Makefile.in" template.
#

LIBNAME = gnu-crypto

##set by configure

SRCDIR = @srcdir@
SOURCEDIR=$(SRCDIR)/source

GCJ = @GCJ@

SOURCEFILES = \
	$(SOURCEDIR)/gnu/crypto/cipher/Anubis.java \
	$(SOURCEDIR)/gnu/crypto/cipher/BaseCipher.java \
	$(SOURCEDIR)/gnu/crypto/cipher/CipherFactory.java \
	$(SOURCEDIR)/gnu/crypto/cipher/IBlockCipher.java \
	$(SOURCEDIR)/gnu/crypto/cipher/IBlockCipherSpi.java \
	$(SOURCEDIR)/gnu/crypto/cipher/Khazad.java \
	$(SOURCEDIR)/gnu/crypto/cipher/NullCipher.java \
	$(SOURCEDIR)/gnu/crypto/cipher/Rijndael.java \
	$(SOURCEDIR)/gnu/crypto/cipher/Serpent.java \
	$(SOURCEDIR)/gnu/crypto/cipher/Square.java \
	$(SOURCEDIR)/gnu/crypto/cipher/Twofish.java \
	\
	$(SOURCEDIR)/gnu/crypto/exp/ust/UST.java \
	\
	$(SOURCEDIR)/gnu/crypto/hash/BaseHash.java \
	$(SOURCEDIR)/gnu/crypto/hash/HashFactory.java \
	$(SOURCEDIR)/gnu/crypto/hash/IMessageDigest.java \
	$(SOURCEDIR)/gnu/crypto/hash/MD5.java \
	$(SOURCEDIR)/gnu/crypto/hash/RipeMD128.java \
	$(SOURCEDIR)/gnu/crypto/hash/RipeMD160.java \
	$(SOURCEDIR)/gnu/crypto/hash/Sha160.java \
	$(SOURCEDIR)/gnu/crypto/hash/Whirlpool.java \
	\
	$(SOURCEDIR)/gnu/crypto/jce/DSSKeyPairGeneratorSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/DSSRawSignatureSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/GnuCrypto.java \
	$(SOURCEDIR)/gnu/crypto/jce/ICMRandomSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/KeyPairGeneratorAdapter.java \
	$(SOURCEDIR)/gnu/crypto/jce/MD4RandomSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/MD4Spi.java \
	$(SOURCEDIR)/gnu/crypto/jce/MD5RandomSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/MD5Spi.java \
	$(SOURCEDIR)/gnu/crypto/jce/MessageDigestAdapter.java \
	$(SOURCEDIR)/gnu/crypto/jce/RipeMD128RandomSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/RipeMD128Spi.java \
	$(SOURCEDIR)/gnu/crypto/jce/RipeMD160RandomSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/RipeMD160Spi.java \
	$(SOURCEDIR)/gnu/crypto/jce/RSAKeyPairGeneratorSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/RSAPSSRawSignatureSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/SecureRandomAdapter.java \
	$(SOURCEDIR)/gnu/crypto/jce/Sha160RandomSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/Sha160Spi.java \
	$(SOURCEDIR)/gnu/crypto/jce/SignatureAdapter.java \
	$(SOURCEDIR)/gnu/crypto/jce/UMacRandomSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/WhirlpoolRandomSpi.java \
	$(SOURCEDIR)/gnu/crypto/jce/WhirlpoolSpi.java \
	\
	$(SOURCEDIR)/gnu/crypto/mac/BaseMac.java \
	$(SOURCEDIR)/gnu/crypto/mac/HMac.java \
	$(SOURCEDIR)/gnu/crypto/mac/HMacFactory.java \
	$(SOURCEDIR)/gnu/crypto/mac/IMac.java \
	$(SOURCEDIR)/gnu/crypto/mac/MacFactory.java \
	$(SOURCEDIR)/gnu/crypto/mac/TMMH16.java \
	$(SOURCEDIR)/gnu/crypto/mac/UHash32.java \
	$(SOURCEDIR)/gnu/crypto/mac/UMac32.java \
	\
	$(SOURCEDIR)/gnu/crypto/mode/BaseMode.java \
	$(SOURCEDIR)/gnu/crypto/mode/CTR.java \
	$(SOURCEDIR)/gnu/crypto/mode/ECB.java \
	$(SOURCEDIR)/gnu/crypto/mode/ICM.java \
	$(SOURCEDIR)/gnu/crypto/mode/IMode.java \
	$(SOURCEDIR)/gnu/crypto/mode/ModeFactory.java \
	$(SOURCEDIR)/gnu/crypto/mode/OFB.java \
	\
	$(SOURCEDIR)/gnu/crypto/pad/BasePad.java \
	$(SOURCEDIR)/gnu/crypto/pad/IPad.java \
	$(SOURCEDIR)/gnu/crypto/pad/PadFactory.java \
	$(SOURCEDIR)/gnu/crypto/pad/PKCS7.java \
	$(SOURCEDIR)/gnu/crypto/pad/TBC.java \
	$(SOURCEDIR)/gnu/crypto/pad/WrongPaddingException.java \
	\
	$(SOURCEDIR)/gnu/crypto/prng/BasePRNG.java \
	$(SOURCEDIR)/gnu/crypto/prng/ICMGenerator.java \
	$(SOURCEDIR)/gnu/crypto/prng/IRandom.java \
	$(SOURCEDIR)/gnu/crypto/prng/LimitReachedException.java \
	$(SOURCEDIR)/gnu/crypto/prng/MDGenerator.java \
	$(SOURCEDIR)/gnu/crypto/prng/PRNGFactory.java \
	$(SOURCEDIR)/gnu/crypto/prng/UMacGenerator.java \
	\
	$(SOURCEDIR)/gnu/crypto/sig/dss/DSSKey.java \
	$(SOURCEDIR)/gnu/crypto/sig/dss/DSSKeyPairGenerator.java \
	$(SOURCEDIR)/gnu/crypto/sig/dss/DSSKeyPairRawCodec.java \
	$(SOURCEDIR)/gnu/crypto/sig/dss/DSSPrivateKey.java \
	$(SOURCEDIR)/gnu/crypto/sig/dss/DSSPublicKey.java \
	$(SOURCEDIR)/gnu/crypto/sig/dss/DSSSignature.java \
	\
	$(SOURCEDIR)/gnu/crypto/tool/CipherSpeed.java \
	$(SOURCEDIR)/gnu/crypto/tool/HashSpeed.java \
	$(SOURCEDIR)/gnu/crypto/tool/NessieCipherTVEmitter.java \
	$(SOURCEDIR)/gnu/crypto/tool/NessieHashTVEmitter.java \
	$(SOURCEDIR)/gnu/crypto/tool/NistKat.java \
	$(SOURCEDIR)/gnu/crypto/tool/NistMCT.java \
	$(SOURCEDIR)/gnu/crypto/tool/Ent.java \
	\
	$(SOURCEDIR)/gnu/crypto/util/Prime.java \
	$(SOURCEDIR)/gnu/crypto/util/PRNG.java \
	$(SOURCEDIR)/gnu/crypto/util/Util.java

TESTFILES = \
	$(SOURCEDIR)/test/AllTests.java \
	\
	$(SOURCEDIR)/test/cipher/AllTests.java \
	$(SOURCEDIR)/test/cipher/TestOfAnubis.java \
	$(SOURCEDIR)/test/cipher/TestOfCipherFactory.java \
	$(SOURCEDIR)/test/cipher/TestOfKhazad.java \
	$(SOURCEDIR)/test/cipher/TestOfNullCipher.java \
	$(SOURCEDIR)/test/cipher/TestOfRijndael.java \
	$(SOURCEDIR)/test/cipher/TestOfSerpent.java \
	$(SOURCEDIR)/test/cipher/TestOfSquare.java \
	$(SOURCEDIR)/test/cipher/TestOfTwofish.java \
	$(SOURCEDIR)/test/cipher/TestOfNistVectors.java \
	\
	$(SOURCEDIR)/test/hash/AllTests.java \
	$(SOURCEDIR)/test/hash/TestOfHashFactory.java \
	$(SOURCEDIR)/test/hash/TestOfMD5.java \
	$(SOURCEDIR)/test/hash/TestOfRipeMD128.java \
	$(SOURCEDIR)/test/hash/TestOfRipeMD160.java \
	$(SOURCEDIR)/test/hash/TestOfSha160.java \
	$(SOURCEDIR)/test/hash/TestOfWhirlpool.java \
	\
	$(SOURCEDIR)/test/jce/AllTests.java \
	$(SOURCEDIR)/test/jce/TestOfKeyPairGenerator.java \
	$(SOURCEDIR)/test/jce/TestOfMessageDigest.java \
	$(SOURCEDIR)/test/jce/TestOfProvider.java \
	$(SOURCEDIR)/test/jce/TestOfSignature.java \
	\
	$(SOURCEDIR)/test/mac/AllTests.java \
	$(SOURCEDIR)/test/mac/TestOfHMacFactory.java \
	$(SOURCEDIR)/test/mac/TestOfMacFactory.java \
	$(SOURCEDIR)/test/mac/TestOfTMMH16.java \
	\
	$(SOURCEDIR)/test/mode/AllTests.java \
	$(SOURCEDIR)/test/mode/TestOfECB.java \
	$(SOURCEDIR)/test/mode/TestOfModeFactory.java \
	$(SOURCEDIR)/test/mode/TestOfOFB.java \
	\
	$(SOURCEDIR)/test/pad/AllTests.java \
	$(SOURCEDIR)/test/pad/TestOfPKCS7.java \
	$(SOURCEDIR)/test/pad/TestOfPadFactory.java \
	$(SOURCEDIR)/test/pad/TestOfTBC.java \
	\
	$(SOURCEDIR)/test/prng/AllTests.java \
	$(SOURCEDIR)/test/prng/TestOfICMGenerator.java \
	$(SOURCEDIR)/test/prng/TestOfPRNGFactory.java \
	\
	$(SOURCEDIR)/test/sig/AllTests.java \
	$(SOURCEDIR)/test/sig/TestOfKeyPairGeneratorFactory.java \
	$(SOURCEDIR)/test/sig/TestOfSignatureFactory.java \
	\
	$(SOURCEDIR)/test/sig/dss/AllTests.java \
	$(SOURCEDIR)/test/sig/dss/TestOfDSSCodec.java \
	$(SOURCEDIR)/test/sig/dss/TestOfDSSKeyGeneration.java \
	$(SOURCEDIR)/test/sig/dss/TestOfDSSSignature.java \
	\
	$(SOURCEDIR)/test/sig/rsa/AllTests.java \
	$(SOURCEDIR)/test/sig/rsa/TestOfRSACodec.java \
	$(SOURCEDIR)/test/sig/rsa/TestOfRSAKeyGeneration.java \
	$(SOURCEDIR)/test/sig/rsa/TestOfRSAPSSSignature.java

TVFILES = \
	tv/nist/anubis/cbc_d_m.txt \
	tv/nist/anubis/cbc_e_m.txt \
	tv/nist/anubis/ecb_d_m.txt \
	tv/nist/anubis/ecb_e_m.txt \
	tv/nist/anubis/ecb_vk.txt \
	tv/nist/anubis/ecb_vt.txt \
	\
	tv/nist/khazad/ecb_vk.txt \
	tv/nist/khazad/ecb_vt.txt \
	\
	tv/nist/rijndael/cbc_d_m.txt \
	tv/nist/rijndael/cbc_e_m.txt \
	tv/nist/rijndael/ecb_d_m.txt \
	tv/nist/rijndael/ecb_e_m.txt \
	tv/nist/rijndael/ecb_vk.txt \
	tv/nist/rijndael/ecb_vt.txt \
	\
	tv/nist/serpent/cbc_d_m.txt \
	tv/nist/serpent/cbc_e_m.txt \
	tv/nist/serpent/ecb_d_m.txt \
	tv/nist/serpent/ecb_e_m.txt \
	tv/nist/serpent/ecb_vk.txt \
	tv/nist/serpent/ecb_vt.txt \
	\
	tv/nist/square/ecb_vk.txt \
	tv/nist/square/ecb_vt.txt \
	\
	tv/nist/twofish/cbc_d_m.txt \
	tv/nist/twofish/cbc_e_m.txt \
	tv/nist/twofish/ecb_d_m.txt \
	tv/nist/twofish/ecb_e_m.txt \
	tv/nist/twofish/ecb_vk.txt \
	tv/nist/twofish/ecb_vt.txt \
	\
	tv/nessie/anubis-128-tv.txt \
	tv/nessie/anubis-160-tv.txt \
	tv/nessie/anubis-192-tv.txt \
	tv/nessie/anubis-224-tv.txt \
	tv/nessie/anubis-256-tv.txt \
	tv/nessie/anubis-288-tv.txt \
	tv/nessie/anubis-320-tv.txt \
	\
	tv/nessie/khazad-tv.txt \
	\
	tv/nessie/whirlpool-tv.txt

PKGFILES =

#a mangling of the SOURCEFILES list above
#This is not quite perfect, we've had to hardcode the
# $(SOURCEDIR)/ directory in the swap but if we can find a
# way around that we'll be laughing!
CLASSESLIST=$(subst .java,.class,$(subst $(SOURCEDIR)/,$(CC-DESTDIR)/,$(foreach dir,$(SOURCEFILES),$(dir))))
TESTLIST=$(subst .java,.class,$(subst $(SOURCEDIR)/,$(CC-DESTDIR)/,$(foreach dir,$(TESTFILES),$(dir))))

#the classpath for compilations
CC-CLASSPATH=classes
CC-TEST-CLASSPATH=classes lib/junit.jar $(LIBNAME).jar

# a workaround to allow using the same Makefile under both Unix and NT
ifeq (${OS},Windows_NT)
	PS:=;
else
	PS:=:
endif
CPATH = $(subst $(space),$(PS),$(CC-CLASSPATH))
CTESTPATH = $(subst $(space),$(PS),$(CC-TEST-CLASSPATH))

#the desination directory for compilations
CC-DESTDIR = classes

#
# Compiler is chosen through "configure" (autoconf)
#
GCJ_OPTS = --encoding=8859_1 -fsyntax-only -femit-class-files
GCJ_COMPILE = $(GCJ) $(GCJ_OPTS) -Isource -foutput-class-dir=$(CC-DESTDIR)
JAVAC_COMPILE = javac -sourcepath source -classpath "$(CPATH)" -d $(CC-DESTDIR)
JAVAC_COMPILE_TEST = javac -sourcepath source -classpath "$(CTESTPATH)" -d $(CC-DESTDIR)

##variables which define some useful constants

newline:=\\n
empty:=
space:=$(empty) $(empty)


#
# REAL TARGETS
#

default:	jar

all:	jar javadoc

jar:	lib/$(LIBNAME).jar lib/$(LIBNAME)-test.jar

test:	jar
	java -cp "lib/$(LIBNAME).jar$(PS)lib/$(LIBNAME)-test.jar$(PS)lib/junit.jar" test.AllTests


# for normal development
# must rerun "make" after this
clean:
	-rm -rf lib/$(LIBNAME)* $(CC-DESTDIR) docs/api
	-rm -rf $(LIBNAME)-*.zip
	-rm -rf $(LIBNAME)-*.tar.*
	-rm -rf $(LIBNAME)-*.md5

# must rerun configure after this
distclean:	clean
	-rm -f Makefile config.cache config.log config.status
	-rm -rf lib

# must rerun autoconf (and configure) after this
mrproper:	distclean
	-rm -f configure

javadoc: lib/$(LIBNAME)-doc.zip
lib/$(LIBNAME)-doc.zip:
	-rm -rf docs/api
	mkdir -p docs/api
	javadoc -d docs/api \
		-windowtitle "GNU Crypto Library" \
		-nodeprecatedlist \
		-version -use \
		-doctitle "<H1>GNU Crypto Library<BR>Programmer's Documentation</H1>" \
		\
		-header "For the latest news and information visit<BR> \
		<A HREF="http://www.gnu.org/software/classpathx/crypto">The GNU Crypto project</A>" \
		\
		-bottom "Copyright &copy;2001-2002, <A HREF="mailto:classpathx-crypto@gnu.org"> \
		Free Software Foundation, Inc.</A> All Rights Reserved." \
		-classpath "$(SOURCEDIR)" \
		\
		-group "GNU Crypto Algorithms" \
		"gnu.crypto.cipher:gnu.crypto.hash:gnu.crypto.mac:gnu.crypto.mode:gnu.crypto.pad:gnu.crypto.prng" \
		\
		-group "GNU Crypto Signature Schemes" \
		"gnu.crypto.sig" \
		\
		-group "GNU Crypto JCE Adapters" \
		"gnu.crypto.jce" \
		\
		-group "GNU Crypto Experimental Algorithms" \
		"gnu.crypto.exp" \
		\
		-group "GNU Crypto Tools" \
		"gnu.crypto.tool" \
		\
		-group "GNU Crypto utilities" \
		"gnu.crypto.util" \
		\
		gnu.crypto \
		gnu.crypto.cipher \
		gnu.crypto.exp.ust \
		gnu.crypto.hash \
		gnu.crypto.jce \
		gnu.crypto.mac \
		gnu.crypto.mode \
		gnu.crypto.pad \
		gnu.crypto.prng \
		gnu.crypto.sig \
		gnu.crypto.sig.dss \
		gnu.crypto.sig.rsa \
		gnu.crypto.tool \
		gnu.crypto.util
	jar cMf lib/$(LIBNAME)-doc.zip -C docs api

# build the main jar file
lib/$(LIBNAME).jar: lib $(LIBNAME) $(CC-DESTDIR)
	mkdir ./tmp
	cp AUTHORS ChangeLog COPYING LICENSE README NEWS THANKS ./tmp
	cp -R $(CC-DESTDIR)/gnu/ ./tmp
	cd ./tmp; jar cmf ../etc/$(LIBNAME).mf ../lib/$(LIBNAME).jar *
	rm -rf ./tmp

# build the test jar file
lib/$(LIBNAME)-test.jar: lib lib/$(LIBNAME).jar lib/junit.jar $(LIBNAME)-test $(CC-DESTDIR)
	mkdir ./tmp
	cp AUTHORS ChangeLog COPYING LICENSE README NEWS THANKS ./tmp
	cp -R $(CC-DESTDIR)/test/ ./tmp
	cd ./tmp; jar cf ../lib/$(LIBNAME)-test.jar *
	rm -rf ./tmp


$(LIBNAME): compile


#the compilation target
#This is intended for developers who are constantly compiling stuff
#
#NOTE: this has to use a shell if test because the GNU-Make $(wildcard)
#doesn't work properly. If it did we could do this:
#
#  compile: $(CLASSLIST)
#  ifeq "$(wildcard filelist.mak)" "filelist.mak"
#	$(@COMPILER@_COMPILE) @filelist.mak
#	@rm filelist.mak
#  else
#	@echo Nothing to be done for compile.
#  endif
#
#I think that would be a lot better and have reported the fault with
#the $(wildcard) function to bug-make@gnu.org.
#The problem is that it does not recognise the existance of files created
#within commands caused by pre-requisites.

compile: $(CLASSESLIST)
	mkdir -p $(CC-DESTDIR)
	if [ -e filelist.mak ] ; then \
	  $(@COMPILER@_COMPILE) @filelist.mak ; \
	  rm filelist.mak ; \
	fi

$(LIBNAME)-test: $(TESTLIST)
	mkdir -p $(CC-DESTDIR)
	if [ -e filelist.mak ] ; then \
	  $(@COMPILER@_COMPILE_TEST) @filelist.mak ; \
	  rm filelist.mak ; \
	fi

#recompile all the source files
.PHONY: recompile recompile-test

recompile: clean-filelist all-source-files
	$(@COMPILER@_COMPILE) @filelist.mak
	rm filelist.mak

recompile-test: clean-filelist all-test-files
	$(@COMPILER@_COMPILE_TEST) @filelist.mak
	rm filelist.mak


#make the source file list be the list of all files
.PHONY: all-source-files all-test-source-files

all-source-files:
	$(foreach f,$(SOURCEFILES),$(shell echo $(f) >> filelist.mak))

all-test-files:
	$(foreach f,$(TESTFILES),$(shell echo $(f) >> filelist.mak))


#ensures that the filelist is fresh each time
#This simply removes the file list (after ensuring that it exists)
.PHONY: clean-filelist

clean-filelist:
	rm -f filelist.mak

#target matching class files to source files
$(CC-DESTDIR)/%.class: $(SOURCEDIR)/%.java
	@echo $? >> filelist.mak


#
# RELEASE ENGINEERING:
# "full" release has source, jarfile, javadoc, and extras
#
# override VERSION in environment, like:
#  $ VERSION=1.0beta1 make -e release
#
VERSION =	dev

release: $(LIBNAME)-$(VERSION).zip $(LIBNAME)-$(VERSION)-tv.zip $(LIBNAME)-$(VERSION).md5


DIST_DIR =	$(LIBNAME)-$(VERSION)

# XXX ChangeLog
TOPLEVELFILES := \
	AUTHORS ChangeLog COPYING LICENSE NEWS README THANKS \
	.ant.properties build.xml configure configure.in Makefile.in

FILES := \
	$(TOPLEVELFILES) \
	etc/$(LIBNAME).mf \
	lib/$(LIBNAME).jar lib/$(LIBNAME)-test.jar  \


test-vectors:
	@ test -e tv || mkdir tv
	@ test -e tv/nessie || mkdir tv/nessie
	@ test -e tv/nist || mkdir tv/nist
	@ test -e tv/nist/anubis || mkdir tv/nist/anubis
	@ test -e tv/nist/rijndael || mkdir tv/nist/rijndael
	@ test -e tv/nist/serpent || mkdir tv/nist/serpent
	@ test -e tv/nist/twofish || mkdir tv/nist/twofish
	@ test -e tv/nist/khazad || mkdir tv/nist/khazad
	@ test -e tv/nist/square || mkdir tv/nist/square
	java -cp "lib/$(LIBNAME).jar" gnu.crypto.tool.NessieCipherTVEmitter anubis 128 > tv/nessie/anubis-128-tv.txt
	java -cp "lib/$(LIBNAME).jar" gnu.crypto.tool.NessieCipherTVEmitter anubis 160 > tv/nessie/anubis-160-tv.txt
	java -cp "lib/$(LIBNAME).jar" gnu.crypto.tool.NessieCipherTVEmitter anubis 192 > tv/nessie/anubis-192-tv.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NessieCipherTVEmitter anubis 224 > tv/nessie/anubis-224-tv.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NessieCipherTVEmitter anubis 256 > tv/nessie/anubis-256-tv.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NessieCipherTVEmitter anubis 288 > tv/nessie/anubis-288-tv.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NessieCipherTVEmitter anubis 320 > tv/nessie/anubis-320-tv.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NessieCipherTVEmitter khazad     > tv/nessie/khazad-tv.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NessieHashTVEmitter whirlpool    > tv/nessie/whirlpool-tv.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -k anubis > tv/nist/anubis/ecb_vk.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -t anubis > tv/nist/anubis/ecb_vt.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -k rijndael > tv/nist/rijndael/ecb_vk.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -t rijndael > tv/nist/rijndael/ecb_vt.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -k serpent > tv/nist/serpent/ecb_vk.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -t serpent > tv/nist/serpent/ecb_vt.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -k twofish > tv/nist/twofish/ecb_vk.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -t twofish > tv/nist/twofish/ecb_vt.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -k khazad 128 > tv/nist/khazad/ecb_vk.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -t khazad 128 > tv/nist/khazad/ecb_vt.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -k square 128 > tv/nist/square/ecb_vk.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistKat -t square 128 > tv/nist/square/ecb_vt.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -E -e anubis > tv/nist/anubis/ecb_e_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -E -d anubis > tv/nist/anubis/ecb_d_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -C -e anubis > tv/nist/anubis/cbc_e_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -C -d anubis > tv/nist/anubis/cbc_d_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -E -e rijndael > tv/nist/rijndael/ecb_e_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -E -d rijndael > tv/nist/rijndael/ecb_d_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -C -e rijndael > tv/nist/rijndael/cbc_e_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -C -d rijndael > tv/nist/rijndael/cbc_d_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -E -e serpent > tv/nist/serpent/ecb_e_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -E -d serpent > tv/nist/serpent/ecb_d_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -C -e serpent > tv/nist/serpent/cbc_e_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -C -d serpent > tv/nist/serpent/cbc_d_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -E -e twofish > tv/nist/twofish/ecb_e_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -E -d twofish > tv/nist/twofish/ecb_d_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -C -e twofish > tv/nist/twofish/cbc_e_m.txt
	java -cp "lib/$(LIBNAME).jar"  gnu.crypto.tool.NistMCT -C -d twofish > tv/nist/twofish/cbc_d_m.txt

$(LIBNAME)-$(VERSION).zip: test javadoc $(FILES) $(SOURCEFILES) $(TESTFILES) $(PKGFILES)
	for F in $(FILES) $(SOURCEFILES) $(PKGFILES) ;\
	do \
		 mkdir -p `dirname $(DIST_DIR)/$$F` ;\
		 cp $$F $(DIST_DIR)/$$F ;\
	done
	mkdir $(DIST_DIR)/docs
	cd $(DIST_DIR)/docs; jar xf ../../lib/$(LIBNAME)-doc.zip
	chmod +x $(DIST_DIR)/configure
	# jar cMf $(LIBNAME)-$(VERSION).zip $(DIST_DIR)
	zip -qr9 $(LIBNAME)-$(VERSION).zip $(DIST_DIR)
	tar -cf $(LIBNAME)-$(VERSION).tar $(DIST_DIR)
	gzip $(LIBNAME)-$(VERSION).tar
	tar -cf $(LIBNAME)-$(VERSION).tar $(DIST_DIR)
	bzip2 $(LIBNAME)-$(VERSION).tar
	rm -rf $(DIST_DIR)

$(LIBNAME)-$(VERSION)-tv.zip: test-vectors $(TOPLEVELFILES)
	for F in $(TOPLEVELFILES) $(TVFILES) ;\
	do \
		 mkdir -p `dirname $(DIST_DIR)/$$F` ;\
		 cp $$F $(DIST_DIR)/$$F ;\
	done
	chmod +x $(DIST_DIR)/configure
	zip -qr9 $(LIBNAME)-$(VERSION)-tv.zip $(DIST_DIR)
	tar -cf $(LIBNAME)-$(VERSION)-tv.tar $(DIST_DIR)
	gzip $(LIBNAME)-$(VERSION)-tv.tar
	tar -cf $(LIBNAME)-$(VERSION)-tv.tar $(DIST_DIR)
	bzip2 $(LIBNAME)-$(VERSION)-tv.tar
	rm -rf $(DIST_DIR)

$(LIBNAME)-$(VERSION).md5:
	md5sum -b \
		$(LIBNAME)-$(VERSION).zip $(LIBNAME)-$(VERSION).tar.gz $(LIBNAME)-$(VERSION).tar.bz2 \
		$(LIBNAME)-$(VERSION)-tv.zip $(LIBNAME)-$(VERSION)-tv.tar.gz $(LIBNAME)-$(VERSION)-tv.tar.bz2 \
		>$@

# setup required jars
JUNITVERSION:=3.7

lib/junit.jar: lib junit$(JUNITVERSION).zip
	if ! [ -e lib/junit.jar ] ; then \
		unzip -o junit$(JUNITVERSION).zip ;\
		mv junit$(JUNITVERSION)/junit.jar lib/ ;\
		rm -rf ./junit$(JUNITVERSION) ;\
	fi

lib:
	mkdir $@

junit$(JUNITVERSION).zip:
	wget -v -t 2 -O ./junit$(JUNITVERSION).zip http://download.sourceforge.net/junit/junit$(JUNITVERSION).zip

