SUBDIRS=asm stuff
noinst_LIBRARIES=libbn.a
TESTS=bntest exptest
EXTRA_PROGRAMS=bnspeed bntest exptest
INCLUDES=-I$(top_srcdir)/crypto

libbn_a_SOURCES=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_mod.c \
	bn_mul.c bn_print.c bn_rand.c bn_shift.c bn_sub.c bn_word.c \
	bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_recp.c bn_mont.c
EXTRA_libbn_a_SOURCES=bn_mulw.c
libbn_a_LIBADD=$(BN_MULW)
libbn_a_DEPENDENCIES=$(BN_MULW)

bnspeed_SOURCES=bnspeed.c
bnspeed_LDADD=-lcrypto
bnspeed_LDFLAGS=-L$(top_builddir)/crypto
bnspeed_DEPENDENCIES=$(top_builddir)/crypto/libcrypto.a

bntest_SOURCES=bntest.c
bntest_LDADD=-lcrypto
bntest_LDFLAGS=-L$(top_builddir)/crypto
bntest_DEPENDENCIES=$(top_builddir)/crypto/libcrypto.a

exptest_SOURCES=exptest.c
exptest_LDADD=-lcrypto
exptest_LDFLAGS=-L$(top_builddir)/crypto
exptest_DEPENDENCIES=$(top_builddir)/crypto/libcrypto.a

EXTRA_DIST=Makefile.ssl bn.err bn.h bn.org bn_bld.c bn_lcl.h bn_prime.h \
	bn_prime.pl

errors bn_err.c bn.h: bn.err
	perl $(top_srcdir)/util/err-ins.pl bn.err bn.h
	perl $(top_srcdir)/crypto/err/err_genc.pl bn.h bn_err.c

$(top_builddir)/crypto/libcrypto.a:
	cd $(top_builddir)/crypto; $(MAKE) $(MFLAGS) libcrypto.a

if ASM_BN_MULW
$(BN_MULW):
	cd asm; $(MAKE) $(MFLAGS) "`basename $(BN_MULW)`"
endif
