]> git.ipfire.org Git - thirdparty/openssl.git/blame - Makefile.shared
Create a prototype for OPENSSL_rdtsc
[thirdparty/openssl.git] / Makefile.shared
CommitLineData
30afcc07
RL
1#
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
f210eb7b 10CFLAGS=$(CFLAG)
2d3de726
RL
11# 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.
c86ddbe6
RL
14LDFLAGS=$(LDFLAG)
15SHARED_LDFLAGS=$(SHARED_LDFLAG)
30afcc07 16
8f41ff2d 17RC=windres
64c443e3
RL
18# SHARED_RCFLAGS are flags used with windres, i.e. when build for Cygwin
19# or Mingw.
20SHARED_RCFLAGS=$(SHARED_RCFLAG)
21
cbfb39d1 22NM=nm
5407338a 23ECHO=echo
cbfb39d1 24
2d3de726 25# LIBNAME contains just the name of the library, without prefix ("lib"
30afcc07 26# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
2d3de726
RL
27# .dll, ...). This one MUST have a value when using this makefile to
28# build shared libraries.
30afcc07
RL
29# For example, to build libfoo.so, you need to do the following:
30#LIBNAME=foo
31LIBNAME=
32
d07abe13
RL
33# STLIBNAME contains the path of the static library to build the shared
34# library from, for example:
35#STLIBNAME=libfoo.a
36STLIBNAME=
37
38# On most Unix platforms, SHLIBNAME contains the path of the short name of
39# the shared library to build, for example
40#SHLIBNAME=libfoo.so
41# On Windows POSIX layers (cygwin and mingw), SHLIBNAME contains the import
42# library name for the shared library to be built, for example:
43#SHLIBNAME=libfoo.dll.a
44
45# SHLIBNAME_FULL contains the path of the full name of the shared library to
46# build, for example:
47#SHLIBNAME_FULL=libfoo.so.1.2
48# When building DSOs, SHLIBNAME_FULL contains path of the full DSO name, for
49# example:
50#SHLIBNAME_FULL=dir/dso.so
51SHLIBNAME_FULL=
52
53# SHLIBVERSION contains the current version of the shared library (not to
54# be confused with the project version)
55#SHLIBVERSION=1.2
56SHLIBVERSION=
57
58# NOTE: to build shared libraries, LIBNAME, STLIBNAME, SHLIBNAME and
59# SHLIBNAME_FULL MUST have values when using this makefile, and in some
60# cases, SHLIBVERSION as well. To build DSOs, SHLIBNAME_FULL MUST have
61# a value, the rest can be left alone.
62
63
2d3de726
RL
64# APPNAME contains just the name of the application, without suffix (""
65# on Unix, ".exe" on Windows, ...). This one MUST have a value when using
66# this makefile to build applications.
67# For example, to build foo, you need to do the following:
68#APPNAME=foo
69APPNAME=
70
d7465918
RL
71# SRCDIR is the top directory of the source tree.
72SRCDIR=.
73
2d3de726
RL
74# OBJECTS contains all the object files to link together into the application.
75# This must contain at least one object file.
76#OBJECTS=foo.o
77OBJECTS=
78
30afcc07 79# LIBEXTRAS contains extra modules to link together with the library.
8d6fc30b 80# For example, if a second library, say libbar.a needs to be linked into
30afcc07
RL
81# libfoo.so, you need to do the following:
82#LIBEXTRAS=libbar.a
e048fd51
RL
83# Note that this MUST be used when using the link_dso targets, to hold the
84# names of all object files that go into the target shared object.
30afcc07
RL
85LIBEXTRAS=
86
30afcc07
RL
87# LIBDEPS contains all the flags necessary to cover all necessary
88# dependencies to other libraries.
89LIBDEPS=
90
91#------------------------------------------------------------------------------
92# The rest is private to this makefile.
93
c4cd925c 94SET_X=:
1dc02bba 95#SET_X=set -x
30afcc07
RL
96
97top:
5407338a 98 echo "Trying to use this makefile interactively? Don't." ; exit 1
30afcc07 99
2d3de726 100LINK_APP= \
fe28866d 101 ( $(SET_X); \
7858cc03 102 LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
c86ddbe6 103 LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS) $(LDFLAGS)}"; \
ab4d6898 104 LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
d6fd88ff 105 LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
5407338a 106 $(ECHO) LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
f3ac5003 107 $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS}; \
e96133e4 108 LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
7858cc03 109 $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
2d3de726 110
30afcc07 111LINK_SO= \
fe28866d 112 ( $(SET_X); \
7858cc03
AP
113 LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
114 SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
115 SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
ab4d6898 116 LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
d6fd88ff 117 LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
5407338a 118 $(ECHO) LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
f3ac5003 119 $${SHAREDCMD} $${SHAREDFLAGS} \
d07abe13 120 -o $(SHLIBNAME_FULL) \
f3ac5003 121 $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \
e96133e4 122 LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
7858cc03 123 $${SHAREDCMD} $${SHAREDFLAGS} \
d07abe13 124 -o $(SHLIBNAME_FULL) \
f210eb7b 125 $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
d6c76457 126 ) && $(SYMLINK_SO)
f210eb7b 127
30afcc07 128SYMLINK_SO= \
bfa96bc2 129 if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
d07abe13
RL
130 if [ -n "$(SHLIBNAME_FULL)" -a -n "$(SHLIBNAME)" -a \
131 "$(SHLIBNAME_FULL)" != "$(SHLIBNAME)" ]; then \
132 ( $(SET_X); \
133 rm -f $(SHLIBNAME); \
134 ln -s $(SHLIBNAME_FULL) $(SHLIBNAME) ); \
bfa96bc2 135 fi; \
30afcc07 136 fi
cf3b8b52 137
d07abe13 138LINK_SO_SHLIB= SHOBJECTS="$(STLIBNAME) $(LIBEXTRAS)"; $(LINK_SO)
e048fd51 139LINK_SO_DSO= INHIBIT_SYMLINKS=yes; SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
f210eb7b 140
e048fd51 141LINK_SO_SHLIB_VIA_O= \
d07abe13 142 SHOBJECTS=$(STLIBNAME).o; \
f968059c 143 ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
d07abe13
RL
144 ( $(ECHO) ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(STLIBNAME) $(LIBEXTRAS); \
145 ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(STLIBNAME) $(LIBEXTRAS) ); \
5407338a 146 $(LINK_SO) && ( $(ECHO) rm -f $$SHOBJECTS; rm -f $$SHOBJECTS )
f210eb7b 147
e048fd51 148LINK_SO_SHLIB_UNPACKED= \
30afcc07 149 UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
d07abe13 150 (cd $$UNPACKDIR; ar x ../$(STLIBNAME)) && \
e96133e4 151 ([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \
30afcc07
RL
152 SHOBJECTS=$$UNPACKDIR/*.o; \
153 $(LINK_SO) && rm -rf $$UNPACKDIR
154
a370537b 155DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
4d77d5b3 156
2b9608b0 157DO_GNU_SO_COMMON=\
d07abe13 158 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$(SHLIBNAME_FULL)"
35b3a614 159DO_GNU_DSO=\
35b3a614
RL
160 $(DO_GNU_SO_COMMON)
161DO_GNU_SO=\
f968059c
RL
162 ALLSYMSFLAGS='-Wl,--whole-archive'; \
163 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
35b3a614 164 $(DO_GNU_SO_COMMON)
075f7e2c 165DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS)"
12fd8be2 166
132eaa59
RL
167#This is rather special. It's a special target with which one can link
168#applications without bothering with any features that have anything to
169#do with shared libraries, for example when linking against static
170#libraries. It's mostly here to avoid a lot of conditionals everywhere
171#else...
172link_app.:
132eaa59
RL
173 $(LINK_APP)
174
e048fd51 175link_dso.gnu:
35b3a614 176 @ $(DO_GNU_DSO); $(LINK_SO_DSO)
e048fd51
RL
177link_shlib.gnu:
178 @ $(DO_GNU_SO); $(LINK_SO_SHLIB)
2d3de726
RL
179link_app.gnu:
180 @ $(DO_GNU_APP); $(LINK_APP)
30afcc07 181
e048fd51 182link_shlib.linux-shared:
cf9f1019 183 @$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
24e75727 184 $(DO_GNU_SO); \
e863d920 185 ALLSYMSFLAGS='-Wl,--whole-archive,--version-script=$(LIBNAME).map'; \
24e75727 186 $(LINK_SO_SHLIB)
e863d920 187
e048fd51 188link_dso.bsd:
35b3a614 189 @if $(DETECT_GNU_LD); then $(DO_GNU_DSO); else \
f210eb7b 190 LIBDEPS=" "; \
35b3a614 191 ALLSYMSFLAGS=; \
16760a30 192 NOALLSYMSFLAGS=; \
f210eb7b 193 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
e048fd51
RL
194 fi; $(LINK_SO_DSO)
195link_shlib.bsd:
a370537b 196 @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
f210eb7b 197 LIBDEPS=" "; \
16760a30
AP
198 ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
199 NOALLSYMSFLAGS=; \
f210eb7b 200 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
e048fd51 201 fi; $(LINK_SO_SHLIB)
16760a30 202link_app.bsd:
a370537b 203 @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
075f7e2c 204 LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
16760a30
AP
205 fi; $(LINK_APP)
206
30afcc07 207# For Darwin AKA Mac OS/X (dyld)
e048fd51 208# Originally link_dso.darwin produced .so, because it was hard-coded
cad6650f
AP
209# in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
210# extension in order to allow for run-time linking with vendor-
e048fd51 211# supplied shared libraries such as libz, so that link_dso.darwin had
cad6650f
AP
212# to be harmonized with it. This caused minor controversy, because
213# it was believed that dlopen can't be used to dynamically load
214# .dylib-s, only so called bundle modules (ones linked with -bundle
215# flag). The belief seems to be originating from pre-10.4 release,
216# where dlfcn functionality was emulated by dlcompat add-on. In
217# 10.4 dlopen was rewritten as native part of dyld and is documented
218# to be capable of loading both dynamic libraries and bundles. In
219# order to provide compatibility with pre-10.4 dlopen, modules are
220# linked with -bundle flag, which makes .dylib extension misleading.
221# It works, because dlopen is [and always was] extension-agnostic.
75db4b2f
AP
222# Alternative to this heuristic approach is to develop specific
223# MacOS X dso module relying on whichever "native" dyld interface.
e048fd51 224link_dso.darwin:
d07abe13 225 @ ALLSYMSFLAGS=''; \
f968059c 226 NOALLSYMSFLAGS=''; \
72f42193 227 SHAREDFLAGS="$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundle/`"; \
e048fd51
RL
228 $(LINK_SO_DSO)
229link_shlib.darwin:
d07abe13 230 @ ALLSYMSFLAGS='-all_load'; \
f968059c 231 NOALLSYMSFLAGS=''; \
d07abe13 232 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -current_version $(SHLIBVERSION) -compatibility_version $(SHLIBVERSION) -install_name $(INSTALLTOP)/$(LIBDIR)/$(SHLIBNAME_FULL)"; \
e048fd51 233 $(LINK_SO_SHLIB)
f210eb7b 234link_app.darwin: # is there run-path on darwin?
2d3de726 235 $(LINK_APP)
30afcc07 236
e048fd51 237link_dso.cygwin:
d07abe13 238 @ALLSYMSFLAGS=''; \
35b3a614 239 NOALLSYMSFLAGS=''; \
9ee0ed3d
RL
240 base=-Wl,--enable-auto-image-base; \
241 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic"; \
e048fd51 242 $(LINK_SO_DSO)
e048fd51 243link_shlib.cygwin:
d07abe13
RL
244 @ INHIBIT_SYMLINKS=yes; \
245 $(ECHO) "$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) |" \
8f41ff2d 246 "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
d07abe13 247 $(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) | \
8f41ff2d 248 $(RC) $(SHARED_RCFLAGS) -o rc.o; \
f968059c
RL
249 ALLSYMSFLAGS='-Wl,--whole-archive'; \
250 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
d07abe13 251 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,--enable-auto-image-base -Wl,-Bsymbolic -Wl,--out-implib,$(SHLIBNAME) rc.o"; \
e048fd51 252 $(LINK_SO_SHLIB) || exit 1; \
520f434b 253 rm rc.o
2d3de726 254link_app.cygwin:
2d3de726 255 $(LINK_APP)
30afcc07 256
520f434b
RL
257# link_dso.mingw-shared and link_app.mingw-shared are mapped to the
258# corresponding cygwin targets, as they do the exact same thing.
259link_shlib.mingw:
d07abe13 260 @ INHIBIT_SYMLINKS=yes; \
520f434b 261 $(PERL) $(SRCDIR)/util/mkdef.pl 32 $(LIBNAME) \
d07abe13 262 | sed -e 's|^\(LIBRARY *\)$(LIBNAME)32|\1$(SHLIBNAME_FULL)|' \
520f434b 263 > $(LIBNAME).def; \
d07abe13 264 echo "$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) |" \
8f41ff2d 265 "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
d07abe13 266 $(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) | \
8f41ff2d 267 $(RC) $(SHARED_RCFLAGS) -o rc.o; \
520f434b
RL
268 ALLSYMSFLAGS='-Wl,--whole-archive'; \
269 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
d07abe13 270 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,--out-implib,$(SHLIBNAME) $(LIBNAME).def rc.o"; \
520f434b
RL
271 $(LINK_SO_SHLIB) || exit 1; \
272 rm $(LIBNAME).def rc.o
273
e048fd51 274link_dso.alpha-osf1:
a370537b 275 @ if $(DETECT_GNU_LD); then \
35b3a614 276 $(DO_GNU_DSO); \
30afcc07 277 else \
35b3a614
RL
278 ALLSYMSFLAGS=''; \
279 NOALLSYMSFLAGS=''; \
ae4eb3c9 280 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
12fd8be2 281 fi; \
e048fd51
RL
282 $(LINK_SO_DSO)
283link_shlib.alpha-osf1:
a370537b 284 @ if $(DETECT_GNU_LD); then \
2d3de726 285 $(DO_GNU_SO); \
30afcc07 286 else \
f968059c
RL
287 ALLSYMSFLAGS='-all'; \
288 NOALLSYMSFLAGS='-none'; \
d07abe13 289 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic -set_version $(SHLIBVERSION)"; \
12fd8be2 290 fi; \
e048fd51 291 $(LINK_SO_SHLIB)
2d3de726 292link_app.alpha-osf1:
a370537b 293 @if $(DETECT_GNU_LD); then \
2d3de726
RL
294 $(DO_GNU_APP); \
295 else \
075f7e2c 296 LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
2d3de726
RL
297 fi; \
298 $(LINK_APP)
30afcc07 299
e048fd51 300link_dso.solaris:
a370537b 301 @ if $(DETECT_GNU_LD); then \
35b3a614 302 $(DO_GNU_DSO); \
30afcc07 303 else \
35b3a614
RL
304 ALLSYMSFLAGS=""; \
305 NOALLSYMSFLAGS=""; \
d07abe13 306 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $(SHLIBNAME_FULL) -Wl,-Bsymbolic"; \
12fd8be2 307 fi; \
e048fd51
RL
308 $(LINK_SO_DSO)
309link_shlib.solaris:
a370537b 310 @ if $(DETECT_GNU_LD); then \
2d3de726 311 $(DO_GNU_SO); \
30afcc07 312 else \
24e75727
RL
313 $(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
314 ALLSYMSFLAGS="-Wl,-z,allextract,-M,$(LIBNAME).map"; \
4ad38641 315 NOALLSYMSFLAGS="-Wl,-z,defaultextract"; \
d07abe13 316 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $(SHLIBNAME_FULL) -Wl,-Bsymbolic"; \
12fd8be2 317 fi; \
e048fd51 318 $(LINK_SO_SHLIB)
2d3de726 319link_app.solaris:
a370537b 320 @ if $(DETECT_GNU_LD); then \
2d3de726
RL
321 $(DO_GNU_APP); \
322 else \
075f7e2c 323 LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
2d3de726
RL
324 fi; \
325 $(LINK_APP)
30afcc07
RL
326
327# OpenServer 5 native compilers used
e048fd51 328link_dso.svr3:
a370537b 329 @ if $(DETECT_GNU_LD); then \
35b3a614 330 $(DO_GNU_DSO); \
a1092201 331 else \
a1092201
RL
332 ALLSYMSFLAGS=''; \
333 NOALLSYMSFLAGS=''; \
d07abe13 334 SHAREDFLAGS="$(CFLAGS) -G -h $(SHLIBNAME_FULL)"; \
a1092201 335 fi; \
e048fd51
RL
336 $(LINK_SO_DSO)
337link_shlib.svr3:
a370537b 338 @ if $(DETECT_GNU_LD); then \
a1092201
RL
339 $(DO_GNU_SO); \
340 else \
a1092201
RL
341 ALLSYMSFLAGS=''; \
342 NOALLSYMSFLAGS=''; \
d07abe13 343 SHAREDFLAGS="$(CFLAGS) -G -h $(SHLIBNAME_FULL)"; \
a1092201 344 fi; \
e048fd51 345 $(LINK_SO_SHLIB_UNPACKED)
a1092201 346link_app.svr3:
a370537b 347 @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
a1092201
RL
348 $(LINK_APP)
349
350# UnixWare 7 and OpenUNIX 8 native compilers used
e048fd51 351link_dso.svr5:
a370537b 352 @ if $(DETECT_GNU_LD); then \
35b3a614 353 $(DO_GNU_DSO); \
30afcc07 354 else \
24692fc5 355 SHARE_FLAG='-G'; \
f210eb7b 356 ($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
e96133e4 357 ALLSYMSFLAGS=''; \
f968059c 358 NOALLSYMSFLAGS=''; \
d07abe13 359 SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $(SHLIBNAME_FULL)"; \
12fd8be2 360 fi; \
e048fd51
RL
361 $(LINK_SO_DSO)
362link_shlib.svr5:
a370537b 363 @ if $(DETECT_GNU_LD); then \
2d3de726 364 $(DO_GNU_SO); \
30afcc07 365 else \
24692fc5 366 SHARE_FLAG='-G'; \
a370537b 367 ($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
e96133e4 368 ALLSYMSFLAGS=''; \
f968059c 369 NOALLSYMSFLAGS=''; \
d07abe13 370 SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $(SHLIBNAME_FULL)"; \
12fd8be2 371 fi; \
e048fd51 372 $(LINK_SO_SHLIB_UNPACKED)
a1092201 373link_app.svr5:
a370537b 374 @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
2d3de726 375 $(LINK_APP)
30afcc07 376
e048fd51 377link_dso.irix:
a370537b 378 @ if $(DETECT_GNU_LD); then \
35b3a614 379 $(DO_GNU_DSO); \
30afcc07 380 else \
35b3a614
RL
381 ALLSYMSFLAGS=""; \
382 NOALLSYMSFLAGS=""; \
d07abe13 383 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic"; \
12fd8be2 384 fi; \
e048fd51
RL
385 $(LINK_SO_DSO)
386link_shlib.irix:
a370537b 387 @ if $(DETECT_GNU_LD); then \
2d3de726 388 $(DO_GNU_SO); \
30afcc07 389 else \
30fbcaa2
AP
390 MINUSWL=""; \
391 ($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
392 ALLSYMSFLAGS="$${MINUSWL}-all"; \
bd16cd6b 393 NOALLSYMSFLAGS="$${MINUSWL}-none"; \
d07abe13 394 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic"; \
12fd8be2 395 fi; \
e048fd51 396 $(LINK_SO_SHLIB)
2d3de726 397link_app.irix:
075f7e2c 398 @LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
2d3de726 399 $(LINK_APP)
30afcc07 400
393b704d
AP
401# 32-bit PA-RISC HP-UX embeds the -L pathname of libs we link with, so
402# we compensate for it with +cdp ../: and +cdp ./:. Yes, these rewrite
403# rules imply that we can only link one level down in catalog structure,
404# but that's what takes place for the moment of this writing. +cdp option
405# was introduced in HP-UX 11.x and applies in 32-bit PA-RISC link
406# editor context only [it's simply ignored in other cases, which are all
407# ELFs by the way].
30afcc07 408#
e048fd51 409link_dso.hpux:
35b3a614 410 @if $(DETECT_GNU_LD); then $(DO_GNU_DSO); else \
35b3a614 411 ALLSYMSFLAGS=''; \
f968059c 412 NOALLSYMSFLAGS=''; \
1a83c372 413 expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
d07abe13 414 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$(SHLIBNAME_FULL),+cdp,../:,+cdp,./:"; \
15fd2de3 415 fi; \
d07abe13
RL
416 rm -f $(SHLIBNAME_FULL) || :; \
417 $(LINK_SO_DSO) && chmod a=rx $(SHLIBNAME_FULL)
e048fd51 418link_shlib.hpux:
a370537b 419 @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
2bbc970e 420 ALLSYMSFLAGS='-Wl,-Fl'; \
f968059c 421 NOALLSYMSFLAGS=''; \
1a83c372 422 expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
d07abe13 423 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$(SHLIBNAME_FULL),+cdp,../:,+cdp,./:"; \
15fd2de3 424 fi; \
d07abe13
RL
425 rm -f $(SHLIBNAME_FULL) || :; \
426 $(LINK_SO_SHLIB) && chmod a=rx $(SHLIBNAME_FULL)
1a83c372 427link_app.hpux:
a370537b 428 @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
075f7e2c 429 LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,+s,+cdp,../:,+cdp,./:"; \
15fd2de3 430 fi; \
2d3de726 431 $(LINK_APP)
30afcc07 432
e048fd51
RL
433link_dso.aix:
434 @OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || :; \
fe28866d 435 OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
0d1aa74d 436 ALLSYMSFLAGS=''; \
f968059c 437 NOALLSYMSFLAGS=''; \
492279f6 438 SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
d07abe13 439 rm -f $(SHLIBNAME_FULL) 2>&1 > /dev/null ; \
e048fd51
RL
440 $(LINK_SO_DSO);
441link_shlib.aix:
d07abe13 442 @ OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || : ; \
fe28866d 443 OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
f968059c
RL
444 ALLSYMSFLAGS='-bnogc'; \
445 NOALLSYMSFLAGS=''; \
492279f6 446 SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
d07abe13 447 rm -f $(SHLIBNAME_FULL) 2>&1 > /dev/null ; \
e048fd51 448 $(LINK_SO_SHLIB_VIA_O)
2d3de726 449link_app.aix:
075f7e2c 450 LDFLAGS="$(CFLAGS) -Wl,-bsvr4 $(LDFLAGS)"; \
2d3de726 451 $(LINK_APP)
30afcc07 452
30afcc07
RL
453
454# Targets to build symbolic links when needed
a1092201 455symlink.gnu symlink.solaris symlink.svr3 symlink.svr5 symlink.irix \
6c23ca0c 456symlink.aix:
d07abe13 457 @ $(SYMLINK_SO)
83699c47 458symlink.darwin:
d07abe13 459 @ $(SYMLINK_SO)
1a83c372 460symlink.hpux:
d07abe13 461 @ $(SYMLINK_SO)
bfa96bc2 462# The following lines means those specific architectures do no symlinks
fcf64ba0 463symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
30afcc07
RL
464
465# Compatibility targets
02f603f2 466link_dso.bsd-gcc-shared link_dso.linux-shared link_dso.gnu-shared: link_dso.gnu
150a4790 467link_shlib.bsd-gcc-shared: link_shlib.linux-shared
02f603f2
AP
468link_shlib.gnu-shared: link_shlib.gnu
469link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
470symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
e048fd51
RL
471link_dso.bsd-shared: link_dso.bsd
472link_shlib.bsd-shared: link_shlib.bsd
16760a30 473link_app.bsd-shared: link_app.bsd
e048fd51
RL
474link_dso.darwin-shared: link_dso.darwin
475link_shlib.darwin-shared: link_shlib.darwin
2d3de726 476link_app.darwin-shared: link_app.darwin
30afcc07 477symlink.darwin-shared: symlink.darwin
e048fd51
RL
478link_dso.cygwin-shared: link_dso.cygwin
479link_shlib.cygwin-shared: link_shlib.cygwin
2d3de726 480link_app.cygwin-shared: link_app.cygwin
30afcc07 481symlink.cygwin-shared: symlink.cygwin
520f434b
RL
482link_dso.mingw-shared: link_dso.cygwin
483link_shlib.mingw-shared: link_shlib.mingw
484link_app.mingw-shared: link_app.cygwin
485symlink.mingw-shared: symlink.cygwin
e048fd51
RL
486link_dso.alpha-osf1-shared: link_dso.alpha-osf1
487link_shlib.alpha-osf1-shared: link_shlib.alpha-osf1
2d3de726 488link_app.alpha-osf1-shared: link_app.alpha-osf1
30afcc07 489symlink.alpha-osf1-shared: symlink.alpha-osf1
e048fd51
RL
490link_dso.tru64-shared: link_dso.tru64
491link_shlib.tru64-shared: link_shlib.tru64
2d3de726 492link_app.tru64-shared: link_app.tru64
30afcc07 493symlink.tru64-shared: symlink.tru64
e048fd51
RL
494link_dso.tru64-shared-rpath: link_dso.tru64-rpath
495link_shlib.tru64-shared-rpath: link_shlib.tru64-rpath
2d3de726 496link_app.tru64-shared-rpath: link_app.tru64-rpath
30afcc07 497symlink.tru64-shared-rpath: symlink.tru64-rpath
e048fd51
RL
498link_dso.solaris-shared: link_dso.solaris
499link_shlib.solaris-shared: link_shlib.solaris
2d3de726 500link_app.solaris-shared: link_app.solaris
30afcc07 501symlink.solaris-shared: symlink.solaris
e048fd51
RL
502link_dso.svr3-shared: link_dso.svr3
503link_shlib.svr3-shared: link_shlib.svr3
2d3de726 504link_app.svr3-shared: link_app.svr3
30afcc07 505symlink.svr3-shared: symlink.svr3
e048fd51
RL
506link_dso.svr5-shared: link_dso.svr5
507link_shlib.svr5-shared: link_shlib.svr5
a1092201
RL
508link_app.svr5-shared: link_app.svr5
509symlink.svr5-shared: symlink.svr5
e048fd51
RL
510link_dso.irix-shared: link_dso.irix
511link_shlib.irix-shared: link_shlib.irix
2d3de726 512link_app.irix-shared: link_app.irix
30afcc07 513symlink.irix-shared: symlink.irix
e048fd51
RL
514link_dso.hpux-shared: link_dso.hpux
515link_shlib.hpux-shared: link_shlib.hpux
1a83c372
AP
516link_app.hpux-shared: link_app.hpux
517symlink.hpux-shared: symlink.hpux
e048fd51
RL
518link_dso.aix-shared: link_dso.aix
519link_shlib.aix-shared: link_shlib.aix
2d3de726 520link_app.aix-shared: link_app.aix
30afcc07 521symlink.aix-shared: symlink.aix