Eh, -Wl,--whole-archive disappeared from the GNU targets. I've no
[openssl.git] / Makefile.shared
index ddc5bcc..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,53 +110,58 @@ 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 -current_version $(LIBVERSION) -compatibility_version $$SHLIB_SOVER_NODOT" \
+       SHAREDFLAGS="-dynamiclib" \
        SHAREDCMD='$(CC)'; \
+       if [ -n "$(LIBVERSION)" ]; then \
+               SHAREDFLAGS="$SHAREDFLAGS -current_version $(LIBVERSION)"; \
+       fi; \
+       if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
+               SHAREDFLAGS="$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
+       fi; \
        $(LINK_SO_O)
 link_a.darwin:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME) \
        SHLIB_SUFFIX=.dylib \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS='-all_load' \
        NOALLSYMSFLAGS='' \
-       SHAREDFLAGS="-dynamiclib -current_version $(LIBVERSION) -compatibility_version $$SHLIB_SOVER_NODOT" \
+       SHAREDFLAGS="-dynamiclib" \
        SHAREDCMD='$(CC)'; \
+       if [ -n "$(LIBVERSION)" ]; then \
+               SHAREDFLAGS="$SHAREDFLAGS -current_version $(LIBVERSION)"; \
+       fi; \
+       if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
+               SHAREDFLAGS="$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
+       fi; \
        $(LINK_SO_A)
 
 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' \
@@ -166,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' \
@@ -176,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)"; \
@@ -195,22 +195,20 @@ link_o.alpha-osf1:
                SHLIB_SOVER= \
                ALLSYMSFLAGS='-all' \
                NOALLSYMSFLAGS='-none' \
-               SHAREDFLAGS="-shared -set_version \"$$SHLIB_HIST\"" \
+               SHAREDFLAGS="-shared" \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_O); \
-       fi
+               if [ -n "$$SHLIB_HIST" ]; then \
+                       SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
+               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)"; \
@@ -220,25 +218,23 @@ link_a.alpha-osf1:
                SHLIB_SOVER= \
                ALLSYMSFLAGS='-all' \
                NOALLSYMSFLAGS='-none' \
-               SHAREDFLAGS="-shared -set_version \"$$SHLIB_HIST\"" \
+               SHAREDFLAGS="-shared" \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_A); \
-       fi
+               if [ -n "$$SHLIB_HIST" ]; then \
+                       SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
+               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)"; \
@@ -248,22 +244,20 @@ link_o.tru64:
                SHLIB_SOVER= \
                ALLSYMSFLAGS='-all' \
                NOALLSYMSFLAGS='-none' \
-               SHAREDFLAGS="-shared -msym -set_version \"$$SHLIB_HIST\"" \
+               SHAREDFLAGS="-shared -msym" \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_O); \
-       fi
+               if [ -n "$$SHLIB_HIST" ]; then \
+                       SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
+               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)"; \
@@ -273,25 +267,23 @@ link_a.tru64:
                SHLIB_SOVER= \
                ALLSYMSFLAGS='-all' \
                NOALLSYMSFLAGS='-none' \
-               SHAREDFLAGS="-shared -msym -set_version \"$$SHLIB_HIST\"" \
+               SHAREDFLAGS="-shared -msym" \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_A); \
-       fi
+               if [ -n "$$SHLIB_HIST" ]; then \
+                       SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
+               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)"; \
@@ -301,22 +293,20 @@ link_o.tru64-rpath:
                SHLIB_SOVER= \
                ALLSYMSFLAGS='-all' \
                NOALLSYMSFLAGS='-none' \
-               SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH) -set_version \"$$SHLIB_HIST\"" \
+               SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)" \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_O); \
-       fi
+               if [ -n "$$SHLIB_HIST" ]; then \
+                       SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
+               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)"; \
@@ -326,129 +316,102 @@ link_a.tru64-rpath:
                SHLIB_SOVER= \
                ALLSYMSFLAGS='-all' \
                NOALLSYMSFLAGS='-none' \
-               SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH) -set_version \"$$SHLIB_HIST\"" \
+               SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)" \
                SHAREDCMD='$(CC)'; \
-               $(LINK_SO_A); \
-       fi
+               if [ -n "$$SHLIB_HIST" ]; then \
+                       SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
+               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
@@ -514,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' \
@@ -524,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' \
@@ -535,7 +498,7 @@ link_o.reliantunix:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS= \
        NOALLSYMSFLAGS='' \
        SHAREDFLAGS='-G' \
@@ -545,7 +508,7 @@ link_a.reliantunix:
        @ $(CALC_VERSIONS); \
        SHLIB=lib$(LIBNAME).so \
        SHLIB_SUFFIX= \
-       LIBDEPS="$(LIBDEPS)" \
+       LIBDEPS="$(LIBDEPS) -lc" \
        ALLSYMSFLAGS= \
        NOALLSYMSFLAGS='' \
        SHAREDFLAGS='-G' \