Support INSTALL_PREFIX for packagers.

Submitted by:
Reviewed by:
PR:
diff --git a/CHANGES b/CHANGES
index 2f674af..5749404 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,10 @@
 
  Changes between 0.9.2b and 0.9.3
 
+  *) Support INSTALL_PREFIX for package builders, as proposed by
+     David Harris.
+     [Bodo Moeller]
+
   *) New Configure options "threads" and "no-threads".  For systems
      where the proper compiler options are known (currently Solaris
      and Linux), "threads" is the default.
diff --git a/Configure b/Configure
index 7db4330..60fca6a 100755
--- a/Configure
+++ b/Configure
@@ -13,10 +13,16 @@
 my $usage="Usage: Configure [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no-threads] [no-asm] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] os/compiler[:flags]\n";
 
 # Options:
+#
 # --openssldir  install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
 #               --prefix option is given; /usr/local/ssl otherwise)
 # --prefix      prefix for the OpenSSL include, lib and bin directories
 #               (Default: the OPENSSLDIR directory)
+#
+# --install_prefix  Additional prefix for package builders (empty by
+#               default).  This needn't be set in advance, you can
+#               just as well use "make INSTALL_PREFIX=/whatever install".
+#
 # rsaref        use RSAref
 # [no-]threads  [don't] try to create a library that is suitable for
 #               multithreaded applications (default is "threads" if we
@@ -248,8 +254,9 @@
 my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
 	BC-16 CygWin32);
 
-my $installprefix="";
+my $prefix="";
 my $openssldir="";
+my $install_prefix="";
 my $no_threads=0;
 my $threads=0;
 my $no_asm=0;
@@ -321,12 +328,16 @@
 			}
 		elsif (/^--prefix=(.*)$/)
 			{
-			$installprefix=$1;
+			$prefix=$1;
 			}
 		elsif (/^--openssldir=(.*)$/)
 			{
 			$openssldir=$1;
 			}
