#
# Makefile for all the SSL related library routines and utilities
VERSION	= 0.4.2b
#
# make install will install:
#   libraries into $INSTALLTOP/lib
#   headers   into $INSTALLTOP/include
#   utilities into $INSTALLTOP/bin
#
# By default INSTALLTOP is set to /usr/local/ssl
#
# 27-May-95 tjh    put some more comments in here as Eric is too busy 
# ................ to think about how people will find their way around
#
# Interesting Mailing Lists:
#     ssl-bugs@mincom.oz.au
#     ssl-users@mincom.oz.au
#     ssl-users-request@mincom.oz.au
#
# If you must get hold of people directly (we much prefer the above
# lists to be used!):
#
#     Eric Young
#     eay@mincom.oz.au
#
#     Tim Hudson
#     tjh@mincom.oz.au
#

CC=cc 
INCLUDES=-I../md -I../lhash -I../rc4 -I../rsa -I../des -I../idea
CFLAGS= -O -DRAND -DDG_GCC_BUG -DIRIX_CC_BUG $(INCLUDES)
#EX_LIBS= -lsocket -lnsl
#EX_LIBS= -L.. -lefence -lsocket -lnsl
INSTALLTOP=/home/eay/lib/lib
INSTALLTOP=/usr/local/ssl

MAN1=1
MAN3=3
SHELL=/bin/sh

DIRS=	des idea md rc4 lhash rsa ssl
EDIRS=	times doc bugs
MISC=	README COPYRIGHT PORTING TODO Makefile FILES VERSION RAMBLINGS
LIB=	libcrypto.a
LIBS=	des/libdes.a

GENERAL=Makefile
TARFILE=SSLeay-$(VERSION).tar

all:
	for i in $(DIRS) ;\
	do \
	(cd $$i; echo "making $$i..."; \
	make CC=${CC} CFLAGS='${CFLAGS}' INSTALLTOP='${INSTALLTOP}' EX_LIBS='${EX_LIBS}' all ); \
	done;

clean:
	for i in $(DIRS) ;\
	do \
	(cd $$i; echo "cleaning $$i..."; \
	make clean ); \
	/bin/rm -f $(LIB); \
	done;
	/bin/rm -f $(TARFILE)

test:
	for i in $(DIRS) ;\
	do \
	(cd $$i; echo "testing $$i..."; \
	make CC=${CC} CFLAGS='${CFLAGS}' EX_LIBS='${EX_LIBS}' test ); \
	done;

tags:
	for i in $(DIRS) ;\
	do \
	(cd $$i; echo "making tags $$i..."; \
	make tags ); \
	done;

tar:
	make clean
	tar cf $(TARFILE) $(DIRS) $(EDIRS) $(MISC)

install:
	# make sure the required directories are there
	@-mkdir -p $(INSTALLTOP)/bin 2>/dev/null
	@-mkdir -p $(INSTALLTOP)/lib 2>/dev/null
	@-mkdir -p $(INSTALLTOP)/include 2>/dev/null
	@-mkdir -p $(INSTALLTOP)/cert 2>/dev/null
	for i in $(DIRS) ;\
	do \
	(cd $$i; echo "installing $$i..."; \
	make CC=${CC} CFLAGS='${CFLAGS}' INSTALLTOP='${INSTALLTOP}' EX_LIBS='${EX_LIBS}' install ); \
	done
	cp $(LIB) $(INSTALLTOP)/lib; \
	if test -s /bin/ranlib; then \
	    /bin/ranlib $(INSTALLTOP)/lib/$(LIB); \
	else if test -s /usr/bin/ranlib; then \
	    /usr/bin/ranlib $(INSTALLTOP)/lib/$(LIB); \
	fi; fi; \
	chmod 644 $(INSTALLTOP)/lib/$(LIB)

# DO NOT DELETE THIS LINE -- make depend depends on it.
