#
# Makefile for all the SSL related library routines and utilities
VERSION	= 0.4.4
#
# 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
#
# 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>
#	or both    <ssleay@mincom.oz.au>
#
# NOCONT - Define for C compilers that don't like the const key word.
# PROTO  - Define in if your compiler supports prototypes.
# RSAref - Define if we are to link with RSAref.
# NOIDEA - Define to build without the IDEA algorithm
# NORC4  - Define to build without the RC4 algorithm

CC= gcc
CFLAG= -O3 -mv8 -DPROTO
EX_LIBS= 
PEX_LIBS= #-L../rsa -lRSAglue
INSTALLTOP=/usr/local/ssl

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

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

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

all:
	for i in $(DIRS) ;\
	do \
	(cd $$i; echo "making $$i..."; \
	make CC=${CC} CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' 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)

dclean:
	for i in $(DIRS) ;\
	do \
	(cd $$i; echo "undoing makedepend in $$i..."; \
	make dclean ); \
	done;

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

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

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

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

tar:
	( cd ..;\
	mv $(BASENAME) $(NAME); \
	export STUFF; \
	for i in $(MISC) $(DIRS) $(EDIRS) ;\
	do \
		STUFF="$$STUFF $(NAME)/$$i"; \
	done; \
	tar cf $(NAME)/$(TARFILE) $$STUFF; \
	mv $(NAME) $(BASENAME) ) 
	gzip -f $(TARFILE)

dist:
	make clean
	make dclean
	make tar

install: all
	@-mkdir -p $(INSTALLTOP)/bin 2>/dev/null
	@-mkdir -p $(INSTALLTOP)/lib 2>/dev/null
	@-mkdir -p $(INSTALLTOP)/include 2>/dev/null
	@-mkdir -p $(INSTALLTOP)/certs 2>/dev/null
	@-mkdir -p $(INSTALLTOP)/private 2>/dev/null
	for i in $(DIRS) ;\
	do \
	(cd $$i; echo "installing $$i..."; \
	make CC=${CC} CFLAG='${CFLAG}' 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.