+		elsif (/^--install.prefix=(.*)$/)
+			{
+			$install_prefix=$1;
+			}
 		else
 			{
 			print STDERR $usage;
@@ -348,14 +359,14 @@
 
 my $IsWindows=scalar grep /^$target$/,@WinTargets;
 
-$openssldir="/usr/local/ssl" if ($openssldir eq "" and $installprefix eq "");
-$installprefix=$openssldir if $installprefix eq "";
+$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
+$prefix=$openssldir if $prefix eq "";
 
 chop $openssldir if $openssldir =~ /\/$/;
-chop $installprefix if $installprefix =~ /\/$/;
+chop $prefix if $prefix =~ /\/$/;
 
-$openssldir=$installprefix . "/ssl" if $openssldir eq "";
-$openssldir=$installprefix . "/" . $openssldir if $openssldir !~ /^\//;
+$openssldir=$prefix . "/ssl" if $openssldir eq "";
+$openssldir=$prefix . "/" . $openssldir if $openssldir !~ /^\//;
 
 
 print "IsWindows=$IsWindows\n";
@@ -457,8 +468,9 @@
 	s/^VERSION=.*/VERSION=$version/;
 	s/^MAJOR=.*/MAJOR=$major/;
 	s/^MINOR=.*/MINOR=$minor/;
-	s/^INSTALLTOP=.*$/INSTALLTOP=$installprefix/;
+	s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
 	s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
+	s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
 	s/^PLATFORM=.*$/PLATFORM=$target/;
 	s/^CC=.*$/CC= $cc/;
 	s/^CFLAG=.*$/CFLAG= $cflags/;
@@ -650,7 +662,7 @@
 
 To compile programs that use the old form <foo.h>,
 usually an additional compiler option will suffice: E.g., add
-     -I$installprefix/include/openssl
+     -I$prefix/include/openssl
 or
      -I$pwd/include/openssl
 to the CFLAGS in the Makefile of the program that you want to compile
diff --git a/INSTALL b/INSTALL
index 2c1b167..294c0b4 100644
--- a/INSTALL
+++ b/INSTALL
@@ -122,6 +122,17 @@
        include/openssl Contains the header files needed if you want to
                        compile programs with libcrypto or libssl.
 
+     Package builders who want to configure the library for standard
+     locations, but have the package installed somewhere else so that
+     it can easily be packaged, can use
+
+       $ make INSTALL_PREFIX=/tmp/package-root install
+
+     (or specify "-install_prefix=/tmp/package-root" as a configure
+     option).  The specified prefix will be prepended to all
+     installation target filenames.
+
+
   NOTE: The header files used to reside directly in the include
   directory, but have now been moved to include/openssl so that
   OpenSSL can co-exist with other libraries which use some of the
diff --git a/Makefile.org b/Makefile.org
index 33f81de..af79054 100644
--- a/Makefile.org
+++ b/Makefile.org
@@ -6,6 +6,10 @@
 MAJOR=
 MINOR=
 PLATFORM=dist
+# INSTALL_PREFIX is for package builders so that they can configure
+# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
+# Normally it is left empty.
+INSTALL_PREFIX=
 INSTALLTOP=/usr/local/ssl
 
 # Do not edit this manually. Use Configure --openssldir=DIR do change this!
@@ -307,24 +311,24 @@
 	(cd crypto/pem; $(MAKE) SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
 
 install: all
-	@-mkdir -p $(INSTALLTOP)/bin 2>/dev/null
-	@-mkdir -p $(INSTALLTOP)/lib 2>/dev/null
-	@-mkdir -p $(INSTALLTOP)/include/openssl 2>/dev/null
-	@-mkdir -p $(OPENSSLDIR)/misc 2>/dev/null
-	@-mkdir -p $(OPENSSLDIR)/certs 2>/dev/null
-	@-mkdir -p $(OPENSSLDIR)/private 2>/dev/null
-	@-mkdir -p $(OPENSSLDIR)/lib 2>/dev/null
+	@-mkdir -p $(INSTALL_PREFIX)$(INSTALLTOP)/bin 2>/dev/null
+	@-mkdir -p $(INSTALL_PREFIX)$(INSTALLTOP)/lib 2>/dev/null
+	@-mkdir -p $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl 2>/dev/null
+	@-mkdir -p $(INSTALL_PREFIX)$(OPENSSLDIR)/misc 2>/dev/null
+	@-mkdir -p $(INSTALL_PREFIX)$(OPENSSLDIR)/certs 2>/dev/null
+	@-mkdir -p $(INSTALL_PREFIX)$(OPENSSLDIR)/private 2>/dev/null
+	@-mkdir -p $(INSTALL_PREFIX)$(OPENSSLDIR)/lib 2>/dev/null
 	@for i in $(DIRS) ;\
 	do \
 	(cd $$i; echo "installing $$i..."; \
-	$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \
+	$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \
 	done
 	@for i in $(LIBS) ;\
 	do \
 	(       echo installing $$i; \
-		cp $$i $(INSTALLTOP)/lib; \
-		$(RANLIB) $(INSTALLTOP)/lib/$$i; \
-		chmod 644 $(INSTALLTOP)/lib/$$i ); \
+		cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
+		$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
+		chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
 	done
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/STATUS b/STATUS
index 245f5ed..8615b04 100644
--- a/STATUS
+++ b/STATUS
@@ -1,6 +1,6 @@
 
   OpenSSL STATUS                           Last modified at
-  ______________                           $Date: 1999/04/27 12:01:53 $
+  ______________                           $Date: 1999/04/29 21:51:00 $
 
   DEVELOPMENT STATE
 
@@ -30,7 +30,6 @@
   AVAILABLE PATCHES
 
     o OCSP (titchenert@certco.com) 
-    o Install prefix for packagers (dharris@drh.net)
     o getenv in ca.c and x509_def.c (jaltman@watsun.cc.columbia.edu)
     o linux dynamic libs (colin@field.medicine.adelaide.edu.au)
     o MingW support (niklas@canit.se)
@@ -95,24 +94,6 @@
                       itself. Then we can avoid a lot of those platform checks
                       which are currently in Configure.
 
-    o  The installation under "make install" produces a very
-       installation layout: $prefix/certs and $prefix/private dirs.  That's
-       not nice. Ralf suggests to move the two certs and private dirs either
-       to $prefix/etc/, $prefix/lib/ or $prefix/share. Alternatively
-       we could also not install the certs at all.
-
-       Status: Ralf +1 for both not installing the certs at all and
-                       moving it to $prefix/etc/. +0 for $prefix/lib/
-                       and $prefix/share.
-               Paul: why is it not nice?
-               Ralf: because it messes up the install dir when
-                     $prefix is not a dedicated area like /usr/local/ssl.
-                     When we move them to a standard subdir like
-                     etc/ lib/ or share/ we don't mess up things
-                     when $prefix is /usr or /usr/local, etc.
-                     Additionally it makes package vendors life
-                     easier....
-
     o  Support for Shared Libraries has to be added at least
        for the major Unix platforms. The details we can rip from the stuff
        Ralf has done for the Apache src/Configure script. Ben wants the
diff --git a/apps/Makefile.ssl b/apps/Makefile.ssl
index 606b206..c985c99 100644
--- a/apps/Makefile.ssl
+++ b/apps/Makefile.ssl
@@ -7,6 +7,7 @@
 CC=		cc
 INCLUDES=	-I../include
 CFLAG=		-g -static
+INSTALL_PREFIX=
 INSTALLTOP=	/usr/local/ssl
 OPENSSLDIR=	/usr/local/ssl
 MAKE=		make -f Makefile.ssl
@@ -91,17 +92,17 @@
 	@for i in $(EXE); \
 	do  \
 	(echo installing $$i; \
-	 cp $$i $(INSTALLTOP)/bin/$$i; \
-	 chmod 755 $(INSTALLTOP)/bin/$$i ); \
+	 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
+	 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
 	 done;
 	@for i in $(SCRIPTS); \
 	do  \
 	(echo installing $$i; \
-	 cp $$i $(OPENSSLDIR)/misc/$$i; \
-	 chmod 755 $(OPENSSLDIR)/misc/$$i ); \
+	 cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
+	 chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
 	 done;
-	cp openssl.cnf $(OPENSSLDIR)/lib; \
-	chmod 644 $(OPENSSLDIR)/lib/openssl.cnf
+	cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR)/lib; \
+	chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/lib/openssl.cnf
 
 tags:
 	ctags $(SRC)
diff --git a/crypto/Makefile.ssl b/crypto/Makefile.ssl
index 8e7a74b..3801361 100644
--- a/crypto/Makefile.ssl
+++ b/crypto/Makefile.ssl
@@ -8,6 +8,8 @@
 INCLUDE=	-I. -I../include
 INCLUDES=	-I.. -I../../include
 CFLAG=		-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=	/usr/local/ssl
 MAKE=           make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -85,7 +87,7 @@
 	@for i in $(SDIRS) ;\
 	do \
 	(cd $$i; echo "making libs in crypto/$$i..."; \
-	$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' lib ); \
+	$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' lib ); \
 	done;
 
 tests:
@@ -98,8 +100,8 @@
 install:
 	@for i in $(EXHEADER) ;\
 	do \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 	@for i in $(SDIRS) ;\
 	do \
diff --git a/crypto/asn1/Makefile.ssl b/crypto/asn1/Makefile.ssl
index ca58b47..d8bfdf5 100644
--- a/crypto/asn1/Makefile.ssl
+++ b/crypto/asn1/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -88,8 +90,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/bf/Makefile.ssl b/crypto/bf/Makefile.ssl
index 4627425..f23fb54 100644
--- a/crypto/bf/Makefile.ssl
+++ b/crypto/bf/Makefile.ssl
@@ -8,6 +8,8 @@
 CPP=	$(CC) -E
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -78,8 +80,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/bio/Makefile.ssl b/crypto/bio/Makefile.ssl
index 9193b06..824b7c9 100644
--- a/crypto/bio/Makefile.ssl
+++ b/crypto/bio/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -60,8 +62,8 @@
 install:
 	@for i in $(EXHEADER); \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/bn/Makefile.ssl b/crypto/bn/Makefile.ssl
index 59506f7..d416366 100644
--- a/crypto/bn/Makefile.ssl
+++ b/crypto/bn/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -119,8 +121,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 exptest:
diff --git a/crypto/buffer/Makefile.ssl b/crypto/buffer/Makefile.ssl
index 298a30f..f89eb53 100644
--- a/crypto/buffer/Makefile.ssl
+++ b/crypto/buffer/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/cast/Makefile.ssl b/crypto/cast/Makefile.ssl
index df4a8f6..0319b7f 100644
--- a/crypto/cast/Makefile.ssl
+++ b/crypto/cast/Makefile.ssl
@@ -8,6 +8,8 @@
 CPP=	$(CC) -E
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -81,8 +83,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/comp/Makefile.ssl b/crypto/comp/Makefile.ssl
index 4927a1d..7f62a12 100644
--- a/crypto/comp/Makefile.ssl
+++ b/crypto/comp/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -55,8 +57,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/conf/Makefile.ssl b/crypto/conf/Makefile.ssl
index c134a35..fe8688d 100644
--- a/crypto/conf/Makefile.ssl
+++ b/crypto/conf/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -53,8 +55,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/des/Makefile.ssl b/crypto/des/Makefile.ssl
index f709906..28dba7a 100644
--- a/crypto/des/Makefile.ssl
+++ b/crypto/des/Makefile.ssl
@@ -8,6 +8,8 @@
 CPP=	$(CC) -E
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -110,8 +112,8 @@
 installs:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/dh/Makefile.ssl b/crypto/dh/Makefile.ssl
index 01391d6..878d605 100644
--- a/crypto/dh/Makefile.ssl
+++ b/crypto/dh/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/dsa/Makefile.ssl b/crypto/dsa/Makefile.ssl
index e4fa420..b7cb72a 100644
--- a/crypto/dsa/Makefile.ssl
+++ b/crypto/dsa/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/err/Makefile.ssl b/crypto/err/Makefile.ssl
index 2d92aed..2823a3e 100644
--- a/crypto/err/Makefile.ssl
+++ b/crypto/err/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/evp/Makefile.ssl b/crypto/evp/Makefile.ssl
index 237f4c2..dec91bd 100644
--- a/crypto/evp/Makefile.ssl
+++ b/crypto/evp/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -79,8 +81,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/hmac/Makefile.ssl b/crypto/hmac/Makefile.ssl
index b1f8776..6452328 100644
--- a/crypto/hmac/Makefile.ssl
+++ b/crypto/hmac/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/idea/Makefile.ssl b/crypto/idea/Makefile.ssl
index 99103c4..3bd3e53 100644
--- a/crypto/idea/Makefile.ssl
+++ b/crypto/idea/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/lhash/Makefile.ssl b/crypto/lhash/Makefile.ssl
index 33e4739..ef769ca 100644
--- a/crypto/lhash/Makefile.ssl
+++ b/crypto/lhash/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/md2/Makefile.ssl b/crypto/md2/Makefile.ssl
index ec23630..6cc3c4e 100644
--- a/crypto/md2/Makefile.ssl
+++ b/crypto/md2/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/md5/Makefile.ssl b/crypto/md5/Makefile.ssl
index ea03dab..e27cfca 100644
--- a/crypto/md5/Makefile.ssl
+++ b/crypto/md5/Makefile.ssl
@@ -8,6 +8,8 @@
 CPP=    $(CC) -E
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=           make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -76,8 +78,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/mdc2/Makefile.ssl b/crypto/mdc2/Makefile.ssl
index dbc1b9d..4d2277a 100644
--- a/crypto/mdc2/Makefile.ssl
+++ b/crypto/mdc2/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/objects/Makefile.ssl b/crypto/objects/Makefile.ssl
index 9e9595e..941aaed 100644
--- a/crypto/objects/Makefile.ssl
+++ b/crypto/objects/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -55,8 +57,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/pem/Makefile.ssl b/crypto/pem/Makefile.ssl
index 0742a0c..288f30f 100644
--- a/crypto/pem/Makefile.ssl
+++ b/crypto/pem/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -53,8 +55,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/pkcs12/Makefile.ssl b/crypto/pkcs12/Makefile.ssl
index f1c4eae..cc7b756 100644
--- a/crypto/pkcs12/Makefile.ssl
+++ b/crypto/pkcs12/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -58,8 +60,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/pkcs7/Makefile.ssl b/crypto/pkcs7/Makefile.ssl
index accb1ab..921061b 100644
--- a/crypto/pkcs7/Makefile.ssl
+++ b/crypto/pkcs7/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -54,8 +56,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/rand/Makefile.ssl b/crypto/rand/Makefile.ssl
index 2d79441..cdaaa15 100644
--- a/crypto/rand/Makefile.ssl
+++ b/crypto/rand/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/rc2/Makefile.ssl b/crypto/rc2/Makefile.ssl
index a536950..542397d 100644
--- a/crypto/rc2/Makefile.ssl
+++ b/crypto/rc2/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/rc4/Makefile.ssl b/crypto/rc4/Makefile.ssl
index c3a699e..0c6637e 100644
--- a/crypto/rc4/Makefile.ssl
+++ b/crypto/rc4/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -80,8 +82,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/rc5/Makefile.ssl b/crypto/rc5/Makefile.ssl
index 08afc7b..d0161d1 100644
--- a/crypto/rc5/Makefile.ssl
+++ b/crypto/rc5/Makefile.ssl
@@ -8,6 +8,8 @@
 CPP=	$(CC) -E
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -78,8 +80,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/ripemd/Makefile.ssl b/crypto/ripemd/Makefile.ssl
index 72738c2..5997402 100644
--- a/crypto/ripemd/Makefile.ssl
+++ b/crypto/ripemd/Makefile.ssl
@@ -8,6 +8,8 @@
 CPP=    $(CC) -E
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=           make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -76,8 +78,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/rsa/Makefile.ssl b/crypto/rsa/Makefile.ssl
index 0ae35d3..612caea 100644
--- a/crypto/rsa/Makefile.ssl
+++ b/crypto/rsa/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -54,8 +56,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/sha/Makefile.ssl b/crypto/sha/Makefile.ssl
index f36a9d9..1477a53 100644
--- a/crypto/sha/Makefile.ssl
+++ b/crypto/sha/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=     cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=           make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -75,8 +77,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/stack/Makefile.ssl b/crypto/stack/Makefile.ssl
index b0291b9..3392b80 100644
--- a/crypto/stack/Makefile.ssl
+++ b/crypto/stack/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/txt_db/Makefile.ssl b/crypto/txt_db/Makefile.ssl
index dc3af5a..77961b3 100644
--- a/crypto/txt_db/Makefile.ssl
+++ b/crypto/txt_db/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES=
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -52,8 +54,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/x509/Makefile.ssl b/crypto/x509/Makefile.ssl
index 2adfb08..6f33825 100644
--- a/crypto/x509/Makefile.ssl
+++ b/crypto/x509/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -62,8 +64,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/crypto/x509v3/Makefile.ssl b/crypto/x509v3/Makefile.ssl
index 4540325..cf6a910 100644
--- a/crypto/x509v3/Makefile.ssl
+++ b/crypto/x509v3/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -56,8 +58,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/rsaref/Makefile.ssl b/rsaref/Makefile.ssl
index 2825566..ca5c855 100644
--- a/rsaref/Makefile.ssl
+++ b/rsaref/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I../crypto -I../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -53,8 +55,8 @@
 
 #	@for i in $(EXHEADER) ; \
 #	do  \
-#	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-#	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+#	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+#	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 #	done;
 
 tags:
diff --git a/ssl/Makefile.ssl b/ssl/Makefile.ssl
index 53a3670..ab34611 100644
--- a/ssl/Makefile.ssl
+++ b/ssl/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I../crypto -I../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -68,8 +70,8 @@
 install:
 	@for i in $(EXHEADER) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/include/openssl/$$i; \
-	chmod 644 $(INSTALLTOP)/include/openssl/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 	done;
 
 tags:
diff --git a/test/Makefile.ssl b/test/Makefile.ssl
index 354564e..04d5738 100644
--- a/test/Makefile.ssl
+++ b/test/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=		cc
 INCLUDES=	-I../include
 CFLAG=		-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=	/usr/local/ssl
 MAKEFILE=	Makefile.ssl
 MAKE=		make -f $(MAKEFILE)
diff --git a/tools/Makefile.ssl b/tools/Makefile.ssl
index 08d4a7c..7e6285b 100644
--- a/tools/Makefile.ssl
+++ b/tools/Makefile.ssl
@@ -7,6 +7,8 @@
 CC=	cc
 INCLUDES= -I.. -I../../include
 CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=/usr/local/ssl
 MAKE=		make -f Makefile.ssl
 MAKEDEPEND=	$(TOP)/util/domd $(TOP)
@@ -24,13 +26,13 @@
 install:
 	@for i in $(APPS) ; \
 	do  \
-	(cp $$i $(INSTALLTOP)/bin/$$i; \
-	chmod 755 $(INSTALLTOP)/bin/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
+	chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
 	done;
 	@for i in $(MISC_APPS) ; \
 	do  \
-	(cp $$i $(OPENSSLTOP)/misc/$$i; \
-	chmod 755 $(OPENSSLTOP)/misc/$$i ); \
+	(cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
+	chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
 	done;
 
 files: