update references to new RI RFC
[openssl.git] / Makefile.shared
index 8bc6dd4..3569832 100644 (file)
@@ -93,7 +93,7 @@ LINK_APP=     \
   ( $(SET_X);   \
     LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
     LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \
-    LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
+    LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
     LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
     LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
     $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
@@ -103,7 +103,7 @@ LINK_SO=    \
     LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
     SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
     SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
-    LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
+    LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
     LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
     LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
     $${SHAREDCMD} $${SHAREDFLAGS} \
@@ -144,7 +144,7 @@ LINK_SO_A_UNPACKED= \
   SHOBJECTS=$$UNPACKDIR/*.o; \
   $(LINK_SO) && rm -rf $$UNPACKDIR
 
-DETECT_GNU_LD=(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
+DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
 
 DO_GNU_SO=$(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so; \
@@ -182,7 +182,7 @@ link_a.beos:
        @ $(DO_BEOS_SO); $(LINK_SO_A)
 
 link_o.bsd:
-       @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
+       @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
        $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so; \
        SHLIB_SUFFIX=; \
@@ -192,7 +192,7 @@ link_o.bsd:
        SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
        fi; $(LINK_SO_O)
 link_a.bsd:
-       @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
+       @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
        $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so; \
        SHLIB_SUFFIX=; \
@@ -202,7 +202,7 @@ link_a.bsd:
        SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
        fi; $(LINK_SO_A)
 link_app.bsd:
-       @if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
+       @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
        LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBPATH)"; \
        fi; $(LINK_APP)
 
@@ -238,7 +238,7 @@ link_a.darwin:
        if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
                SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
        fi; \
-       SHAREDFLAGS="$$SHAREDFLAGS -install_name ${INSTALLTOP}/lib/$$SHLIB${SHLIB_EXT}"; \
+       SHAREDFLAGS="$$SHAREDFLAGS -install_name $(INSTALLTOP)/$(LIBDIR)/$$SHLIB$(SHLIB_EXT)"; \
        $(LINK_SO_A)
 link_app.darwin:       # is there run-path on darwin?
        $(LINK_APP)
@@ -248,16 +248,21 @@ link_o.cygwin:
        INHIBIT_SYMLINKS=yes; \
        SHLIB=cyg$(LIBNAME); \
        base=-Wl,--enable-auto-image-base; \
+       deffile=; \
        if expr $(PLATFORM) : 'mingw' > /dev/null; then \
-                SHLIB=$(LIBNAME); base=; \
+               SHLIB=$(LIBNAME)eay32; base=; \
+               if test -f $(LIBNAME)eay32.def; then \
+                       deffile=$(LIBNAME)eay32.def; \
+               fi; \
        fi; \
        SHLIB_SUFFIX=.dll; \
        LIBVERSION="$(LIBVERSION)"; \
        SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
        ALLSYMSFLAGS='-Wl,--whole-archive'; \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-       SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-s,-Bsymbolic"; \
+       SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-s,-Bsymbolic"; \
        $(LINK_SO_O)
+#for mingw target if def-file is in use dll-name should match library-name
 link_a.cygwin:
        @ $(CALC_VERSIONS); \
        INHIBIT_SYMLINKS=yes; \
@@ -265,14 +270,18 @@ link_a.cygwin:
        dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; extras=; \
        base=-Wl,--enable-auto-image-base; \
        if expr $(PLATFORM) : 'mingw' > /dev/null; then \
-               SHLIB=$(LIBNAME); SHLIB_SOVER=32; \
+               case $(LIBNAME) in \
+                       crypto) SHLIB=libeay;; \
+                       ssl) SHLIB=ssleay;; \
+               esac; \
+               SHLIB_SOVER=32; \
                extras="$(LIBNAME).def"; \
-               $(PERL) util/mkdef.pl 32 $(LIBNAME) > $$extras; \
+               $(PERL) util/mkdef.pl 32 $$SHLIB > $$extras; \
                base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
        fi; \
        dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
        $(PERL) util/mkrc.pl $$dll_name | \
-               $(CROSS_COMPILE_PREFIX)windres -o rc.o; \
+               $(CROSS_COMPILE)windres -o rc.o; \
        extras="$$extras rc.o"; \
        ALLSYMSFLAGS='-Wl,--whole-archive'; \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
@@ -291,7 +300,7 @@ link_app.cygwin:
        $(LINK_APP)
 
 link_o.alpha-osf1:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                SHLIB=lib$(LIBNAME).so; \
@@ -312,7 +321,7 @@ link_o.alpha-osf1:
        fi; \
        $(LINK_SO_O)
 link_a.alpha-osf1:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                SHLIB=lib$(LIBNAME).so; \
@@ -333,7 +342,7 @@ link_a.alpha-osf1:
        fi; \
        $(LINK_SO_A)
 link_app.alpha-osf1:
-       @if ${DETECT_GNU_LD}; then \
+       @if $(DETECT_GNU_LD); then \
                $(DO_GNU_APP); \
        else \
                LDFLAGS="$(CFLAGS) -rpath $(LIBRPATH)"; \
@@ -341,7 +350,7 @@ link_app.alpha-osf1:
        $(LINK_APP)
 
 link_o.solaris:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
@@ -355,12 +364,12 @@ link_o.solaris:
        fi; \
        $(LINK_SO_O)
 link_a.solaris:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
                MINUSZ='-z '; \
-               (${CC} -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
+               ($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
                SHLIB=lib$(LIBNAME).so; \
                SHLIB_SUFFIX=;\
                ALLSYMSFLAGS="$${MINUSZ}allextract"; \
@@ -369,7 +378,7 @@ link_a.solaris:
        fi; \
        $(LINK_SO_A)
 link_app.solaris:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_APP); \
        else \
                LDFLAGS="$(CFLAGS) -R $(LIBRPATH)"; \
@@ -378,7 +387,7 @@ link_app.solaris:
 
 # OpenServer 5 native compilers used
 link_o.svr3:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
@@ -390,7 +399,7 @@ link_o.svr3:
        fi; \
        $(LINK_SO_O)
 link_a.svr3:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
@@ -402,12 +411,12 @@ link_a.svr3:
        fi; \
        $(LINK_SO_A_UNPACKED)
 link_app.svr3:
-       @${DETECT_GNU_LD} && $(DO_GNU_APP); \
+       @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
        $(LINK_APP)
 
 # UnixWare 7 and OpenUNIX 8 native compilers used
 link_o.svr5:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
@@ -421,12 +430,12 @@ link_o.svr5:
        fi; \
        $(LINK_SO_O)
 link_a.svr5:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
                SHARE_FLAG='-G'; \
-               (${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
+               ($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
                SHLIB=lib$(LIBNAME).so; \
                SHLIB_SUFFIX=; \
                ALLSYMSFLAGS=''; \
@@ -435,11 +444,11 @@ link_a.svr5:
        fi; \
        $(LINK_SO_A_UNPACKED)
 link_app.svr5:
-       @${DETECT_GNU_LD} && $(DO_GNU_APP); \
+       @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
        $(LINK_APP)
 
 link_o.irix:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
@@ -453,7 +462,7 @@ link_o.irix:
        fi; \
        $(LINK_SO_O)
 link_a.irix:
-       @ if ${DETECT_GNU_LD}; then \
+       @ if $(DETECT_GNU_LD); then \
                $(DO_GNU_SO); \
        else \
                $(CALC_VERSIONS); \
@@ -479,7 +488,7 @@ link_app.irix:
 # ELFs by the way].
 #
 link_o.hpux:
-       @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
+       @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
        $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).sl; \
        expr "$(CFLAGS)" : '.*DSO_DLFCN' > /dev/null && SHLIB=lib$(LIBNAME).so; \
@@ -492,7 +501,7 @@ link_o.hpux:
        rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
        $(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 link_a.hpux:
-       @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
+       @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
        $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).sl; \
        expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
@@ -505,30 +514,30 @@ link_a.hpux:
        rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
        $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 link_app.hpux:
-       @if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
+       @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
        LDFLAGS="$(CFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
        fi; \
        $(LINK_APP)
 
 link_o.aix:
        @ $(CALC_VERSIONS); \
-       OBJECT_MODE=`expr x$(SHARED_LDFLAGS) : 'x\-[a-z]*\(64\)'` || :; \
+       OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || :; \
        OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
        SHLIB=lib$(LIBNAME).so; \
        SHLIB_SUFFIX=; \
        ALLSYMSFLAGS=''; \
        NOALLSYMSFLAGS=''; \
-       SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-G,-bexpall,-bnolibpath,-bM:SRE'; \
+       SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
        $(LINK_SO_O);
 link_a.aix:
        @ $(CALC_VERSIONS); \
-       OBJECT_MODE=`expr x$(SHARED_LDFLAGS) : 'x\-[a-z]*\(64\)'` || : ; \
+       OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || : ; \
        OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
        SHLIB=lib$(LIBNAME).so; \
        SHLIB_SUFFIX=; \
        ALLSYMSFLAGS='-bnogc'; \
        NOALLSYMSFLAGS=''; \
-       SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-G,-bexpall,-bnolibpath,-bM:SRE'; \
+       SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
        $(LINK_SO_A_VIA_O)
 link_app.aix:
        LDFLAGS="$(CFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \