Add full support for -rpath/-R, both in shared libraries and
authorRichard Levitte <levitte@openssl.org>
Thu, 13 Feb 2003 23:52:54 +0000 (23:52 +0000)
committerRichard Levitte <levitte@openssl.org>
Thu, 13 Feb 2003 23:52:54 +0000 (23:52 +0000)
applications, at least on the platforms where it's known how
to do it.

Note: this has only been tested on GNU-based platforms (Linux), and
needs to be tested on all others.  Additionally, it's not yet
supported on the following platforms, for lack of information:

Darwin (MacOS X)
Cygwin
OSF1/Alpha
SVR3
ReliantUNIX

Please help out with testing and the platforms we don't yet know well
enough.

CHANGES
Makefile.org
Makefile.shared
apps/Makefile.ssl
test/Makefile.ssl

diff --git a/CHANGES b/CHANGES
index 08c0124..4439a67 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,11 @@
 
  Changes between 0.9.7a and 0.9.8  [xx XXX xxxx]
 
+  *) Add full support for -rpath/-R, both in shared libraries and
+     applications, at least on the platforms where it's known how
+     to do it.
+     [Richard Levitte]
+
   *) In crypto/ec/ec_mult.c, implement fast point multiplication with
      precomputation, based on wNAF splitting: EC_GROUP_precompute_mult()
      will now compute a table of multiples of the generator that
index 3568efc..847bceb 100644 (file)
@@ -286,6 +286,7 @@ do_$(SHLIB_TARGET):
                        LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
                        LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
                        LIBDEPS="$$libs $(EX_LIBS)" \
+                       LIBRPATH="$(INSTALLTOP)/lib" \
                        link_a.$(SHLIB_TARGET); \
                libs="$$libs -l$$i"; \
        done
index a3acc98..9178b82 100644 (file)
@@ -7,19 +7,32 @@
 
 # CC contains the current compiler.  This one MUST be defined
 CC=cc
-# LDFLAGS contains flags to be used when the temporary object file is
-# created.  SHARED_LDFLAGS contains flags to be used when the shared
-# library is created.
+# LDFLAGS contains flags to be used when temporary object files (when building
+# shared libraries) are created, or when an application is linked.
+# SHARED_LDFLAGS contains flags to be used when the shared library is created.
 LDFLAGS=
 SHARED_LDFLAGS=
 
-# LIBNAME contains just the name of thhe library, without prefix ("lib"
+# LIBNAME contains just the name of the library, without prefix ("lib"
 # on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
-# .dll, ...).  This one MUST have a value when using this makefile.
+# .dll, ...).  This one MUST have a value when using this makefile to
+# build shared libraries.
 # For example, to build libfoo.so, you need to do the following:
 #LIBNAME=foo
 LIBNAME=
 
+# APPNAME contains just the name of the application, without suffix (""
+# on Unix, ".exe" on Windows, ...).  This one MUST have a value when using
+# this makefile to build applications.
+# For example, to build foo, you need to do the following:
+#APPNAME=foo
+APPNAME=
+
+# OBJECTS contains all the object files to link together into the application.
+# This must contain at least one object file.
+#OBJECTS=foo.o
+OBJECTS=
+
 # LIBEXTRAS contains extra modules to link together with the library.
 # For example, if a second library, say libbar.a needs to be linked into
 # libfoo.so, you need to do the following:
@@ -73,8 +86,12 @@ CALC_VERSIONS=       \
                done; \
        fi
 
+LINK_APP=      \
+  ( $(DEBUG);   \
+    $$LDCMD $(LDFLAGS) $$LDFLAGS -o $$APPNAME $(OBJECTS) $$LIBDEPS )
+
 LINK_SO=       \
