]> git.ipfire.org Git - thirdparty/openssl.git/blame - Makefile.shared
Remove $no_sse2, as it's just a 'copy' of $disabled{sse2}
[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
AP
22NM=nm
23
2d3de726 24# LIBNAME contains just the name of the library, without prefix ("lib"
30afcc07 25# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
2d3de726
RL
26# .dll, ...). This one MUST have a value when using this makefile to
27# build shared libraries.
30afcc07
RL
28# For example, to build libfoo.so, you need to do the following:
29#LIBNAME=foo
30LIBNAME=
31
8e5cd8b0
RL
32# STLIBNAME contains the path of the static library to build the shared
33# library from, for example:
34#STLIBNAME=libfoo.a
35STLIBNAME=
36
37# On most Unix platforms, SHLIBNAME contains the path of the short name of
38# the shared library to build, for example
39#SHLIBNAME=libfoo.so
40# On Windows POSIX layers (cygwin and mingw), SHLIBNAME contains the import
41# library name for the shared library to be built, for example:
42#SHLIBNAME=libfoo.dll.a
43
44# SHLIBNAME_FULL contains the path of the full name of the shared library to
45# build, for example:
46#SHLIBNAME_FULL=libfoo.so.1.2
47# When building DSOs, SHLIBNAME_FULL contains path of the full DSO name, for
48# example:
49#SHLIBNAME_FULL=dir/dso.so
50SHLIBNAME_FULL=
51
52# SHLIBVERSION contains the current version of the shared library (not to
53# be confused with the project version)
54#SHLIBVERSION=1.2
55SHLIBVERSION=
56
57# NOTE: to build shared libraries, LIBNAME, STLIBNAME, SHLIBNAME and
58# SHLIBNAME_FULL MUST have values when using this makefile, and in some
59# cases, SHLIBVERSION as well. To build DSOs, SHLIBNAME_FULL MUST have
60# a value, the rest can be left alone.
61
62
2d3de726
RL
63# APPNAME contains just the name of the application, without suffix (""
64# on Unix, ".exe" on Windows, ...). This one MUST have a value when using
65# this makefile to build applications.
66# For example, to build foo, you need to do the following:
67#APPNAME=foo
68APPNAME=
69
d7465918
RL
70# SRCDIR is the top directory of the source tree.
71SRCDIR=.
72
2d3de726
RL
73# OBJECTS contains all the object files to link together into the application.
74# This must contain at least one object file.
75#OBJECTS=foo.o
76OBJECTS=
77
30afcc07 78# LIBEXTRAS contains extra modules to link together with the library.
8d6fc30b 79# For example, if a second library, say libbar.a needs to be linked into
30afcc07
RL
80# libfoo.so, you need to do the following:
81#LIBEXTRAS=libbar.a
e048fd51
RL
82# Note that this MUST be used when using the link_dso targets, to hold the
83# names of all object files that go into the target shared object.
30afcc07
RL
84LIBEXTRAS=
85
30afcc07
RL
86# LIBDEPS contains all the flags necessary to cover all necessary
87# dependencies to other libraries.
88LIBDEPS=
89
90#------------------------------------------------------------------------------
91# The rest is private to this makefile.
92
c4cd925c 93SET_X=:
1dc02bba 94#SET_X=set -x
30afcc07
RL
95
96top:
97 echo "Trying to use this makefile interactively? Don't."
98
2d3de726 99LINK_APP= \
fe28866d 100 ( $(SET_X); \
7858cc03 101 LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
c86ddbe6 102 LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS) $(LDFLAGS)}"; \
ab4d6898 103 LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
d6fd88ff 104 LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
f3ac5003
RL
105 echo LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
106 $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS}; \
e96133e4 107 LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
7858cc03 108 $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
2d3de726 109
30afcc07 110LINK_SO= \
fe28866d 111 ( $(SET_X); \
7858cc03
AP
112 LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
113 SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
114 SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
ab4d6898 115 LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
d6fd88ff 116 LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
f3ac5003
RL
117 echo LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
118 $${SHAREDCMD} $${SHAREDFLAGS} \
8e5cd8b0 119 -o $(SHLIBNAME_FULL) \
f3ac5003 120 $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \
e96133e4 121 LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
7858cc03 122 $${SHAREDCMD} $${SHAREDFLAGS} \
8e5cd8b0 123 -o $(SHLIBNAME_FULL) \
f210eb7b 124 $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
d6c76457 125 ) && $(SYMLINK_SO)
f210eb7b 126
30afcc07 127SYMLINK_SO= \
bfa96bc2 128 if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
8e5cd8b0
RL
129 if [ -n "$(SHLIBNAME_FULL)" -a -n "$(SHLIBNAME)" -a \
130 "$(SHLIBNAME_FULL)" != "$(SHLIBNAME)" ]; then \
131 ( $(SET_X); \
132 rm -f $(SHLIBNAME); \
133 ln -s $(SHLIBNAME_FULL) $(SHLIBNAME) ); \
bfa96bc2 134 fi; \
30afcc07 135 fi
cf3b8b52 136
8e5cd8b0 137LINK_SO_SHLIB= SHOBJECTS="$(STLIBNAME) $(LIBEXTRAS)"; $(LINK_SO)
e048fd51 138LINK_SO_DSO= INHIBIT_SYMLINKS=yes; SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
f210eb7b 139
e048fd51 140LINK_SO_SHLIB_VIA_O= \
8e5cd8b0 141 SHOBJECTS=$(STLIBNAME).o; \
f968059c 142 ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
8e5cd8b0
RL
143 ( echo ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(STLIBNAME) $(LIBEXTRAS); \
144 ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(STLIBNAME) $(LIBEXTRAS) ); \
d7465918 145 $(LINK_SO) && ( echo rm -f $$SHOBJECTS; rm -f $$SHOBJECTS )
f210eb7b 146
e048fd51 147LINK_SO_SHLIB_UNPACKED= \
30afcc07 148 UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
8e5cd8b0 149 (cd $$UNPACKDIR; ar x ../$(STLIBNAME)) && \
e96133e4 150 ([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \
30afcc07
RL
151 SHOBJECTS=$$UNPACKDIR/*.o; \
152 $(LINK_SO) && rm -rf $$UNPACKDIR
153
a370537b 154DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
4d77d5b3 155
2b9608b0 156DO_GNU_SO_COMMON=\
8e5cd8b0 157 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$(SHLIBNAME_FULL)"
35b3a614 158DO_GNU_DSO=\
35b3a614
RL
159 $(DO_GNU_SO_COMMON)
160DO_GNU_SO=\
f968059c
RL
161 ALLSYMSFLAGS='-Wl,--whole-archive'; \
162 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
35b3a614 163 $(DO_GNU_SO_COMMON)
68f3b899 164DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS)"
12fd8be2 165
132eaa59
RL
166#This is rather special. It's a special target with which one can link
167#applications without bothering with any features that have anything to
168#do with shared libraries, for example when linking against static
169#libraries. It's mostly here to avoid a lot of conditionals everywhere
170#else...
171link_app.:
132eaa59
RL
172 $(LINK_APP)
173
e048fd51 174link_dso.gnu:
35b3a614 175 @ $(DO_GNU_DSO); $(LINK_SO_DSO)
e048fd51
RL
176link_shlib.gnu:
177 @ $(DO_GNU_SO); $(LINK_SO_SHLIB)
2d3de726
RL
178link_app.gnu:
179 @ $(DO_GNU_APP); $(LINK_APP)
30afcc07 180
e048fd51 181link_shlib.linux-shared:
24e75727
RL
182 @$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
183 $(DO_GNU_SO); \
e863d920 184 ALLSYMSFLAGS='-Wl,--whole-archive,--version-script=$(LIBNAME).map'; \
24e75727 185 $(LINK_SO_SHLIB)
e863d920 186
e048fd51 187link_dso.bsd:
35b3a614 188 @if $(DETECT_GNU_LD); then $(DO_GNU_DSO); else \
f210eb7b 189 LIBDEPS=" "; \
35b3a614 190 ALLSYMSFLAGS=; \
16760a30 191 NOALLSYMSFLAGS=; \
f210eb7b 192 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
e048fd51
RL
193 fi; $(LINK_SO_DSO)
194link_shlib.bsd:
a370537b 195 @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
f210eb7b 196 LIBDEPS=" "; \
16760a30
AP
197 ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
198 NOALLSYMSFLAGS=; \
f210eb7b 199 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
e048fd51 200 fi; $(LINK_SO_SHLIB)
16760a30 201link_app.bsd:
a370537b 202 @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
68f3b899 203 LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
16760a30
AP
204 fi; $(LINK_APP)
205
30afcc07 206# For Darwin AKA Mac OS/X (dyld)
e048fd51 207# Originally link_dso.darwin produced .so, because it was hard-coded
cad6650f
AP
208# in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
209# extension in order to allow for run-time linking with vendor-
e048fd51 210# supplied shared libraries such as libz, so that link_dso.darwin had
cad6650f
AP
211# to be harmonized with it. This caused minor controversy, because
212# it was believed that dlopen can't be used to dynamically load
213# .dylib-s, only so called bundle modules (ones linked with -bundle
214# flag). The belief seems to be originating from pre-10.4 release,
215# where dlfcn functionality was emulated by dlcompat add-on. In
216# 10.4 dlopen was rewritten as native part of dyld and is documented
217# to be capable of loading both dynamic libraries and bundles. In
218# order to provide compatibility with pre-10.4 dlopen, modules are
219# linked with -bundle flag, which makes .dylib extension misleading.
220# It works, because dlopen is [and always was] extension-agnostic.
75db4b2f
AP
221# Alternative to this heuristic approach is to develop specific
222# MacOS X dso module relying on whichever "native" dyld interface.
e048fd51 223link_dso.darwin:
8e5cd8b0 224 @ ALLSYMSFLAGS=''; \
f968059c 225 NOALLSYMSFLAGS=''; \
72f42193 226 SHAREDFLAGS="$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundle/`"; \
e048fd51
RL
227 $(LINK_SO_DSO)
228link_shlib.darwin:
8e5cd8b0 229 @ ALLSYMSFLAGS='-all_load'; \
f968059c 230 NOALLSYMSFLAGS=''; \
8e5cd8b0 231 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -current_version $(SHLIBVERSION) -compatibility_version $(SHLIBVERSION) -install_name $(INSTALLTOP)/$(LIBDIR)/$(SHLIBNAME_FULL)"; \
e048fd51 232 $(LINK_SO_SHLIB)
f210eb7b 233link_app.darwin: # is there run-path on darwin?
2d3de726 234 $(LINK_APP)
30afcc07 235
e048fd51 236link_dso.cygwin:
8e5cd8b0 237 @ALLSYMSFLAGS=''; \
35b3a614 238 NOALLSYMSFLAGS=''; \
9ee0ed3d
RL
239 base=-Wl,--enable-auto-image-base; \
240 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic"; \
e048fd51 241 $(LINK_SO_DSO)
e048fd51 242link_shlib.cygwin:
8e5cd8b0
RL
243 @ INHIBIT_SYMLINKS=yes; \
244 echo "$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) |" \
8f41ff2d 245 "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
8e5cd8b0 246 $(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) | \
8f41ff2d 247 $(RC) $(SHARED_RCFLAGS) -o rc.o; \
f968059c
RL
248 ALLSYMSFLAGS='-Wl,--whole-archive'; \
249 NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
8e5cd8b0 250 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,--enable-auto-image-base -Wl,-Bsymbolic -Wl,--out-implib,$(SHLIBNAME) rc.o"; \
e048fd51 251 $(LINK_SO_SHLIB) || exit 1; \
520f434b 252 rm rc.o
2d3de726 253link_app.cygwin:
2d3de726 254 $(LINK_APP)
30afcc07 255
520f434b
RL
256# link_dso.mingw-shared and link_app.mingw-shared are mapped to the
257# corresponding cygwin targets, as they do the exact same thing.
258link_shlib.mingw:
8e5cd8b0 259 @ INHIBIT_SYMLINKS=yes; \
464dadb2 260 base=; [ $(LIBNAME) = "crypto" -a -n "$(FIPSCANLIB)" ] && base=-Wl,--image-base,0x63000000; \
520f434b 261 $(PERL) $(SRCDIR)/util/mkdef.pl 32 $(LIBNAME) \
8e5cd8b0 262 | sed -e 's|^\(LIBRARY *\)$(LIBNAME)32|\1$(SHLIBNAME_FULL)|' \
520f434b 263 > $(LIBNAME).def; \
8e5cd8b0 264 echo "$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) |" \
8f41ff2d 265 "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
8e5cd8b0 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'; \
8e5cd8b0 270 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -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'; \
8e5cd8b0 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 \
68f3b899 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=""; \
8e5cd8b0 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"; \
8e5cd8b0 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 \
68f3b899 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=''; \
8e5cd8b0 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=''; \
8e5cd8b0 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=''; \
8e5cd8b0 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=''; \
8e5cd8b0 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=""; \
8e5cd8b0 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"; \
8e5cd8b0 394 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic"; \
12fd8be2 395 fi; \
e048fd51 396 $(LINK_SO_SHLIB)
2d3de726 397link_app.irix:
68f3b899 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'; \
8e5cd8b0 414 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$(SHLIBNAME_FULL),+cdp,../:,+cdp,./:"; \
15fd2de3 415 fi; \
8e5cd8b0
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'; \
8e5cd8b0 423 SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$(SHLIBNAME_FULL),+cdp,../:,+cdp,./:"; \
15fd2de3 424 fi; \
8e5cd8b0
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 \
68f3b899 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'; \
8e5cd8b0 439 rm -f $(SHLIBNAME_FULL) 2>&1 > /dev/null ; \
e048fd51
RL
440 $(LINK_SO_DSO);
441link_shlib.aix:
8e5cd8b0 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'; \
8e5cd8b0 447 rm -f $(SHLIBNAME_FULL) 2>&1 > /dev/null ; \
e048fd51 448 $(LINK_SO_SHLIB_VIA_O)
2d3de726 449link_app.aix:
68f3b899 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:
8e5cd8b0 457 @ $(SYMLINK_SO)
83699c47 458symlink.darwin:
8e5cd8b0 459 @ $(SYMLINK_SO)
1a83c372 460symlink.hpux:
8e5cd8b0 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