SUBDIRS=demoCA set stuff
bin_PROGRAMS=ssleay
EXTRA_PROGRAMS=pem_mail req
bin_SCRIPTS=CA.sh der_chop
ssldir=$(datadir)/ssl
ssl_DATA=ssleay.cnf

CPPFLAGS=@CPPFLAGS@ -DMONOLITH

ssleay_SOURCES=apps.c asn1pars.c ca.c ciphers.c crl.c crl2p7.c dgst.c dh.c \
	dsa.c dsaparam.c enc.c errstr.c gendh.c gendsa.c genrsa.c pkcs7.c \
	req.c rsa.c s_cb.c s_client.c s_server.c s_socket.c s_time.c \
	sess_id.c speed.c ssleay.c verify.c version.c x509.c

ssleay_LDADD=-lssl -lcrypto
ssleay_LDFLAGS=-L$(top_builddir)/crypto -L$(top_builddir)/ssl
ssleay_DEPENDENCIES=$(top_builddir)/ssl/libssl.a \
	$(top_builddir)/crypto/libcrypto.a

req_SOURCES=apps.c
req_LDADD=sreq.o -lcrypto
req_LDFLAGS=-L$(top_builddir)/crypto
req_DEPENDENCIES=sreq.o $(top_builddir)/crypto/libcrypto.a

pem_mail_SOURCES=apps.c pem_mail.c
pem_mail_LDADD=-lcrypto
pem_mail_LDFLAGS=-L$(top_builddir)/crypto
pem_mail_DEPENDENCIES=$(top_builddir)/crypto/libcrypto.a

EXTRA_DIST=CA.sh Makefile.ssl apps.h bss_file.c c512-key.pem c512-req.pem \
	ca-cert.srl ca-key.pem ca-req.pem client.pem der_chop dh1024.pem \
	dsa-ca.pem dsa-pca.pem dsa1024.pem dsa512.pem eay.c f g_ssleay.pl \
	mklinks pca-cert.srl pca-key.pem pca-req.pem privkey.pem progs.h \
	rmlinks rsa8192.pem s1024key.pem s1024req.pem s512-key.pem \
	s512-req.pem server.pem server2.pem s_apps.h ssleay.cnf test.ssl \
	testCA.pem testdsa.h testrsa.h tkca

BUILT_SOURCES=progs.h

$(top_builddir)/ssl/libssl.a:
	cd $(top_builddir)/ssl; $(MAKE) $(MFLAGS) libssl.a

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

sreq.o: req.c
	$(COMPILE) -UMONOLITH -o sreq.o -c req.c

mklinks rmlinks progs.h: g_ssleay.pl $(ssleay_SOURCES)
	perl g_ssleay.pl verify asn1pars req dgst dh enc gendh errstr \
		ca gendsa pkcs7 crl2p7 crl rsa dsa dsaparam x509 \
		genrsa s_server s_client speed s_time \
		version sess_id ciphers > progs.h

install-exec-local: mklinks
	cd $(bindir); $(SHELL) mklinks