-  ( $(DEBUG); \
+  ( $(DEBUG);   \
     nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
     $$SHAREDCMD $(SHARED_LDFLAGS) $$SHAREDFLAGS -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
        $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS ) && \
@@ -111,19 +128,25 @@ LINK_SO_A_UNPACKED=       \
 
 DETECT_GNU_LD=(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
 
-DO_GNU=$(CALC_VERSIONS); \
+DO_GNU_SO=$(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so; \
        SHLIB_SUFFIX=; \
        LIBDEPS="$(LIBDEPS) -lc"; \
        ALLSYMSFLAGS='-Wl,--whole-archive'; \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-       SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+       SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-rpath,$(LIBRPATH)"; \
        SHAREDCMD='$(CC)'
+DO_GNU_APP=LDCMD=$(CC);\
+       LDFLAGS="-Wl,-rpath,$(LIBRPATH)"; \
+       LIBDEPS="$(LIBDEPS) -lc"; \
+       APPNAME=$(APPNAME)
 
 link_o.gnu:
-       @ $(DO_GNU); $(LINK_SO_O)
+       @ $(DO_GNU_SO); $(LINK_SO_O)
 link_a.gnu:
-       @ $(DO_GNU); $(LINK_SO_A)
+       @ $(DO_GNU_SO); $(LINK_SO_A)
+link_app.gnu:
+       @ $(DO_GNU_APP); $(LINK_APP)
 
 # For Darwin AKA Mac OS/X (dyld)
 link_o.darwin:
@@ -158,6 +181,12 @@ link_a.darwin:
                SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
        fi; \
        $(LINK_SO_A)
+link_app.darwin:
+       LDCMD=$(CC);\
+       LDFLAGS=""; \
+       LIBDEPS="$(LIBDEPS) -lc"; \
+       APPNAME="$(APPNAME)"; \
+       $(LINK_APP)
 
 link_o.cygwin:
        @ $(CALC_VERSIONS); \
@@ -183,10 +212,16 @@ link_a.cygwin:
        SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
        SHAREDCMD='${CC}'; \
        $(LINK_SO_A)
+link_app.cygwin:
+       LDCMD=$(CC);\
+       LDFLAGS=""; \
+       LIBDEPS="$(LIBDEPS) -lc"; \
+       APPNAME="$(APPNAME).exe"
+       $(LINK_APP)
 
 link_o.alpha-osf1:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                SHLIB=lib$(LIBNAME).so; \
                SHLIB_SUFFIX=; \
@@ -209,7 +244,7 @@ link_o.alpha-osf1:
        $(LINK_SO_O)
 link_a.alpha-osf1:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                SHLIB=lib$(LIBNAME).so; \
                SHLIB_SUFFIX=; \
@@ -230,12 +265,22 @@ link_a.alpha-osf1:
                fi; \
        fi; \
        $(LINK_SO_A)
+link_app.alpha-osf1:
+       @ if ${DETECT_GNU_LD}; then \
+               $(DO_GNU_APP); \
+       else \
+               LDCMD=$(CC);\
+               LDFLAGS=""; \
+               LIBDEPS="$(LIBDEPS) -lc"; \
+               APPNAME="$(APPNAME)"
+       fi; \
+       $(LINK_APP)
 
 # The difference between alpha-osf1-shared and tru64-shared is the `-msym'
 # option passed to the linker.
 link_o.tru64:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                SHLIB=lib$(LIBNAME).so; \
                SHLIB_SUFFIX=; \
@@ -249,7 +294,7 @@ link_o.tru64:
                SHLIB_SOVER=; \
                ALLSYMSFLAGS='-all'; \
                NOALLSYMSFLAGS='-none'; \
-               SHAREDFLAGS="-shared -msym"; \
+               SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)"; \
                SHAREDCMD='$(CC)'; \
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHAREDFLAGS="$$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
@@ -258,7 +303,7 @@ link_o.tru64:
        $(LINK_SO_O)
 link_a.tru64:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                SHLIB=lib$(LIBNAME).so; \
                SHLIB_SUFFIX=; \
@@ -272,19 +317,29 @@ link_a.tru64:
                SHLIB_SOVER=; \
                ALLSYMSFLAGS='-all'; \
                NOALLSYMSFLAGS='-none'; \
-               SHAREDFLAGS="-shared -msym"; \
+               SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)"; \
                SHAREDCMD='$(CC)'; \
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHAREDFLAGS="$$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
                fi; \
        fi; \
        $(LINK_SO_A)
+link_app.tru64:
+       @ if ${DETECT_GNU_LD}; then \
+               $(DO_GNU_APP); \
+       else \
+               LDCMD=$(CC);\
+               LDFLAGS="-rpath $(LIBRPATH)"; \
+               LIBDEPS="$(LIBDEPS) -lc"; \
+               APPNAME="$(APPNAME)"; \
+       fi; \
+       $(LINK_APP)
 
 # The difference between tru64-shared and tru64-shared-rpath is the
 # -rpath ${LIBRPATH} passed to the linker.
 link_o.tru64-rpath:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                SHLIB=lib$(LIBNAME).so; \
                SHLIB_SUFFIX=; \
@@ -307,7 +362,7 @@ link_o.tru64-rpath:
        $(LINK_SO_O)
 link_a.tru64-rpath:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                SHLIB=lib$(LIBNAME).so; \
                SHLIB_SUFFIX=; \
@@ -328,10 +383,20 @@ link_a.tru64-rpath:
                fi; \
        fi; \
        $(LINK_SO_A)
+link_app.tru64-rpath:
+       @ if ${DETECT_GNU_LD}; then \
+               $(DO_GNU_APP); \
+       else \
+               LDCMD=$(CC);\
+               LDFLAGS="-rpath $(LIBRPATH)"; \
+               LIBDEPS="$(LIBDEPS) -lc"; \
+               APPNAME="$(APPNAME)"; \
+       fi; \
+       $(LINK_APP)
 
 link_o.solaris:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
                MINUSZ='-z '; \
@@ -341,13 +406,13 @@ link_o.solaris:
                LIBDEPS="$(LIBDEPS) -lc"; \
                ALLSYMSFLAGS="$${MINUSZ}allextract"; \
                NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \
-               SHAREDFLAGS="-G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+               SHAREDFLAGS="-G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -R $(LIBRPATH)"; \
                SHAREDCMD='$(CC)'; \
        fi; \
        $(LINK_SO_O)
 link_a.solaris:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
                MINUSZ='-z '; \
@@ -357,16 +422,26 @@ link_a.solaris:
                LIBDEPS="$(LIBDEPS) -lc"; \
                ALLSYMSFLAGS="$${MINUSZ}allextract"; \
                NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \
-               SHAREDFLAGS="-G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+               SHAREDFLAGS="-G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -R $(LIBRPATH)"; \
                SHAREDCMD='$(CC)'; \
        fi; \
        $(LINK_SO_A)
+link_app.solaris:
+       @ if ${DETECT_GNU_LD}; then \
+               $(DO_GNU_APP); \
+       else \
+               LDCMD=$(CC);\
+               LDFLAGS="-R $(LIBRPATH)"; \
+               LIBDEPS="$(LIBDEPS) -lc"; \
+               APPNAME="$(APPNAME)"; \
+       fi; \
+       $(LINK_APP)
 
 # OpenServer 5 native compilers used
 # UnixWare 7 and OpenUNIX 8 native compilers used
 link_o.svr3:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so; \
@@ -380,7 +455,7 @@ link_o.svr3:
        $(LINK_SO_O)
 link_a.svr3:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so; \
@@ -392,10 +467,20 @@ link_a.svr3:
                SHAREDCMD='$(CC)'; \
        fi; \
        $(LINK_SO_A_UNPACKED)
+link_app.svr3:
+       @ if ${DETECT_GNU_LD}; then \
+               $(DO_GNU_APP); \
+       else \
+               LDCMD=$(CC);\
+               LDFLAGS=""; \
+               LIBDEPS="$(LIBDEPS) -lc"; \
+               APPNAME="$(APPNAME)"; \
+       fi; \
+       $(LINK_APP)
 
 link_o.irix:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so; \
@@ -403,13 +488,13 @@ link_o.irix:
                LIBDEPS="$(LIBDEPS) -lc"; \
                ALLSYMSFLAGS='-all'; \
                NOALLSYMSFLAGS=''; \
-               SHAREDFLAGS="-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+               SHAREDFLAGS="-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-rpath,$(LIBRPATH)"; \
                SHAREDCMD='$(CC)'; \
        fi; \
        $(LINK_SO_O)
 link_a.irix:
        @ if ${DETECT_GNU_LD}; then \
-               $(DO_GNU); \
+               $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so; \
@@ -417,10 +502,20 @@ link_a.irix:
                LIBDEPS="$(LIBDEPS) -lc"; \
                ALLSYMSFLAGS='-all'; \
                NOALLSYMSFLAGS=''; \
-               SHAREDFLAGS="-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+               SHAREDFLAGS="-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-rpath,$(LIBRPATH)"; \
                SHAREDCMD='$(CC)'; \
        fi; \
        $(LINK_SO_A)
+link_app.irix:
+       @ if ${DETECT_GNU_LD}; then \
+               $(DO_GNU_APP); \
+       else \
+               LDCMD=$(CC);\
+               LDFLAGS="-Wl,-rpath,$(LIBRPATH)"; \
+               LIBDEPS="$(LIBDEPS) -lc"; \
+               APPNAME="$(APPNAME)"; \
+       fi; \
+       $(LINK_APP)
 
 # HP-UX includes the full pathname of libs we depend on, so we would get
 # ./libcrypto (with ./ as path information) compiled into libssl, hence
@@ -439,7 +534,7 @@ link_o.hpux32:
        LIBDEPS="$(LIBDEPS) -lc"; \
        ALLSYMSFLAGS='-Fl'; \
        NOALLSYMSFLAGS=''; \
-       SHAREDFLAGS="+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+       SHAREDFLAGS="+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX +b $(LIBRPATH)"; \
        SHAREDCMD='/usr/ccs/bin/ld'; \
        $(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 link_a.hpux32:
@@ -449,9 +544,15 @@ link_a.hpux32:
        LIBDEPS="$(LIBDEPS) -lc"; \
        ALLSYMSFLAGS='-Fl'; \
        NOALLSYMSFLAGS=''; \
-       SHAREDFLAGS="+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+       SHAREDFLAGS="+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX +b $(LIBRPATH)"; \
        SHAREDCMD='/usr/ccs/bin/ld'; \
        $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
+link_app.hpux32:
+       LDCMD=$(CC);\
+       LDFLAGS="-Wl,+b,$(LIBRPATH)"; \
+       LIBDEPS="$(LIBDEPS) -lc"; \
+       APPNAME="$(APPNAME)"
+       $(LINK_APP)
 
 # HP-UX includes the full pathname of libs we depend on, so we would get
 # ./libcrypto (with ./ as path information) compiled into libssl, hence
@@ -468,7 +569,7 @@ link_o.hpux64:
        LIBDEPS="$(LIBDEPS) -lc"; \
        ALLSYMSFLAGS='+forceload'; \
        NOALLSYMSFLAGS=''; \
-       SHAREDFLAGS="-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+       SHAREDFLAGS="-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX +b $(LIBRPATH)"; \
        SHAREDCMD='/usr/ccs/bin/ld'; \
        $(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 link_a.hpux64:
@@ -478,9 +579,15 @@ link_a.hpux64:
        LIBDEPS="$(LIBDEPS) -lc"; \
        ALLSYMSFLAGS='+forceload'; \
        NOALLSYMSFLAGS=''; \
-       SHAREDFLAGS="-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+       SHAREDFLAGS="-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX +b $(LIBRPATH)"; \
        SHAREDCMD='/usr/ccs/bin/ld'; \
        $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
+link_app.hpux64:
+       LDCMD=$(CC);\
+       LDFLAGS="-Wl,+b,$(LIBRPATH)"; \
+       LIBDEPS="$(LIBDEPS) -lc"; \
+       APPNAME="$(APPNAME)"
+       $(LINK_APP)
 
 link_o.aix:
        @ $(CALC_VERSIONS); \
@@ -489,7 +596,7 @@ link_o.aix:
        LIBDEPS="$(LIBDEPS) -lc"; \
        ALLSYMSFLAGS='-bnogc'; \
        NOALLSYMSFLAGS=''; \
-       SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE'; \
+       SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE -blibpath:$(LIBRPATH)'; \
        SHAREDCMD='$(CC)'; \
        $(LINK_SO_O)
 link_a.aix:
@@ -499,9 +606,15 @@ link_a.aix:
        LIBDEPS="$(LIBDEPS) -lc"; \
        ALLSYMSFLAGS='-bnogc'; \
        NOALLSYMSFLAGS=''; \
-       SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE'; \
+       SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE -blibpath:$(LIBRPATH)'; \
        SHAREDCMD='$(CC)'; \
        $(LINK_SO_A_VIA_O)
+link_app.aix:
+       LDCMD=$(CC);\
+       LDFLAGS="-blibpath:$(LIBRPATH)"; \
+       LIBDEPS="$(LIBDEPS) -lc"; \
+       APPNAME="$(APPNAME)"
+       $(LINK_APP)
 
 link_o.reliantunix:
        @ $(CALC_VERSIONS); \
@@ -523,6 +636,12 @@ link_a.reliantunix:
        SHAREDFLAGS='-G'; \
        SHAREDCMD='$(CC)'; \
        $(LINK_SO_A_UNPACKED)
+link_app.reliantunix:
+       LDCMD=$(CC);\
+       LDFLAGS=""; \
+       LIBDEPS="$(LIBDEPS) -lc"; \
+       APPNAME="$(APPNAME)"
+       $(LINK_APP)
 
 # Targets to build symbolic links when needed
 symlink.gnu symlink.solaris symlink.svr3 symlink.irix \
@@ -545,43 +664,57 @@ symlink.cygwin symlib.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
 # Compatibility targets
 link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
 link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared: link_a.gnu
+link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
 symlink.bsd-gcc-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
 link_o.darwin-shared: link_o.darwin
 link_a.darwin-shared: link_a.darwin
+link_app.darwin-shared: link_app.darwin
 symlink.darwin-shared: symlink.darwin
 link_o.cygwin-shared: link_o.cygwin
 link_a.cygwin-shared: link_a.cygwin
+link_app.cygwin-shared: link_app.cygwin
 symlink.cygwin-shared: symlink.cygwin
 link_o.alpha-osf1-shared: link_o.alpha-osf1
 link_a.alpha-osf1-shared: link_a.alpha-osf1
+link_app.alpha-osf1-shared: link_app.alpha-osf1
 symlink.alpha-osf1-shared: symlink.alpha-osf1
 link_o.tru64-shared: link_o.tru64
 link_a.tru64-shared: link_a.tru64
+link_app.tru64-shared: link_app.tru64
 symlink.tru64-shared: symlink.tru64
 link_o.tru64-shared-rpath: link_o.tru64-rpath
 link_a.tru64-shared-rpath: link_a.tru64-rpath
+link_app.tru64-shared-rpath: link_app.tru64-rpath
 symlink.tru64-shared-rpath: symlink.tru64-rpath
 link_o.solaris-shared: link_o.solaris
 link_a.solaris-shared: link_a.solaris
+link_app.solaris-shared: link_app.solaris
 symlink.solaris-shared: symlink.solaris
 link_o.svr3-shared: link_o.svr3
 link_a.svr3-shared: link_a.svr3
+link_app.svr3-shared: link_app.svr3
 symlink.svr3-shared: symlink.svr3
 link_o.svr5-shared: link_o.svr3
 link_a.svr5-shared: link_a.svr3
+link_app.svr5-shared: link_app.svr3
 symlink.svr5-shared: symlink.svr3
 link_o.irix-shared: link_o.irix
 link_a.irix-shared: link_a.irix
+link_app.irix-shared: link_app.irix
 symlink.irix-shared: symlink.irix
 link_o.hpux-shared: link_o.hpux32
 link_a.hpux-shared: link_a.hpux32
+link_app.hpux-shared: link_app.hpux32
 symlink.hpux-shared: symlink.hpux32
 link_o.hpux64-shared: link_o.hpux64
 link_a.hpux64-shared: link_a.hpux64
+link_app.hpux64-shared: link_app.hpux64
 symlink.hpux64-shared: symlink.hpux64
 link_o.aix-shared: link_o.aix
 link_a.aix-shared: link_a.aix
+link_app.aix-shared: link_app.aix
 symlink.aix-shared: symlink.aix
 link_o.reliantunix-shared: link_o.reliantunix
 link_a.reliantunix-shared: link_a.reliantunix
+link_app.reliantunix-shared: link_app.reliantunix
 symlink.reliantunix-shared: symlink.reliantunix
index ab266f1..af00023 100644 (file)
@@ -10,7 +10,8 @@ CFLAG=                -g -static
 INSTALL_PREFIX=
 INSTALLTOP=    /usr/local/ssl
 OPENSSLDIR=    /usr/local/ssl
-MAKE=          make -f Makefile.ssl
+NEWMAKE=       make
+MAKE=          $(NEWMAKE) -f Makefile.ssl
 MAKEDEPPROG=   makedepend
 MAKEDEPEND=    $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 MAKEFILE=      Makefile.ssl
@@ -86,7 +87,12 @@ all: exe
 exe:   $(PROGRAM)
 
 req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
-       $(CC) -o req $(CFLAG) sreq.o $(A_OBJ) $(RAND_OBJ) $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=req LDFLAGS="$(CFLAG)" \
+               OBJECTS="sreq.o $(A_OBJ) $(RAND_OBJ)" \
+               LIBDEPS="$(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 sreq.o: req.c 
        $(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c
@@ -144,10 +150,16 @@ $(DLIBCRYPTO):
 $(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
        $(RM) $(PROGRAM)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(DLIBSSL) $(LIBKRB5) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBSSL) $(LIBKRB5) $(DLIBCRYPTO)" ; \
        else \
-         $(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBKRB5) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(PROGRAM) LDFLAGS="$(CFLAG)" \
+               OBJECTS="$(PROGRAM).o $(E_OBJ)" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
        -(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; \
                LIBPATH="`pwd`"; LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; \
                if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
index 6d4d629..a75727b 100644 (file)
@@ -11,7 +11,8 @@ INSTALL_PREFIX=
 OPENSSLDIR=     /usr/local/ssl
 INSTALLTOP=    /usr/local/ssl
 MAKEFILE=      Makefile.ssl
-MAKE=          make -f $(MAKEFILE)
+NEWMAKE=       make
+MAKE=          $(NEWMAKE) -f $(MAKEFILE)
 MAKEDEPPROG=   makedepend
 MAKEDEPEND=    $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 PERL=          perl
@@ -298,199 +299,367 @@ $(DLIBCRYPTO):
 
 $(RSATEST): $(RSATEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(RSATEST) $(CFLAGS) $(RSATEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(RSATEST) $(CFLAGS) $(RSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(RSATEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(RSATEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(BNTEST): $(BNTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(BNTEST) $(CFLAGS) $(BNTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(BNTEST) $(CFLAGS) $(BNTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(BNTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(BNTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(ECTEST): $(ECTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(ECTEST) $(CFLAGS) $(ECTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(ECTEST) $(CFLAGS) $(ECTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(ECTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(ECTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(EXPTEST): $(EXPTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(EXPTEST) $(CFLAGS) $(EXPTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(EXPTEST) $(CFLAGS) $(EXPTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(EXPTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(EXPTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(IDEATEST): $(IDEATEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(IDEATEST) $(CFLAGS) $(IDEATEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(IDEATEST) $(CFLAGS) $(IDEATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(IDEATEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(IDEATEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(MD2TEST): $(MD2TEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(MD2TEST) $(CFLAGS) $(MD2TEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(MD2TEST) $(CFLAGS) $(MD2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(MD2TEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(MD2TEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(SHATEST): $(SHATEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(SHATEST) $(CFLAGS) $(SHATEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(SHATEST) $(CFLAGS) $(SHATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(SHATEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(SHATEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(SHA1TEST): $(SHA1TEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(SHA1TEST) $(CFLAGS) $(SHA1TEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(SHA1TEST) $(CFLAGS) $(SHA1TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(SHA1TEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(SHA1TEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(RMDTEST): $(RMDTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(RMDTEST) $(CFLAGS) $(RMDTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(RMDTEST) $(CFLAGS) $(RMDTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(RMDTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(RMDTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(MDC2TEST): $(MDC2TEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(MDC2TEST) $(CFLAGS) $(MDC2TEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(MDC2TEST) $(CFLAGS) $(MDC2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(MDC2TEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(MDC2TEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(MD4TEST): $(MD4TEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(MD4TEST) $(CFLAGS) $(MD4TEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(MD4TEST) $(CFLAGS) $(MD4TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(MD4TEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(MD4TEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(MD5TEST): $(MD5TEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(MD5TEST) $(CFLAGS) $(MD5TEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(MD5TEST) $(CFLAGS) $(MD5TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(MD5TEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(MD5TEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(HMACTEST): $(HMACTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(HMACTEST) $(CFLAGS) $(HMACTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(HMACTEST) $(CFLAGS) $(HMACTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(HMACTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(HMACTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(RC2TEST): $(RC2TEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(RC2TEST) $(CFLAGS) $(RC2TEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(RC2TEST) $(CFLAGS) $(RC2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(RC2TEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(RC2TEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(BFTEST): $(BFTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(BFTEST) $(CFLAGS) $(BFTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(BFTEST) $(CFLAGS) $(BFTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(BFTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(BFTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(CASTTEST): $(CASTTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(CASTTEST) $(CFLAGS) $(CASTTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(CASTTEST) $(CFLAGS) $(CASTTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(CASTTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(CASTTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(RC4TEST): $(RC4TEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(RC4TEST) $(CFLAGS) $(RC4TEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(RC4TEST) $(CFLAGS) $(RC4TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(RC4TEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(RC4TEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(RC5TEST): $(RC5TEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(RC5TEST) $(CFLAGS) $(RC5TEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(RC5TEST) $(CFLAGS) $(RC5TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(RC5TEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(RC5TEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(DESTEST): $(DESTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(DESTEST) $(CFLAGS) $(DESTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(DESTEST) $(CFLAGS) $(DESTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(DESTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(DESTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(RANDTEST): $(RANDTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(RANDTEST) $(CFLAGS) $(RANDTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(RANDTEST) $(CFLAGS) $(RANDTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(RANDTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(RANDTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(DHTEST): $(DHTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(DHTEST) $(CFLAGS) $(DHTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(DHTEST) $(CFLAGS) $(DHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(DHTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(DHTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(DSATEST): $(DSATEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(DSATEST) $(CFLAGS) $(DSATEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(DSATEST) $(CFLAGS) $(DSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(DSATEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(DSATEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(METHTEST): $(METHTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(METHTEST) $(CFLAGS) $(METHTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(METHTEST) $(CFLAGS) $(METHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(METHTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(METHTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(SSLTEST): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(SSLTEST) $(CFLAGS) $(SSLTEST).o $(PEX_LIBS) $(DLIBSSL) $(LIBKRB5) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBSSL) $(LIBKRB5) $(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(SSLTEST) $(CFLAGS) $(SSLTEST).o $(PEX_LIBS) $(LIBSSL) $(LIBKRB5) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(SSLTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(SSLTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(ENGINETEST): $(ENGINETEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(ENGINETEST) $(CFLAGS) $(ENGINETEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(ENGINETEST) $(CFLAGS) $(ENGINETEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(ENGINETEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(ENGINETEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(EVPTEST): $(EVPTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(EVPTEST) $(CFLAGS) $(EVPTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(EVPTEST) $(CFLAGS) $(EVPTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(EVPTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(EVPTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(ECDSATEST): $(ECDSATEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(ECDSATEST) $(CFLAGS) $(ECDSATEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(ECDSATEST) $(CFLAGS) $(ECDSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(ECDSATEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(ECDSATEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 $(ECDHTEST): $(ECDHTEST).o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o $(ECDHTEST) $(CFLAGS) $(ECDHTEST).o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o $(ECDHTEST) $(CFLAGS) $(ECDHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=$(ECDHTEST) LDFLAGS="$(CFLAGS)" \
+               OBJECTS="$(ECDHTEST).o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 #$(AESTEST).o: $(AESTEST).c
 #      $(CC) -c $(CFLAGS) -DINTERMEDIATE_VALUE_KAT -DTRACE_KAT_MCT $(AESTEST).c
@@ -504,10 +673,16 @@ $(ECDHTEST): $(ECDHTEST).o $(DLIBCRYPTO)
 
 dummytest: dummytest.o $(DLIBCRYPTO)
        if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-         $(CC) -o dummytest $(CFLAGS) dummytest.o $(PEX_LIBS) $(DLIBCRYPTO) $(EX_LIBS) ; \
+         LIBRARIES="$(DLIBCRYPTO)"; \
        else \
-         $(CC) -o dummytest $(CFLAGS) dummytest.o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS) ; \
-       fi
+         LIBRARIES="$(LIBCRYPTO)"; \
+       fi; \
+       $(NEWMAKE) -f $(TOP)/Makefile.shared \
+               APPNAME=dummytest LDFLAGS="$(CFLAGS)" \
+               OBJECTS="dummytest.o" \
+               LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
+               LIBRPATH=$(INSTALLTOP)/lib \
+               link_app.$(SHLIB_TARGET)
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.