Eh, -Wl,--whole-archive disappeared from the GNU targets. I've no
[openssl.git] / Makefile.shared
index 83e1bd8..e91804f 100644 (file)
@@ -67,7 +67,7 @@ CALC_VERSIONS=        \
                        SHLIB_SOVER_NODOT=$$v \
                        SHLIB_SOVER=.$$v; \
                        if [ -n "$$prev" ]; then \
-                               SHLIB_COMPAT=$$SHLIB_COMPAT .$$prev; \
+                               SHLIB_COMPAT="$$SHLIB_COMPAT .$$prev"; \
                        fi; \
                        prev=$$v; \
                done; \
@@ -81,7 +81,7 @@ LINK_SO=      \
   $(SYMLINK_SO); ( $(DEBUG); rm -f lib$(LIBNAME).exp )
 SYMLINK_SO=    \
        prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
-       if [ -n "$$SHLIB_COMPAT"]; then \
+       if [ -n "$$SHLIB_COMPAT" ]; then \
                for x in $$SHLIB_COMPAT; do \
                        ( $(DEBUG); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \
                          ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \
@@ -110,33 +110,26 @@ DETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \
        my_ld=`gcc -print-prog-name=ld 2>&1` && \
        [ -n "$$my_ld" ] && \
        $$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
-
-link_o.gnu:
-       @ $(CALC_VERSIONS); \
-       SHLIB=lib$(LIBNAME).so \
-       SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
-       NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
-       SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX" \
-       SHAREDCMD='$(CC)'; \
-       $(LINK_SO_O)
-link_a.gnu:
-       @ $(CALC_VERSIONS); \
+DO_GNU=$(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS='-Wl,--whole-archive' \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
        SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX" \
-       SHAREDCMD='$(CC)'; \
-       $(LINK_SO_A)
+       SHAREDCMD='$(CC)'
+
+link_o.gnu:
+       @ $(DO_GNU); $(LINK_SO_O)
+link_a.gnu:
+       @ $(DO_GNU); $(LINK_SO_A)
 
 # For Darwin AKA Mac OS/X (dyld)
 link_o.darwin:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME) \
        SHLIB_SUFFIX=.dylib \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS='-all_load' \
        NOALLSYMSFLAGS='' \
        SHAREDFLAGS="-dynamiclib" \
@@ -152,7 +145,7 @@ link_a.darwin:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME) \
        SHLIB_SUFFIX=.dylib \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS='-all_load' \
        NOALLSYMSFLAGS='' \
        SHAREDFLAGS="-dynamiclib" \
@@ -168,7 +161,7 @@ link_a.darwin:
 link_o.cygwin:
        @ SHLIB=cyg$(LIBNAME).dll \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        SHLIB_SOVER= \
        ALLSYMSFLAGS='-Wl,--whole-archive' \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
@@ -178,7 +171,7 @@ link_o.cygwin:
 link_a.cygwin:
        @ SHLIB=cyg$(LIBNAME).dll \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        SHLIB_SOVER= \
        ALLSYMSFLAGS='-Wl,--whole-archive' \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
@@ -188,16 +181,11 @@ link_a.cygwin:
 
 link_o.alpha-osf1:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
@@ -212,20 +200,15 @@ link_o.alpha-osf1:
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
                fi; \
-               $(LINK_SO_O); \
-       fi
+       fi; \
+       $(LINK_SO_O)
 link_a.alpha-osf1:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
@@ -240,23 +223,18 @@ link_a.alpha-osf1:
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
                fi; \
-               $(LINK_SO_A); \
-       fi
+       fi; \
+       $(LINK_SO_A)
 
 # 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 \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
@@ -271,20 +249,15 @@ link_o.tru64:
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
                fi; \
-               $(LINK_SO_O); \
-       fi
+       fi; \
+       $(LINK_SO_O)
 link_a.tru64:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
@@ -299,23 +272,18 @@ link_a.tru64:
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
                fi; \
-               $(LINK_SO_A); \
-       fi
+       fi; \
+       $(LINK_SO_A)
 
 # 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 \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
@@ -330,20 +298,15 @@ link_o.tru64-rpath:
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
                fi; \
-               $(LINK_SO_O); \
-       fi
+       fi; \
+       $(LINK_SO_O)
 link_a.tru64-rpath:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
@@ -358,127 +321,97 @@ link_a.tru64-rpath:
                if [ -n "$$SHLIB_HIST" ]; then \
                        SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
                fi; \
-               $(LINK_SO_A); \
-       fi
+       fi; \
+       $(LINK_SO_A)
 
 link_o.solaris:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                ALLSYMSFLAGS='-z allextract' \
                NOALLSYMSFLAGS='' \
                SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_O); \
-       fi
+       fi; \
+       $(LINK_SO_O)
 link_a.solaris:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                ALLSYMSFLAGS='-z allextract' \
                NOALLSYMSFLAGS='' \
                SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_A); \
-       fi
+       fi; \
+       $(LINK_SO_A)
 
 # OpenServer 5 native compilers used
 # UnixWare 7 and OpenUNIX 8 native compilers used
 link_o.svr3:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                ALLSYMSFLAGS='-z allextract' \
                NOALLSYMSFLAGS='' \
                SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_O); \
-       fi
+       fi; \
+       $(LINK_SO_O)
 link_a.svr3:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                ALLSYMSFLAGS='-z allextract' \
                NOALLSYMSFLAGS='' \
                SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_A_UNPACKED); \
-       fi
+       fi; \
+       $(LINK_SO_A_UNPACKED)
 
 link_o.irix:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                ALLSYMSFLAGS='-all' \
                NOALLSYMSFLAGS='' \
                SHAREDFLAGS='-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_O); \
-       fi
+       fi; \
+       $(LINK_SO_O)
 link_a.irix:
        @ if ${DETECT_GNU_LD}; then \
-               $(MAKE) -f $(SHARED_MAKEFILE) CC="$(CC)" LDFLAGS="$(LDFLAGS) \
-                       SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
-                       LIBNAME="$(LIBNAME)" LIBEXTRAS="$(LIBEXTRAS)" \
-                       LIBVERSION="$(LIBVERSION)"
-                       LIBCOMPATVERSIONS="$(LIBCOMPATVERSIONS)" \
-                       LIBDEPS="$(LIBDEPS)" link_o.gnu; \
+               $(DO_GNU); \
        else \
                $(CALC_VERSIONS); \
                SHLIB=lib$(LIBNAME).so \
                SHLIB_SUFFIX= \
-               LIBDEPS="$(LIBDEPS)" \
+               LIBDEPS="$(LIBDEPS) -lc" \
                ALLSYMSFLAGS='-all' \
                NOALLSYMSFLAGS='' \
                SHAREDFLAGS='-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_A); \
-       fi
+       fi; \
+       $(LINK_SO_A)
 
 # HP-UX includes the full pathname of libs we depend on, so we would get
 # ./libcrypto (with ./ as path information) compiled into libssl, hence
@@ -544,7 +477,7 @@ link_o.aix:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS='-bnogc' \
        NOALLSYMSFLAGS='' \
        SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE' \
@@ -554,7 +487,7 @@ link_a.aix:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS='-bnogc' \
        NOALLSYMSFLAGS='' \
        SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE' \
@@ -565,7 +498,7 @@ link_o.reliantunix:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS= \
        NOALLSYMSFLAGS='' \
        SHAREDFLAGS='-G' \
@@ -575,7 +508,7 @@ link_a.reliantunix:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS= \
        NOALLSYMSFLAGS='' \
        SHAREDFLAGS='-G' \