blob: e753f44e18fdf6878a25024e5939f6f0d7db6305 [file] [log] [blame]
Richard Levitte30afcc02002-10-11 00:37:11 +00001#
2# Helper makefile to link shared libraries in a portable way.
3# This is much simpler than libtool, and hopefully not too error-prone.
4#
5# The following variables need to be set on the command line to build
6# properly
7
8# CC contains the current compiler. This one MUST be defined
9CC=cc
Andy Polyakovf210eb72005-05-15 23:59:04 +000010CFLAGS=$(CFLAG)
Richard Levitte2d3de722003-02-13 23:52:54 +000011# LDFLAGS contains flags to be used when temporary object files (when building
12# shared libraries) are created, or when an application is linked.
13# SHARED_LDFLAGS contains flags to be used when the shared library is created.
Richard Levitte30afcc02002-10-11 00:37:11 +000014LDFLAGS=
15SHARED_LDFLAGS=
16
Andy Polyakovcbfb39d2006-10-21 13:38:16 +000017NM=nm
18
Richard Levitte2d3de722003-02-13 23:52:54 +000019# LIBNAME contains just the name of the library, without prefix ("lib"
Richard Levitte30afcc02002-10-11 00:37:11 +000020# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
Richard Levitte2d3de722003-02-13 23:52:54 +000021# .dll, ...). This one MUST have a value when using this makefile to
22# build shared libraries.
Richard Levitte30afcc02002-10-11 00:37:11 +000023# For example, to build libfoo.so, you need to do the following:
24#LIBNAME=foo
25LIBNAME=
26
Richard Levitte2d3de722003-02-13 23:52:54 +000027# APPNAME contains just the name of the application, without suffix (""
28# on Unix, ".exe" on Windows, ...). This one MUST have a value when using
29# this makefile to build applications.
30# For example, to build foo, you need to do the following:
31#APPNAME=foo
32APPNAME=
33
34# OBJECTS contains all the object files to link together into the application.
35# This must contain at least one object file.
36#OBJECTS=foo.o
37OBJECTS=
38
Richard Levitte30afcc02002-10-11 00:37:11 +000039# LIBEXTRAS contains extra modules to link together with the library.
Richard Levitte8d6fc302002-11-06 23:39:03 +000040# For example, if a second library, say libbar.a needs to be linked into
Richard Levitte30afcc02002-10-11 00:37:11 +000041# libfoo.so, you need to do the following:
42#LIBEXTRAS=libbar.a
43# Note that this MUST be used when using the link_o targets, to hold the
44# names of all object files that go into the target library.
45LIBEXTRAS=
46
47# LIBVERSION contains the current version of the library.
48# For example, to build libfoo.so.1.2, you need to do the following:
49#LIBVERSION=1.2
50LIBVERSION=
51
52# LIBCOMPATVERSIONS contains the compatibility versions (a list) of
53# the library. They MUST be in decreasing order.
54# For example, if libfoo.so.1.2.1 is backward compatible with libfoo.so.1.2
55# and libfoo.so.1, you need to do the following:
56#LIBCOMPATVERSIONS=1.2 1
57# Note that on systems that use sonames, the last number will appear as
58# part of it.
59# It's also possible, for systems that support it (Tru64, for example),
60# to add extra compatibility info with more precision, by adding a second
61# list of versions, separated from the first with a semicolon, like this:
62#LIBCOMPATVERSIONS=1.2 1;1.2.0 1.1.2 1.1.1 1.1.0 1.0.0
63LIBCOMPATVERSIONS=
64
65# LIBDEPS contains all the flags necessary to cover all necessary
66# dependencies to other libraries.
67LIBDEPS=
68
69#------------------------------------------------------------------------------
70# The rest is private to this makefile.
71
Andy Polyakovc4cd9252005-05-16 00:01:49 +000072SET_X=:
Andy Polyakov1dc02bb2010-07-15 13:55:38 +000073#SET_X=set -x
Richard Levitte30afcc02002-10-11 00:37:11 +000074
75top:
76 echo "Trying to use this makefile interactively? Don't."
77
78CALC_VERSIONS= \
79 SHLIB_COMPAT=; SHLIB_SOVER=; \
Richard Levittecf3b8b52002-10-11 11:14:41 +000080 if [ -n "$(LIBVERSION)$(LIBCOMPATVERSIONS)" ]; then \
Richard Levitte30afcc02002-10-11 00:37:11 +000081 prev=""; \
82 for v in `echo "$(LIBVERSION) $(LIBCOMPATVERSIONS)" | cut -d';' -f1`; do \
Richard Levittef9680592002-12-19 21:13:29 +000083 SHLIB_SOVER_NODOT=$$v; \
Richard Levitte30afcc02002-10-11 00:37:11 +000084 SHLIB_SOVER=.$$v; \
85 if [ -n "$$prev" ]; then \
Richard Levittea0bf8f22002-10-14 09:24:50 +000086 SHLIB_COMPAT="$$SHLIB_COMPAT .$$prev"; \
Richard Levitte30afcc02002-10-11 00:37:11 +000087 fi; \
88 prev=$$v; \
89 done; \
90 fi
91
Richard Levitte2d3de722003-02-13 23:52:54 +000092LINK_APP= \
Andy Polyakovfe288662005-02-06 13:18:40 +000093 ( $(SET_X); \
Andy Polyakov7858cc02005-06-22 23:42:34 +000094 LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
95 LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \
Andy Polyakovab4d6892009-01-02 09:02:27 +000096 LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
Richard Levitted6fd88f2003-04-08 08:57:23 +000097 LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
Richard Levittee96133e2003-04-08 08:36:20 +000098 LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
Andy Polyakov7858cc02005-06-22 23:42:34 +000099 $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
Richard Levitte2d3de722003-02-13 23:52:54 +0000100
Richard Levitte30afcc02002-10-11 00:37:11 +0000101LINK_SO= \
Andy Polyakovfe288662005-02-06 13:18:40 +0000102 ( $(SET_X); \
Andy Polyakov7858cc02005-06-22 23:42:34 +0000103 LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
104 SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
105 SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
Andy Polyakovab4d6892009-01-02 09:02:27 +0000106 LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
Richard Levitted6fd88f2003-04-08 08:57:23 +0000107 LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
Richard Levittee96133e2003-04-08 08:36:20 +0000108 LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
Andy Polyakov7858cc02005-06-22 23:42:34 +0000109 $${SHAREDCMD} $${SHAREDFLAGS} \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000110 -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
111 $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
Andy Polyakovd6c76452007-07-31 18:24:41 +0000112 ) && $(SYMLINK_SO)
Andy Polyakovf210eb72005-05-15 23:59:04 +0000113
Richard Levitte30afcc02002-10-11 00:37:11 +0000114SYMLINK_SO= \
Richard Levittebfa96bc2002-11-15 16:56:36 +0000115 if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
116 prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
117 if [ -n "$$SHLIB_COMPAT" ]; then \
118 for x in $$SHLIB_COMPAT; do \
Andy Polyakovfe288662005-02-06 13:18:40 +0000119 ( $(SET_X); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \
Richard Levittebfa96bc2002-11-15 16:56:36 +0000120 ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \
121 prev=$$SHLIB$$x$$SHLIB_SUFFIX; \
122 done; \
123 fi; \
124 if [ -n "$$SHLIB_SOVER" ]; then \
Andy Polyakovfe288662005-02-06 13:18:40 +0000125 ( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \
Richard Levittebfa96bc2002-11-15 16:56:36 +0000126 ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \
127 fi; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000128 fi
Richard Levittecf3b8b52002-10-11 11:14:41 +0000129
Richard Levitte30afcc02002-10-11 00:37:11 +0000130LINK_SO_A= SHOBJECTS="lib$(LIBNAME).a $(LIBEXTRAS)"; $(LINK_SO)
131LINK_SO_O= SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
Andy Polyakovf210eb72005-05-15 23:59:04 +0000132
Richard Levitte30afcc02002-10-11 00:37:11 +0000133LINK_SO_A_VIA_O= \
Richard Levittef9680592002-12-19 21:13:29 +0000134 SHOBJECTS=lib$(LIBNAME).o; \
135 ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
Andy Polyakovfe288662005-02-06 13:18:40 +0000136 ( $(SET_X); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000137 ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS) ); \
Andy Polyakovcad66502010-07-15 13:53:23 +0000138 $(LINK_SO) && rm -f lib$(LIBNAME).o
Andy Polyakovf210eb72005-05-15 23:59:04 +0000139
Richard Levitte30afcc02002-10-11 00:37:11 +0000140LINK_SO_A_UNPACKED= \
141 UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
Richard Levittee96133e2003-04-08 08:36:20 +0000142 (cd $$UNPACKDIR; ar x ../lib$(LIBNAME).a) && \
143 ([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \
Richard Levitte30afcc02002-10-11 00:37:11 +0000144 SHOBJECTS=$$UNPACKDIR/*.o; \
145 $(LINK_SO) && rm -rf $$UNPACKDIR
146
Andy Polyakova3705372008-12-29 16:17:52 +0000147DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
Andy Polyakov4d77d5b2002-12-14 20:52:19 +0000148
Richard Levitte2d3de722003-02-13 23:52:54 +0000149DO_GNU_SO=$(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000150 SHLIB=lib$(LIBNAME).so; \
151 SHLIB_SUFFIX=; \
Richard Levittef9680592002-12-19 21:13:29 +0000152 ALLSYMSFLAGS='-Wl,--whole-archive'; \
153 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000154 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"
155
156DO_GNU_APP=LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"
Richard Levitte30afcc02002-10-11 00:37:11 +0000157
Richard Levitte132eaa52003-02-22 14:41:34 +0000158#This is rather special. It's a special target with which one can link
159#applications without bothering with any features that have anything to
160#do with shared libraries, for example when linking against static
161#libraries. It's mostly here to avoid a lot of conditionals everywhere
162#else...
163link_app.:
Richard Levitte132eaa52003-02-22 14:41:34 +0000164 $(LINK_APP)
165
Richard Levitte30afcc02002-10-11 00:37:11 +0000166link_o.gnu:
Richard Levitte2d3de722003-02-13 23:52:54 +0000167 @ $(DO_GNU_SO); $(LINK_SO_O)
Richard Levitte30afcc02002-10-11 00:37:11 +0000168link_a.gnu:
Richard Levitte2d3de722003-02-13 23:52:54 +0000169 @ $(DO_GNU_SO); $(LINK_SO_A)
170link_app.gnu:
171 @ $(DO_GNU_APP); $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000172
Ulf Möller4700aea2006-04-11 21:34:21 +0000173DO_BEOS_SO= SHLIB=lib$(LIBNAME).so; \
174 SHLIB_SUFFIX=; \
175 ALLSYMSFLAGS='-Wl,--whole-archive'; \
176 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
177 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SUFFIX"
178
179link_o.beos:
180 @ $(DO_BEOS_SO); $(LINK_SO_O)
181link_a.beos:
182 @ $(DO_BEOS_SO); $(LINK_SO_A)
183
Andy Polyakov16760a32004-08-29 21:36:37 +0000184link_o.bsd:
Andy Polyakova3705372008-12-29 16:17:52 +0000185 @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
Andy Polyakov16760a32004-08-29 21:36:37 +0000186 $(CALC_VERSIONS); \
187 SHLIB=lib$(LIBNAME).so; \
188 SHLIB_SUFFIX=; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000189 LIBDEPS=" "; \
Andy Polyakov16760a32004-08-29 21:36:37 +0000190 ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
191 NOALLSYMSFLAGS=; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000192 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
Andy Polyakov16760a32004-08-29 21:36:37 +0000193 fi; $(LINK_SO_O)
194link_a.bsd:
Andy Polyakova3705372008-12-29 16:17:52 +0000195 @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
Andy Polyakov16760a32004-08-29 21:36:37 +0000196 $(CALC_VERSIONS); \
197 SHLIB=lib$(LIBNAME).so; \
198 SHLIB_SUFFIX=; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000199 LIBDEPS=" "; \
Andy Polyakov16760a32004-08-29 21:36:37 +0000200 ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
201 NOALLSYMSFLAGS=; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000202 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
Andy Polyakov16760a32004-08-29 21:36:37 +0000203 fi; $(LINK_SO_A)
204link_app.bsd:
Andy Polyakova3705372008-12-29 16:17:52 +0000205 @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
Richard Levitte4aca9292005-01-26 23:51:20 +0000206 LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBPATH)"; \
Andy Polyakov16760a32004-08-29 21:36:37 +0000207 fi; $(LINK_APP)
208
Richard Levitte30afcc02002-10-11 00:37:11 +0000209# For Darwin AKA Mac OS/X (dyld)
Andy Polyakovcad66502010-07-15 13:53:23 +0000210# Originally link_o.darwin produced .so, because it was hard-coded
211# in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
212# extension in order to allow for run-time linking with vendor-
213# supplied shared libraries such as libz, so that link_o.darwin had
214# to be harmonized with it. This caused minor controversy, because
215# it was believed that dlopen can't be used to dynamically load
216# .dylib-s, only so called bundle modules (ones linked with -bundle
217# flag). The belief seems to be originating from pre-10.4 release,
218# where dlfcn functionality was emulated by dlcompat add-on. In
219# 10.4 dlopen was rewritten as native part of dyld and is documented
220# to be capable of loading both dynamic libraries and bundles. In
221# order to provide compatibility with pre-10.4 dlopen, modules are
222# linked with -bundle flag, which makes .dylib extension misleading.
223# It works, because dlopen is [and always was] extension-agnostic.
Andy Polyakov75db4b22010-07-16 08:15:28 +0000224# Alternative to this heuristic approach is to develop specific
225# MacOS X dso module relying on whichever "native" dyld interface.
Richard Levitte30afcc02002-10-11 00:37:11 +0000226link_o.darwin:
227 @ $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000228 SHLIB=lib$(LIBNAME); \
Andy Polyakovcad66502010-07-15 13:53:23 +0000229 SHLIB_SUFFIX=.dylib; \
Richard Levittef9680592002-12-19 21:13:29 +0000230 ALLSYMSFLAGS='-all_load'; \
231 NOALLSYMSFLAGS=''; \
Andy Polyakov72f42192010-08-21 11:34:46 +0000232 SHAREDFLAGS="$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundle/`"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000233 if [ -n "$(LIBVERSION)" ]; then \
Andy Polyakov62966f32002-12-16 23:35:17 +0000234 SHAREDFLAGS="$$SHAREDFLAGS -current_version $(LIBVERSION)"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000235 fi; \
236 if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
Andy Polyakov62966f32002-12-16 23:35:17 +0000237 SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000238 fi; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000239 $(LINK_SO_O)
240link_a.darwin:
241 @ $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000242 SHLIB=lib$(LIBNAME); \
243 SHLIB_SUFFIX=.dylib; \
Richard Levittef9680592002-12-19 21:13:29 +0000244 ALLSYMSFLAGS='-all_load'; \
245 NOALLSYMSFLAGS=''; \
Andy Polyakovab6cf1b2005-06-23 20:44:27 +0000246 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS)"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000247 if [ -n "$(LIBVERSION)" ]; then \
Andy Polyakov62966f32002-12-16 23:35:17 +0000248 SHAREDFLAGS="$$SHAREDFLAGS -current_version $(LIBVERSION)"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000249 fi; \
250 if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
Andy Polyakov62966f32002-12-16 23:35:17 +0000251 SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000252 fi; \
Dr. Stephen Henson67275652009-08-10 14:48:40 +0000253 SHAREDFLAGS="$$SHAREDFLAGS -install_name $(INSTALLTOP)/$(LIBDIR)/$$SHLIB$(SHLIB_EXT)"; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000254 $(LINK_SO_A)
Andy Polyakovf210eb72005-05-15 23:59:04 +0000255link_app.darwin: # is there run-path on darwin?
Richard Levitte2d3de722003-02-13 23:52:54 +0000256 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000257
258link_o.cygwin:
Richard Levittebfa96bc2002-11-15 16:56:36 +0000259 @ $(CALC_VERSIONS); \
260 INHIBIT_SYMLINKS=yes; \
Richard Levittef9680592002-12-19 21:13:29 +0000261 SHLIB=cyg$(LIBNAME); \
Andy Polyakovcb1fbf92007-05-19 19:40:15 +0000262 base=-Wl,--enable-auto-image-base; \
Lutz Jänicke4c1a6e02008-04-17 10:19:16 +0000263 deffile=; \
Andy Polyakovcb1fbf92007-05-19 19:40:15 +0000264 if expr $(PLATFORM) : 'mingw' > /dev/null; then \
Lutz Jänicke4c1a6e02008-04-17 10:19:16 +0000265 SHLIB=$(LIBNAME)eay32; base=; \
266 if test -f $(LIBNAME)eay32.def; then \
267 deffile=$(LIBNAME)eay32.def; \
268 fi; \
Andy Polyakovcb1fbf92007-05-19 19:40:15 +0000269 fi; \
Richard Levittef9680592002-12-19 21:13:29 +0000270 SHLIB_SUFFIX=.dll; \
Richard Levitte447aa492005-05-21 16:41:34 +0000271 LIBVERSION="$(LIBVERSION)"; \
272 SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
Richard Levittef9680592002-12-19 21:13:29 +0000273 ALLSYMSFLAGS='-Wl,--whole-archive'; \
274 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
Lutz Jänicke4c1a6e02008-04-17 10:19:16 +0000275 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-s,-Bsymbolic"; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000276 $(LINK_SO_O)
Lutz Jänicke4c1a6e02008-04-17 10:19:16 +0000277#for mingw target if def-file is in use dll-name should match library-name
Richard Levitte30afcc02002-10-11 00:37:11 +0000278link_a.cygwin:
Richard Levittebfa96bc2002-11-15 16:56:36 +0000279 @ $(CALC_VERSIONS); \
280 INHIBIT_SYMLINKS=yes; \
Andy Polyakov5b50f992006-10-24 22:14:20 +0000281 SHLIB=cyg$(LIBNAME); SHLIB_SOVER=-$(LIBVERSION); SHLIB_SUFFIX=.dll; \
282 dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; extras=; \
Andy Polyakovcb1fbf92007-05-19 19:40:15 +0000283 base=-Wl,--enable-auto-image-base; \
Andy Polyakov08a63822006-10-23 07:30:19 +0000284 if expr $(PLATFORM) : 'mingw' > /dev/null; then \
Lutz Jänicke4c1a6e02008-04-17 10:19:16 +0000285 case $(LIBNAME) in \
286 crypto) SHLIB=libeay;; \
287 ssl) SHLIB=ssleay;; \
288 esac; \
289 SHLIB_SOVER=32; \
Andy Polyakov5b50f992006-10-24 22:14:20 +0000290 extras="$(LIBNAME).def"; \
Lutz Jänicke4c1a6e02008-04-17 10:19:16 +0000291 $(PERL) util/mkdef.pl 32 $$SHLIB > $$extras; \
Andy Polyakovcb1fbf92007-05-19 19:40:15 +0000292 base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
Andy Polyakov08a63822006-10-23 07:30:19 +0000293 fi; \
Andy Polyakov5b50f992006-10-24 22:14:20 +0000294 dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
295 $(PERL) util/mkrc.pl $$dll_name | \
Dr. Stephen Henson34775922009-10-15 23:43:54 +0000296 $(CROSS_COMPILE)windres -o rc.o; \
Andy Polyakov5b50f992006-10-24 22:14:20 +0000297 extras="$$extras rc.o"; \
Richard Levittef9680592002-12-19 21:13:29 +0000298 ALLSYMSFLAGS='-Wl,--whole-archive'; \
299 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
Andy Polyakov5b50f992006-10-24 22:14:20 +0000300 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-s,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \
301 [ -f apps/$$dll_name ] && rm apps/$$dll_name; \
302 [ -f test/$$dll_name ] && rm test/$$dll_name; \
Andy Polyakov94c16722005-04-30 23:45:53 +0000303 $(LINK_SO_A) || exit 1; \
Andy Polyakov5b50f992006-10-24 22:14:20 +0000304 rm $$extras; \
305 cp -p $$dll_name apps/; \
306 cp -p $$dll_name test/
Richard Levitte2d3de722003-02-13 23:52:54 +0000307link_app.cygwin:
Andy Polyakov5b50f992006-10-24 22:14:20 +0000308 @if expr "$(CFLAGS)" : '.*OPENSSL_USE_APPLINK' > /dev/null; then \
309 LIBDEPS="$(TOP)/crypto/applink.o $${LIBDEPS:-$(LIBDEPS)}"; \
310 export LIBDEPS; \
311 fi; \
Richard Levitte2d3de722003-02-13 23:52:54 +0000312 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000313
314link_o.alpha-osf1:
Andy Polyakova3705372008-12-29 16:17:52 +0000315 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000316 $(DO_GNU_SO); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000317 else \
Richard Levittef9680592002-12-19 21:13:29 +0000318 SHLIB=lib$(LIBNAME).so; \
319 SHLIB_SUFFIX=; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000320 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
321 if [ -n "$$SHLIB_HIST" ]; then \
322 SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
323 else \
324 SHLIB_HIST="$(LIBVERSION)"; \
Andy Polyakov62966f32002-12-16 23:35:17 +0000325 fi; \
Richard Levittef9680592002-12-19 21:13:29 +0000326 SHLIB_SOVER=; \
327 ALLSYMSFLAGS='-all'; \
328 NOALLSYMSFLAGS='-none'; \
Andy Polyakovae4eb3c2007-08-26 14:12:30 +0000329 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000330 if [ -n "$$SHLIB_HIST" ]; then \
Andy Polyakov9ab51702005-12-16 20:51:03 +0000331 SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000332 fi; \
Richard Levitte12fd8be2002-10-15 12:09:22 +0000333 fi; \
334 $(LINK_SO_O)
Richard Levitte30afcc02002-10-11 00:37:11 +0000335link_a.alpha-osf1:
Andy Polyakova3705372008-12-29 16:17:52 +0000336 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000337 $(DO_GNU_SO); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000338 else \
Richard Levittef9680592002-12-19 21:13:29 +0000339 SHLIB=lib$(LIBNAME).so; \
340 SHLIB_SUFFIX=; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000341 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
342 if [ -n "$$SHLIB_HIST" ]; then \
343 SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
344 else \
345 SHLIB_HIST="$(LIBVERSION)"; \
Andy Polyakov62966f32002-12-16 23:35:17 +0000346 fi; \
Richard Levittef9680592002-12-19 21:13:29 +0000347 SHLIB_SOVER=; \
348 ALLSYMSFLAGS='-all'; \
349 NOALLSYMSFLAGS='-none'; \
Andy Polyakovae4eb3c2007-08-26 14:12:30 +0000350 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000351 if [ -n "$$SHLIB_HIST" ]; then \
Andy Polyakov9ab51702005-12-16 20:51:03 +0000352 SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
Richard Levitte36757b42002-10-11 19:56:57 +0000353 fi; \
Richard Levitte12fd8be2002-10-15 12:09:22 +0000354 fi; \
355 $(LINK_SO_A)
Richard Levitte2d3de722003-02-13 23:52:54 +0000356link_app.alpha-osf1:
Andy Polyakova3705372008-12-29 16:17:52 +0000357 @if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000358 $(DO_GNU_APP); \
359 else \
Richard Levitte4aca9292005-01-26 23:51:20 +0000360 LDFLAGS="$(CFLAGS) -rpath $(LIBRPATH)"; \
Richard Levitte2d3de722003-02-13 23:52:54 +0000361 fi; \
362 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000363
364link_o.solaris:
Andy Polyakova3705372008-12-29 16:17:52 +0000365 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000366 $(DO_GNU_SO); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000367 else \
368 $(CALC_VERSIONS); \
Richard Levittec4451422002-12-16 20:33:38 +0000369 MINUSZ='-z '; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000370 ($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
Richard Levittef9680592002-12-19 21:13:29 +0000371 SHLIB=lib$(LIBNAME).so; \
372 SHLIB_SUFFIX=; \
Richard Levittef9680592002-12-19 21:13:29 +0000373 ALLSYMSFLAGS="$${MINUSZ}allextract"; \
374 NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000375 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-Bsymbolic"; \
Richard Levitte12fd8be2002-10-15 12:09:22 +0000376 fi; \
377 $(LINK_SO_O)
Richard Levitte30afcc02002-10-11 00:37:11 +0000378link_a.solaris:
Andy Polyakova3705372008-12-29 16:17:52 +0000379 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000380 $(DO_GNU_SO); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000381 else \
382 $(CALC_VERSIONS); \
Richard Levittec4451422002-12-16 20:33:38 +0000383 MINUSZ='-z '; \
Andy Polyakova3705372008-12-29 16:17:52 +0000384 ($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
Richard Levittef9680592002-12-19 21:13:29 +0000385 SHLIB=lib$(LIBNAME).so; \
386 SHLIB_SUFFIX=;\
Richard Levittef9680592002-12-19 21:13:29 +0000387 ALLSYMSFLAGS="$${MINUSZ}allextract"; \
388 NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000389 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-Bsymbolic"; \
Richard Levitte12fd8be2002-10-15 12:09:22 +0000390 fi; \
391 $(LINK_SO_A)
Richard Levitte2d3de722003-02-13 23:52:54 +0000392link_app.solaris:
Andy Polyakova3705372008-12-29 16:17:52 +0000393 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000394 $(DO_GNU_APP); \
395 else \
Richard Levitte4aca9292005-01-26 23:51:20 +0000396 LDFLAGS="$(CFLAGS) -R $(LIBRPATH)"; \
Richard Levitte2d3de722003-02-13 23:52:54 +0000397 fi; \
398 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000399
400# OpenServer 5 native compilers used
Richard Levitte30afcc02002-10-11 00:37:11 +0000401link_o.svr3:
Andy Polyakova3705372008-12-29 16:17:52 +0000402 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000403 $(DO_GNU_SO); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000404 else \
405 $(CALC_VERSIONS); \
Richard Levittea1092202003-04-08 09:27:43 +0000406 SHLIB=lib$(LIBNAME).so; \
407 SHLIB_SUFFIX=; \
Richard Levittea1092202003-04-08 09:27:43 +0000408 ALLSYMSFLAGS=''; \
409 NOALLSYMSFLAGS=''; \
Richard Levitte4aca9292005-01-26 23:51:20 +0000410 SHAREDFLAGS="$(CFLAGS) -G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
Richard Levittea1092202003-04-08 09:27:43 +0000411 fi; \
412 $(LINK_SO_O)
413link_a.svr3:
Andy Polyakova3705372008-12-29 16:17:52 +0000414 @ if $(DETECT_GNU_LD); then \
Richard Levittea1092202003-04-08 09:27:43 +0000415 $(DO_GNU_SO); \
416 else \
417 $(CALC_VERSIONS); \
418 SHLIB=lib$(LIBNAME).so; \
419 SHLIB_SUFFIX=; \
Richard Levittea1092202003-04-08 09:27:43 +0000420 ALLSYMSFLAGS=''; \
421 NOALLSYMSFLAGS=''; \
Richard Levitte4aca9292005-01-26 23:51:20 +0000422 SHAREDFLAGS="$(CFLAGS) -G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
Richard Levittea1092202003-04-08 09:27:43 +0000423 fi; \
424 $(LINK_SO_A_UNPACKED)
425link_app.svr3:
Andy Polyakova3705372008-12-29 16:17:52 +0000426 @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
Richard Levittea1092202003-04-08 09:27:43 +0000427 $(LINK_APP)
428
429# UnixWare 7 and OpenUNIX 8 native compilers used
430link_o.svr5:
Andy Polyakova3705372008-12-29 16:17:52 +0000431 @ if $(DETECT_GNU_LD); then \
Richard Levittea1092202003-04-08 09:27:43 +0000432 $(DO_GNU_SO); \
433 else \
434 $(CALC_VERSIONS); \
Richard Levitte24692fc2003-04-01 10:59:15 +0000435 SHARE_FLAG='-G'; \
Andy Polyakovf210eb72005-05-15 23:59:04 +0000436 ($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
Richard Levittef9680592002-12-19 21:13:29 +0000437 SHLIB=lib$(LIBNAME).so; \
438 SHLIB_SUFFIX=; \
Richard Levittee96133e2003-04-08 08:36:20 +0000439 ALLSYMSFLAGS=''; \
Richard Levittef9680592002-12-19 21:13:29 +0000440 NOALLSYMSFLAGS=''; \
Richard Levitte4aca9292005-01-26 23:51:20 +0000441 SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
Richard Levitte12fd8be2002-10-15 12:09:22 +0000442 fi; \
443 $(LINK_SO_O)
Richard Levittea1092202003-04-08 09:27:43 +0000444link_a.svr5:
Andy Polyakova3705372008-12-29 16:17:52 +0000445 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000446 $(DO_GNU_SO); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000447 else \
448 $(CALC_VERSIONS); \
Richard Levitte24692fc2003-04-01 10:59:15 +0000449 SHARE_FLAG='-G'; \
Andy Polyakova3705372008-12-29 16:17:52 +0000450 ($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
Richard Levittef9680592002-12-19 21:13:29 +0000451 SHLIB=lib$(LIBNAME).so; \
452 SHLIB_SUFFIX=; \
Richard Levittee96133e2003-04-08 08:36:20 +0000453 ALLSYMSFLAGS=''; \
Richard Levittef9680592002-12-19 21:13:29 +0000454 NOALLSYMSFLAGS=''; \
Richard Levitte4aca9292005-01-26 23:51:20 +0000455 SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
Richard Levitte12fd8be2002-10-15 12:09:22 +0000456 fi; \
457 $(LINK_SO_A_UNPACKED)
Richard Levittea1092202003-04-08 09:27:43 +0000458link_app.svr5:
Andy Polyakova3705372008-12-29 16:17:52 +0000459 @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
Richard Levitte2d3de722003-02-13 23:52:54 +0000460 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000461
462link_o.irix:
Andy Polyakova3705372008-12-29 16:17:52 +0000463 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000464 $(DO_GNU_SO); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000465 else \
466 $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000467 SHLIB=lib$(LIBNAME).so; \
468 SHLIB_SUFFIX=; \
Andy Polyakov30fbcaa2004-03-12 21:52:54 +0000469 MINUSWL=""; \
470 ($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
471 ALLSYMSFLAGS="$${MINUSWL}-all"; \
Andy Polyakovbd16cd62004-12-27 14:59:36 +0000472 NOALLSYMSFLAGS="$${MINUSWL}-none"; \
Andy Polyakovae4eb3c2007-08-26 14:12:30 +0000473 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,-B,symbolic"; \
Richard Levitte12fd8be2002-10-15 12:09:22 +0000474 fi; \
475 $(LINK_SO_O)
Richard Levitte30afcc02002-10-11 00:37:11 +0000476link_a.irix:
Andy Polyakova3705372008-12-29 16:17:52 +0000477 @ if $(DETECT_GNU_LD); then \
Richard Levitte2d3de722003-02-13 23:52:54 +0000478 $(DO_GNU_SO); \
Richard Levitte30afcc02002-10-11 00:37:11 +0000479 else \
480 $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000481 SHLIB=lib$(LIBNAME).so; \
482 SHLIB_SUFFIX=; \
Andy Polyakov30fbcaa2004-03-12 21:52:54 +0000483 MINUSWL=""; \
484 ($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
485 ALLSYMSFLAGS="$${MINUSWL}-all"; \
Andy Polyakovbd16cd62004-12-27 14:59:36 +0000486 NOALLSYMSFLAGS="$${MINUSWL}-none"; \
Andy Polyakovae4eb3c2007-08-26 14:12:30 +0000487 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,-B,symbolic"; \
Richard Levitte12fd8be2002-10-15 12:09:22 +0000488 fi; \
489 $(LINK_SO_A)
Richard Levitte2d3de722003-02-13 23:52:54 +0000490link_app.irix:
Andy Polyakovf210eb72005-05-15 23:59:04 +0000491 @LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"; \
Richard Levitte2d3de722003-02-13 23:52:54 +0000492 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000493
Andy Polyakov393b7042004-05-31 22:29:26 +0000494# 32-bit PA-RISC HP-UX embeds the -L pathname of libs we link with, so
495# we compensate for it with +cdp ../: and +cdp ./:. Yes, these rewrite
496# rules imply that we can only link one level down in catalog structure,
497# but that's what takes place for the moment of this writing. +cdp option
498# was introduced in HP-UX 11.x and applies in 32-bit PA-RISC link
499# editor context only [it's simply ignored in other cases, which are all
500# ELFs by the way].
Richard Levitte30afcc02002-10-11 00:37:11 +0000501#
Andy Polyakov1a83c372004-05-28 22:18:48 +0000502link_o.hpux:
Andy Polyakova3705372008-12-29 16:17:52 +0000503 @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
Andy Polyakov15fd2de2004-05-28 22:38:05 +0000504 $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000505 SHLIB=lib$(LIBNAME).sl; \
Andy Polyakov74aa1a42006-05-20 08:52:34 +0000506 expr "$(CFLAGS)" : '.*DSO_DLFCN' > /dev/null && SHLIB=lib$(LIBNAME).so; \
Richard Levittef9680592002-12-19 21:13:29 +0000507 SHLIB_SUFFIX=; \
Andy Polyakov2bbc9702004-05-27 22:23:40 +0000508 ALLSYMSFLAGS='-Wl,-Fl'; \
Richard Levittef9680592002-12-19 21:13:29 +0000509 NOALLSYMSFLAGS=''; \
Andy Polyakov1a83c372004-05-28 22:18:48 +0000510 expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
Andy Polyakov7df4c862007-09-16 14:11:00 +0000511 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
Andy Polyakov15fd2de2004-05-28 22:38:05 +0000512 fi; \
Andy Polyakova41b0aa2005-06-23 15:36:15 +0000513 rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
Richard Levitte83699c42002-10-11 07:33:38 +0000514 $(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
Andy Polyakov1a83c372004-05-28 22:18:48 +0000515link_a.hpux:
Andy Polyakova3705372008-12-29 16:17:52 +0000516 @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
Andy Polyakov15fd2de2004-05-28 22:38:05 +0000517 $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000518 SHLIB=lib$(LIBNAME).sl; \
Andy Polyakov86119342004-07-24 14:17:32 +0000519 expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
Richard Levittef9680592002-12-19 21:13:29 +0000520 SHLIB_SUFFIX=; \
Andy Polyakov2bbc9702004-05-27 22:23:40 +0000521 ALLSYMSFLAGS='-Wl,-Fl'; \
Richard Levittef9680592002-12-19 21:13:29 +0000522 NOALLSYMSFLAGS=''; \
Andy Polyakov1a83c372004-05-28 22:18:48 +0000523 expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
Andy Polyakov7df4c862007-09-16 14:11:00 +0000524 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
Andy Polyakov15fd2de2004-05-28 22:38:05 +0000525 fi; \
Andy Polyakova41b0aa2005-06-23 15:36:15 +0000526 rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
Richard Levitte83699c42002-10-11 07:33:38 +0000527 $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
Andy Polyakov1a83c372004-05-28 22:18:48 +0000528link_app.hpux:
Andy Polyakova3705372008-12-29 16:17:52 +0000529 @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
Richard Levitte4aca9292005-01-26 23:51:20 +0000530 LDFLAGS="$(CFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
Andy Polyakov15fd2de2004-05-28 22:38:05 +0000531 fi; \
Richard Levitte2d3de722003-02-13 23:52:54 +0000532 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000533
Richard Levitte30afcc02002-10-11 00:37:11 +0000534link_o.aix:
535 @ $(CALC_VERSIONS); \
Andy Polyakov492279f2008-09-12 14:45:54 +0000536 OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || :; \
Andy Polyakovfe288662005-02-06 13:18:40 +0000537 OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
Richard Levittef9680592002-12-19 21:13:29 +0000538 SHLIB=lib$(LIBNAME).so; \
539 SHLIB_SUFFIX=; \
Andy Polyakov0d1aa742007-03-22 08:46:33 +0000540 ALLSYMSFLAGS=''; \
Richard Levittef9680592002-12-19 21:13:29 +0000541 NOALLSYMSFLAGS=''; \
Andy Polyakov492279f2008-09-12 14:45:54 +0000542 SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
Andy Polyakov0d1aa742007-03-22 08:46:33 +0000543 $(LINK_SO_O);
Richard Levitte30afcc02002-10-11 00:37:11 +0000544link_a.aix:
545 @ $(CALC_VERSIONS); \
Andy Polyakov492279f2008-09-12 14:45:54 +0000546 OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || : ; \
Andy Polyakovfe288662005-02-06 13:18:40 +0000547 OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
Richard Levittef9680592002-12-19 21:13:29 +0000548 SHLIB=lib$(LIBNAME).so; \
549 SHLIB_SUFFIX=; \
Richard Levittef9680592002-12-19 21:13:29 +0000550 ALLSYMSFLAGS='-bnogc'; \
551 NOALLSYMSFLAGS=''; \
Andy Polyakov492279f2008-09-12 14:45:54 +0000552 SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000553 $(LINK_SO_A_VIA_O)
Richard Levitte2d3de722003-02-13 23:52:54 +0000554link_app.aix:
Andy Polyakovb5068212007-03-25 15:20:35 +0000555 LDFLAGS="$(CFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \
Richard Levitte2d3de722003-02-13 23:52:54 +0000556 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000557
558link_o.reliantunix:
559 @ $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000560 SHLIB=lib$(LIBNAME).so; \
561 SHLIB_SUFFIX=; \
Richard Levittef9680592002-12-19 21:13:29 +0000562 ALLSYMSFLAGS=; \
563 NOALLSYMSFLAGS=''; \
Richard Levitte4aca9292005-01-26 23:51:20 +0000564 SHAREDFLAGS='$(CFLAGS) -G'; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000565 $(LINK_SO_O)
566link_a.reliantunix:
567 @ $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000568 SHLIB=lib$(LIBNAME).so; \
569 SHLIB_SUFFIX=; \
Richard Levittef9680592002-12-19 21:13:29 +0000570 ALLSYMSFLAGS=; \
571 NOALLSYMSFLAGS=''; \
Richard Levitte4aca9292005-01-26 23:51:20 +0000572 SHAREDFLAGS='$(CFLAGS) -G'; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000573 $(LINK_SO_A_UNPACKED)
Richard Levitte2d3de722003-02-13 23:52:54 +0000574link_app.reliantunix:
Richard Levitte2d3de722003-02-13 23:52:54 +0000575 $(LINK_APP)
Richard Levitte30afcc02002-10-11 00:37:11 +0000576
577# Targets to build symbolic links when needed
Richard Levittea1092202003-04-08 09:27:43 +0000578symlink.gnu symlink.solaris symlink.svr3 symlink.svr5 symlink.irix \
Richard Levitte30afcc02002-10-11 00:37:11 +0000579symlink.aix symlink.reliantunix:
580 @ $(CALC_VERSIONS); \
Richard Levittebfa96bc2002-11-15 16:56:36 +0000581 SHLIB=lib$(LIBNAME).so; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000582 $(SYMLINK_SO)
Richard Levitte83699c42002-10-11 07:33:38 +0000583symlink.darwin:
584 @ $(CALC_VERSIONS); \
Richard Levittef9680592002-12-19 21:13:29 +0000585 SHLIB=lib$(LIBNAME); \
Richard Levittebfa96bc2002-11-15 16:56:36 +0000586 SHLIB_SUFFIX=.dylib; \
Richard Levitte83699c42002-10-11 07:33:38 +0000587 $(SYMLINK_SO)
Andy Polyakov1a83c372004-05-28 22:18:48 +0000588symlink.hpux:
Richard Levitte30afcc02002-10-11 00:37:11 +0000589 @ $(CALC_VERSIONS); \
Richard Levittebfa96bc2002-11-15 16:56:36 +0000590 SHLIB=lib$(LIBNAME).sl; \
Andy Polyakov86119342004-07-24 14:17:32 +0000591 expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
Richard Levitte30afcc02002-10-11 00:37:11 +0000592 $(SYMLINK_SO)
Richard Levittebfa96bc2002-11-15 16:56:36 +0000593# The following lines means those specific architectures do no symlinks
Ulf Möller4700aea2006-04-11 21:34:21 +0000594symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath symlink.beos:
Richard Levitte30afcc02002-10-11 00:37:11 +0000595
596# Compatibility targets
597link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
598link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared: link_a.gnu
Richard Levitte2d3de722003-02-13 23:52:54 +0000599link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
Andy Polyakov16760a32004-08-29 21:36:37 +0000600symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
601link_o.bsd-shared: link_o.bsd
602link_a.bsd-shared: link_a.bsd
603link_app.bsd-shared: link_app.bsd
Richard Levitte30afcc02002-10-11 00:37:11 +0000604link_o.darwin-shared: link_o.darwin
605link_a.darwin-shared: link_a.darwin
Richard Levitte2d3de722003-02-13 23:52:54 +0000606link_app.darwin-shared: link_app.darwin
Richard Levitte30afcc02002-10-11 00:37:11 +0000607symlink.darwin-shared: symlink.darwin
608link_o.cygwin-shared: link_o.cygwin
609link_a.cygwin-shared: link_a.cygwin
Richard Levitte2d3de722003-02-13 23:52:54 +0000610link_app.cygwin-shared: link_app.cygwin
Richard Levitte30afcc02002-10-11 00:37:11 +0000611symlink.cygwin-shared: symlink.cygwin
612link_o.alpha-osf1-shared: link_o.alpha-osf1
613link_a.alpha-osf1-shared: link_a.alpha-osf1
Richard Levitte2d3de722003-02-13 23:52:54 +0000614link_app.alpha-osf1-shared: link_app.alpha-osf1
Richard Levitte30afcc02002-10-11 00:37:11 +0000615symlink.alpha-osf1-shared: symlink.alpha-osf1
616link_o.tru64-shared: link_o.tru64
617link_a.tru64-shared: link_a.tru64
Richard Levitte2d3de722003-02-13 23:52:54 +0000618link_app.tru64-shared: link_app.tru64
Richard Levitte30afcc02002-10-11 00:37:11 +0000619symlink.tru64-shared: symlink.tru64
620link_o.tru64-shared-rpath: link_o.tru64-rpath
621link_a.tru64-shared-rpath: link_a.tru64-rpath
Richard Levitte2d3de722003-02-13 23:52:54 +0000622link_app.tru64-shared-rpath: link_app.tru64-rpath
Richard Levitte30afcc02002-10-11 00:37:11 +0000623symlink.tru64-shared-rpath: symlink.tru64-rpath
624link_o.solaris-shared: link_o.solaris
625link_a.solaris-shared: link_a.solaris
Richard Levitte2d3de722003-02-13 23:52:54 +0000626link_app.solaris-shared: link_app.solaris
Richard Levitte30afcc02002-10-11 00:37:11 +0000627symlink.solaris-shared: symlink.solaris
628link_o.svr3-shared: link_o.svr3
629link_a.svr3-shared: link_a.svr3
Richard Levitte2d3de722003-02-13 23:52:54 +0000630link_app.svr3-shared: link_app.svr3
Richard Levitte30afcc02002-10-11 00:37:11 +0000631symlink.svr3-shared: symlink.svr3
Richard Levittea1092202003-04-08 09:27:43 +0000632link_o.svr5-shared: link_o.svr5
633link_a.svr5-shared: link_a.svr5
634link_app.svr5-shared: link_app.svr5
635symlink.svr5-shared: symlink.svr5
Richard Levitte30afcc02002-10-11 00:37:11 +0000636link_o.irix-shared: link_o.irix
637link_a.irix-shared: link_a.irix
Richard Levitte2d3de722003-02-13 23:52:54 +0000638link_app.irix-shared: link_app.irix
Richard Levitte30afcc02002-10-11 00:37:11 +0000639symlink.irix-shared: symlink.irix
Andy Polyakov1a83c372004-05-28 22:18:48 +0000640link_o.hpux-shared: link_o.hpux
641link_a.hpux-shared: link_a.hpux
642link_app.hpux-shared: link_app.hpux
643symlink.hpux-shared: symlink.hpux
Richard Levitte30afcc02002-10-11 00:37:11 +0000644link_o.aix-shared: link_o.aix
645link_a.aix-shared: link_a.aix
Richard Levitte2d3de722003-02-13 23:52:54 +0000646link_app.aix-shared: link_app.aix
Richard Levitte30afcc02002-10-11 00:37:11 +0000647symlink.aix-shared: symlink.aix
648link_o.reliantunix-shared: link_o.reliantunix
649link_a.reliantunix-shared: link_a.reliantunix
Richard Levitte2d3de722003-02-13 23:52:54 +0000650link_app.reliantunix-shared: link_app.reliantunix
Richard Levitte30afcc02002-10-11 00:37:11 +0000651symlink.reliantunix-shared: symlink.reliantunix
Ulf Möller4700aea2006-04-11 21:34:21 +0000652link_o.beos-shared: link_o.beos
653link_a.beos-shared: link_a.beos
654link_app.beos-shared: link_app.gnu
655symlink.beos-shared: symlink.beos