~ubuntu-branches/ubuntu/lucid/openssl/lucid-proposed

1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
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
9
CC=cc
10
CFLAGS=$(CFLAG)
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.
14
LDFLAGS=
15
SHARED_LDFLAGS=
16
17
# LIBNAME contains just the name of the library, without prefix ("lib"
18
# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
19
# .dll, ...).  This one MUST have a value when using this makefile to
20
# build shared libraries.
21
# For example, to build libfoo.so, you need to do the following:
22
#LIBNAME=foo
23
LIBNAME=
24
25
# APPNAME contains just the name of the application, without suffix (""
26
# on Unix, ".exe" on Windows, ...).  This one MUST have a value when using
27
# this makefile to build applications.
28
# For example, to build foo, you need to do the following:
29
#APPNAME=foo
30
APPNAME=
31
32
# OBJECTS contains all the object files to link together into the application.
33
# This must contain at least one object file.
34
#OBJECTS=foo.o
35
OBJECTS=
36
37
# LIBEXTRAS contains extra modules to link together with the library.
38
# For example, if a second library, say libbar.a needs to be linked into
39
# libfoo.so, you need to do the following:
40
#LIBEXTRAS=libbar.a
41
# Note that this MUST be used when using the link_o targets, to hold the
42
# names of all object files that go into the target library.
43
LIBEXTRAS=
44
45
# LIBVERSION contains the current version of the library.
46
# For example, to build libfoo.so.1.2, you need to do the following:
47
#LIBVERSION=1.2
48
LIBVERSION=
49
50
# LIBCOMPATVERSIONS contains the compatibility versions (a list) of
51
# the library.  They MUST be in decreasing order.
52
# For example, if libfoo.so.1.2.1 is backward compatible with libfoo.so.1.2
53
# and libfoo.so.1, you need to do the following:
54
#LIBCOMPATVERSIONS=1.2 1
55
# Note that on systems that use sonames, the last number will appear as
56
# part of it.
57
# It's also possible, for systems that support it (Tru64, for example),
58
# to add extra compatibility info with more precision, by adding a second
59
# list of versions, separated from the first with a semicolon, like this:
60
#LIBCOMPATVERSIONS=1.2 1;1.2.0 1.1.2 1.1.1 1.1.0 1.0.0
61
LIBCOMPATVERSIONS=
62
63
# LIBDEPS contains all the flags necessary to cover all necessary
64
# dependencies to other libraries.
65
LIBDEPS=
66
67
#------------------------------------------------------------------------------
68
# The rest is private to this makefile.
69
70
SET_X=:
71
#SET_X=set -x
72
73
top:
74
	echo "Trying to use this makefile interactively?  Don't."
75
76
CALC_VERSIONS=	\
77
	SHLIB_COMPAT=; SHLIB_SOVER=; \
78
	if [ -n "$(LIBVERSION)$(LIBCOMPATVERSIONS)" ]; then \
79
		prev=""; \
80
		for v in `echo "$(LIBVERSION) $(LIBCOMPATVERSIONS)" | cut -d';' -f1`; do \
81
			SHLIB_SOVER_NODOT=$$v; \
82
			SHLIB_SOVER=.$$v; \
83
			if [ -n "$$prev" ]; then \
84
				SHLIB_COMPAT="$$SHLIB_COMPAT .$$prev"; \
85
			fi; \
86
			prev=$$v; \
87
		done; \
88
	fi
89
90
LINK_APP=	\
91
  ( $(SET_X);   \
92
    LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
93
    LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \
94
    LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
95
    LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
96
    LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
97
    $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
98
99
LINK_SO=	\
100
  ( $(SET_X);   \
101
    LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
102
    SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
103
    SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
104
    LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
105
    LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
106
    LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
107
    $${SHAREDCMD} $${SHAREDFLAGS} \
108
	-o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
109
	$$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
1.1.7 by Kurt Roeckx
Import upstream version 0.9.8k
110
  ) && $(SYMLINK_SO)
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
111
112
SYMLINK_SO=	\
113
	if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
114
		prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
115
		if [ -n "$$SHLIB_COMPAT" ]; then \
116
			for x in $$SHLIB_COMPAT; do \
117
				( $(SET_X); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \
118
				  ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \
119
				prev=$$SHLIB$$x$$SHLIB_SUFFIX; \
120
			done; \
121
		fi; \
122
		if [ -n "$$SHLIB_SOVER" ]; then \
123
			( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \
124
			  ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \
125
		fi; \
126
	fi
127
128
LINK_SO_A=	SHOBJECTS="lib$(LIBNAME).a $(LIBEXTRAS)"; $(LINK_SO)
129
LINK_SO_O=	SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
130
131
LINK_SO_A_VIA_O=	\
132
  SHOBJECTS=lib$(LIBNAME).o; \
133
  ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
134
  ( $(SET_X); \
135
    ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS) ); \
136
  $(LINK_SO) && rm -f $(LIBNAME).o
137
138
LINK_SO_A_UNPACKED=	\
139
  UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
140
  (cd $$UNPACKDIR; ar x ../lib$(LIBNAME).a) && \
141
  ([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \
142
  SHOBJECTS=$$UNPACKDIR/*.o; \
143
  $(LINK_SO) && rm -rf $$UNPACKDIR
144
145
DETECT_GNU_LD=(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
146
147
DO_GNU_SO=$(CALC_VERSIONS); \
148
	SHLIB=lib$(LIBNAME).so; \
149
	SHLIB_SUFFIX=; \
150
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
151
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
11.1.6 by Kurt Roeckx
* Split all the patches into a separate files
152
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
153
11.1.6 by Kurt Roeckx
* Split all the patches into a separate files
154
DO_GNU_APP=LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
155
156
#This is rather special.  It's a special target with which one can link
157
#applications without bothering with any features that have anything to
158
#do with shared libraries, for example when linking against static
159
#libraries.  It's mostly here to avoid a lot of conditionals everywhere
160
#else...
161
link_app.:
162
	$(LINK_APP)
163
164
link_o.gnu:
165
	@ $(DO_GNU_SO); $(LINK_SO_O)
166
link_a.gnu:
167
	@ $(DO_GNU_SO); $(LINK_SO_A)
168
link_app.gnu:
169
	@ $(DO_GNU_APP); $(LINK_APP)
170
171
link_o.bsd:
172
	@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
173
	$(CALC_VERSIONS); \
174
	SHLIB=lib$(LIBNAME).so; \
175
	SHLIB_SUFFIX=; \
176
	LIBDEPS=" "; \
177
	ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
178
	NOALLSYMSFLAGS=; \
179
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
180
	fi; $(LINK_SO_O)
181
link_a.bsd:
182
	@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
183
	$(CALC_VERSIONS); \
184
	SHLIB=lib$(LIBNAME).so; \
185
	SHLIB_SUFFIX=; \
186
	LIBDEPS=" "; \
187
	ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
188
	NOALLSYMSFLAGS=; \
189
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
190
	fi; $(LINK_SO_A)
191
link_app.bsd:
192
	@if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
193
	LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBPATH)"; \
194
	fi; $(LINK_APP)
195
196
# For Darwin AKA Mac OS/X (dyld)
1.1.3 by Kurt Roeckx
Import upstream version 0.9.8b
197
# link_o.darwin produces .so, because we let it use dso_dlfcn module,
198
# which has .so extension hard-coded. One can argue that one should
199
# develop special dso module for MacOS X. At least manual encourages
200
# to use native NSModule(3) API and refers to dlfcn as termporary hack.
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
201
link_o.darwin:
202
	@ $(CALC_VERSIONS); \
1.1.7 by Kurt Roeckx
Import upstream version 0.9.8k
203
	SHLIB=`expr "$$THIS" : '.*/\([^/\.]*\)\.'`; \
204
	SHLIB=$${SHLIB:-lib$(LIBNAME)}; \
205
	SHLIB_SUFFIX=`expr "$$THIS" : '.*\(\.[^\.]*\)$$'`; \
206
	SHLIB_SUFFIX=$${SHLIB_SUFFIX:-.so}; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
207
	ALLSYMSFLAGS='-all_load'; \
208
	NOALLSYMSFLAGS=''; \
209
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS)"; \
210
	if [ -n "$(LIBVERSION)" ]; then \
211
		SHAREDFLAGS="$$SHAREDFLAGS -current_version $(LIBVERSION)"; \
212
	fi; \
213
	if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
214
		SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
215
	fi; \
216
	$(LINK_SO_O)
217
link_a.darwin:
218
	@ $(CALC_VERSIONS); \
219
	SHLIB=lib$(LIBNAME); \
220
	SHLIB_SUFFIX=.dylib; \
221
	ALLSYMSFLAGS='-all_load'; \
222
	NOALLSYMSFLAGS=''; \
223
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS)"; \
224
	if [ -n "$(LIBVERSION)" ]; then \
225
		SHAREDFLAGS="$$SHAREDFLAGS -current_version $(LIBVERSION)"; \
226
	fi; \
227
	if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
228
		SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
229
	fi; \
1.1.3 by Kurt Roeckx
Import upstream version 0.9.8b
230
	SHAREDFLAGS="$$SHAREDFLAGS -install_name ${INSTALLTOP}/lib/$$SHLIB${SHLIB_EXT}"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
231
	$(LINK_SO_A)
232
link_app.darwin:	# is there run-path on darwin?
233
	$(LINK_APP)
234
235
link_o.cygwin:
236
	@ $(CALC_VERSIONS); \
237
	INHIBIT_SYMLINKS=yes; \
238
	SHLIB=cyg$(LIBNAME); \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
239
	base=-Wl,--enable-auto-image-base; \
240
	if expr $(PLATFORM) : 'mingw' > /dev/null; then \
241
		SHLIB=$(LIBNAME)eay32; base=; \
242
	fi; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
243
	SHLIB_SUFFIX=.dll; \
244
	LIBVERSION="$(LIBVERSION)"; \
245
	SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
246
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
247
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
248
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
249
	$(LINK_SO_O)
250
link_a.cygwin:
251
	@ $(CALC_VERSIONS); \
252
	INHIBIT_SYMLINKS=yes; \
253
	SHLIB=cyg$(LIBNAME); \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
254
	base=-Wl,--enable-auto-image-base; \
255
	if expr $(PLATFORM) : 'mingw' > /dev/null; then \
256
		SHLIB=$(LIBNAME)eay32; \
257
		base=;  [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
258
	fi; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
259
	SHLIB_SUFFIX=.dll; \
260
	SHLIB_SOVER=-$(LIBVERSION); \
261
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
262
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
263
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
264
	[ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \
265
	[ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \
266
	$(LINK_SO_A) || exit 1; \
267
	cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX apps/; \
268
	cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX test/
269
link_app.cygwin:
270
	$(LINK_APP)
271
272
link_o.alpha-osf1:
273
	@ if ${DETECT_GNU_LD}; then \
274
		$(DO_GNU_SO); \
275
	else \
276
		SHLIB=lib$(LIBNAME).so; \
277
		SHLIB_SUFFIX=; \
278
		SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
279
		if [ -n "$$SHLIB_HIST" ]; then \
280
			SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
281
		else \
282
			SHLIB_HIST="$(LIBVERSION)"; \
283
		fi; \
284
		SHLIB_SOVER=; \
285
		ALLSYMSFLAGS='-all'; \
286
		NOALLSYMSFLAGS='-none'; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
287
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
288
		if [ -n "$$SHLIB_HIST" ]; then \
1.1.3 by Kurt Roeckx
Import upstream version 0.9.8b
289
			SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
290
		fi; \
291
	fi; \
292
	$(LINK_SO_O)
293
link_a.alpha-osf1:
294
	@ if ${DETECT_GNU_LD}; then \
295
		$(DO_GNU_SO); \
296
	else \
297
		SHLIB=lib$(LIBNAME).so; \
298
		SHLIB_SUFFIX=; \
299
		SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
300
		if [ -n "$$SHLIB_HIST" ]; then \
301
			SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
302
		else \
303
			SHLIB_HIST="$(LIBVERSION)"; \
304
		fi; \
305
		SHLIB_SOVER=; \
306
		ALLSYMSFLAGS='-all'; \
307
		NOALLSYMSFLAGS='-none'; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
308
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
309
		if [ -n "$$SHLIB_HIST" ]; then \
1.1.3 by Kurt Roeckx
Import upstream version 0.9.8b
310
			SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
311
		fi; \
312
	fi; \
313
	$(LINK_SO_A)
314
link_app.alpha-osf1:
315
	@if ${DETECT_GNU_LD}; then \
316
		$(DO_GNU_APP); \
317
	else \
318
		LDFLAGS="$(CFLAGS) -rpath $(LIBRPATH)"; \
319
	fi; \
320
	$(LINK_APP)
321
322
link_o.solaris:
323
	@ if ${DETECT_GNU_LD}; then \
324
		$(DO_GNU_SO); \
325
	else \
326
		$(CALC_VERSIONS); \
327
		MINUSZ='-z '; \
328
		($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
329
		SHLIB=lib$(LIBNAME).so; \
330
		SHLIB_SUFFIX=; \
331
		ALLSYMSFLAGS="$${MINUSZ}allextract"; \
332
		NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \
333
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-Bsymbolic"; \
334
	fi; \
335
	$(LINK_SO_O)
336
link_a.solaris:
337
	@ if ${DETECT_GNU_LD}; then \
338
		$(DO_GNU_SO); \
339
	else \
340
		$(CALC_VERSIONS); \
341
		MINUSZ='-z '; \
342
		(${CC} -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
343
		SHLIB=lib$(LIBNAME).so; \
344
		SHLIB_SUFFIX=;\
345
		ALLSYMSFLAGS="$${MINUSZ}allextract"; \
346
		NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \
347
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-Bsymbolic"; \
348
	fi; \
349
	$(LINK_SO_A)
350
link_app.solaris:
351
	@ if ${DETECT_GNU_LD}; then \
352
		$(DO_GNU_APP); \
353
	else \
354
		LDFLAGS="$(CFLAGS) -R $(LIBRPATH)"; \
355
	fi; \
356
	$(LINK_APP)
357
358
# OpenServer 5 native compilers used
359
link_o.svr3:
360
	@ if ${DETECT_GNU_LD}; then \
361
		$(DO_GNU_SO); \
362
	else \
363
		$(CALC_VERSIONS); \
364
		SHLIB=lib$(LIBNAME).so; \
365
		SHLIB_SUFFIX=; \
366
		ALLSYMSFLAGS=''; \
367
		NOALLSYMSFLAGS=''; \
368
		SHAREDFLAGS="$(CFLAGS) -G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
369
	fi; \
370
	$(LINK_SO_O)
371
link_a.svr3:
372
	@ if ${DETECT_GNU_LD}; then \
373
		$(DO_GNU_SO); \
374
	else \
375
		$(CALC_VERSIONS); \
376
		SHLIB=lib$(LIBNAME).so; \
377
		SHLIB_SUFFIX=; \
378
		ALLSYMSFLAGS=''; \
379
		NOALLSYMSFLAGS=''; \
380
		SHAREDFLAGS="$(CFLAGS) -G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
381
	fi; \
382
	$(LINK_SO_A_UNPACKED)
383
link_app.svr3:
384
	@${DETECT_GNU_LD} && $(DO_GNU_APP); \
385
	$(LINK_APP)
386
387
# UnixWare 7 and OpenUNIX 8 native compilers used
388
link_o.svr5:
389
	@ if ${DETECT_GNU_LD}; then \
390
		$(DO_GNU_SO); \
391
	else \
392
		$(CALC_VERSIONS); \
393
		SHARE_FLAG='-G'; \
394
		($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
395
		SHLIB=lib$(LIBNAME).so; \
396
		SHLIB_SUFFIX=; \
397
		ALLSYMSFLAGS=''; \
398
		NOALLSYMSFLAGS=''; \
399
		SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
400
	fi; \
401
	$(LINK_SO_O)
402
link_a.svr5:
403
	@ if ${DETECT_GNU_LD}; then \
404
		$(DO_GNU_SO); \
405
	else \
406
		$(CALC_VERSIONS); \
407
		SHARE_FLAG='-G'; \
408
		(${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
409
		SHLIB=lib$(LIBNAME).so; \
410
		SHLIB_SUFFIX=; \
411
		ALLSYMSFLAGS=''; \
412
		NOALLSYMSFLAGS=''; \
413
		SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
414
	fi; \
415
	$(LINK_SO_A_UNPACKED)
416
link_app.svr5:
417
	@${DETECT_GNU_LD} && $(DO_GNU_APP); \
418
	$(LINK_APP)
419
420
link_o.irix:
421
	@ if ${DETECT_GNU_LD}; then \
422
		$(DO_GNU_SO); \
423
	else \
424
		$(CALC_VERSIONS); \
425
		SHLIB=lib$(LIBNAME).so; \
426
		SHLIB_SUFFIX=; \
427
		MINUSWL=""; \
428
		($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
429
		ALLSYMSFLAGS="$${MINUSWL}-all"; \
430
		NOALLSYMSFLAGS="$${MINUSWL}-none"; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
431
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,-B,symbolic"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
432
	fi; \
433
	$(LINK_SO_O)
434
link_a.irix:
435
	@ if ${DETECT_GNU_LD}; then \
436
		$(DO_GNU_SO); \
437
	else \
438
		$(CALC_VERSIONS); \
439
		SHLIB=lib$(LIBNAME).so; \
440
		SHLIB_SUFFIX=; \
441
		MINUSWL=""; \
442
		($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
443
		ALLSYMSFLAGS="$${MINUSWL}-all"; \
444
		NOALLSYMSFLAGS="$${MINUSWL}-none"; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
445
		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,-B,symbolic"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
446
	fi; \
447
	$(LINK_SO_A)
448
link_app.irix:
449
	@LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"; \
450
	$(LINK_APP)
451
452
# 32-bit PA-RISC HP-UX embeds the -L pathname of libs we link with, so
453
# we compensate for it with +cdp ../: and +cdp ./:. Yes, these rewrite
454
# rules imply that we can only link one level down in catalog structure,
455
# but that's what takes place for the moment of this writing. +cdp option
456
# was introduced in HP-UX 11.x and applies in 32-bit PA-RISC link
457
# editor context only [it's simply ignored in other cases, which are all
458
# ELFs by the way].
459
#
460
link_o.hpux:
461
	@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
462
	$(CALC_VERSIONS); \
463
	SHLIB=lib$(LIBNAME).sl; \
1.1.4 by Kurt Roeckx
Import upstream version 0.9.8c
464
	expr "$(CFLAGS)" : '.*DSO_DLFCN' > /dev/null && SHLIB=lib$(LIBNAME).so; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
465
	SHLIB_SUFFIX=; \
466
	ALLSYMSFLAGS='-Wl,-Fl'; \
467
	NOALLSYMSFLAGS=''; \
468
	expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
469
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
470
	fi; \
471
	rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
472
	$(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
473
link_a.hpux:
474
	@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
475
	$(CALC_VERSIONS); \
476
	SHLIB=lib$(LIBNAME).sl; \
477
	expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
478
	SHLIB_SUFFIX=; \
479
	ALLSYMSFLAGS='-Wl,-Fl'; \
480
	NOALLSYMSFLAGS=''; \
481
	expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
482
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
483
	fi; \
484
	rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
485
	$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
486
link_app.hpux:
487
	@if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
488
	LDFLAGS="$(CFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
489
	fi; \
490
	$(LINK_APP)
491
492
link_o.aix:
493
	@ $(CALC_VERSIONS); \
1.1.7 by Kurt Roeckx
Import upstream version 0.9.8k
494
	OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || :; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
495
	OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
496
	SHLIB=lib$(LIBNAME).so; \
497
	SHLIB_SUFFIX=; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
498
	ALLSYMSFLAGS=''; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
499
	NOALLSYMSFLAGS=''; \
1.1.7 by Kurt Roeckx
Import upstream version 0.9.8k
500
	SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
501
	$(LINK_SO_O);
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
502
link_a.aix:
503
	@ $(CALC_VERSIONS); \
1.1.7 by Kurt Roeckx
Import upstream version 0.9.8k
504
	OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || : ; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
505
	OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
506
	SHLIB=lib$(LIBNAME).so; \
507
	SHLIB_SUFFIX=; \
508
	ALLSYMSFLAGS='-bnogc'; \
509
	NOALLSYMSFLAGS=''; \
1.1.7 by Kurt Roeckx
Import upstream version 0.9.8k
510
	SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
511
	$(LINK_SO_A_VIA_O)
512
link_app.aix:
1.1.6 by Matthias Klose
Import upstream version 0.9.8g
513
	LDFLAGS="$(CFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
514
	$(LINK_APP)
515
516
link_o.reliantunix:
517
	@ $(CALC_VERSIONS); \
518
	SHLIB=lib$(LIBNAME).so; \
519
	SHLIB_SUFFIX=; \
520
	ALLSYMSFLAGS=; \
521
	NOALLSYMSFLAGS=''; \
522
	SHAREDFLAGS='$(CFLAGS) -G'; \
523
	$(LINK_SO_O)
524
link_a.reliantunix:
525
	@ $(CALC_VERSIONS); \
526
	SHLIB=lib$(LIBNAME).so; \
527
	SHLIB_SUFFIX=; \
528
	ALLSYMSFLAGS=; \
529
	NOALLSYMSFLAGS=''; \
530
	SHAREDFLAGS='$(CFLAGS) -G'; \
531
	$(LINK_SO_A_UNPACKED)
532
link_app.reliantunix:
533
	$(LINK_APP)
534
535
# Targets to build symbolic links when needed
536
symlink.gnu symlink.solaris symlink.svr3 symlink.svr5 symlink.irix \
537
symlink.aix symlink.reliantunix:
538
	@ $(CALC_VERSIONS); \
539
	SHLIB=lib$(LIBNAME).so; \
540
	$(SYMLINK_SO)
541
symlink.darwin:
542
	@ $(CALC_VERSIONS); \
543
	SHLIB=lib$(LIBNAME); \
544
	SHLIB_SUFFIX=.dylib; \
545
	$(SYMLINK_SO)
546
symlink.hpux:
547
	@ $(CALC_VERSIONS); \
548
	SHLIB=lib$(LIBNAME).sl; \
549
	expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
550
	$(SYMLINK_SO)
551
# The following lines means those specific architectures do no symlinks
1.1.3 by Kurt Roeckx
Import upstream version 0.9.8b
552
symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
1.1.2 by Kurt Roeckx
Import upstream version 0.9.8a
553
554
# Compatibility targets
555
link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
556
link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared: link_a.gnu
557
link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
558
symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
559
link_o.bsd-shared: link_o.bsd
560
link_a.bsd-shared: link_a.bsd
561
link_app.bsd-shared: link_app.bsd
562
link_o.darwin-shared: link_o.darwin
563
link_a.darwin-shared: link_a.darwin
564
link_app.darwin-shared: link_app.darwin
565
symlink.darwin-shared: symlink.darwin
566
link_o.cygwin-shared: link_o.cygwin
567
link_a.cygwin-shared: link_a.cygwin
568
link_app.cygwin-shared: link_app.cygwin
569
symlink.cygwin-shared: symlink.cygwin
570
link_o.alpha-osf1-shared: link_o.alpha-osf1
571
link_a.alpha-osf1-shared: link_a.alpha-osf1
572
link_app.alpha-osf1-shared: link_app.alpha-osf1
573
symlink.alpha-osf1-shared: symlink.alpha-osf1
574
link_o.tru64-shared: link_o.tru64
575
link_a.tru64-shared: link_a.tru64
576
link_app.tru64-shared: link_app.tru64
577
symlink.tru64-shared: symlink.tru64
578
link_o.tru64-shared-rpath: link_o.tru64-rpath
579
link_a.tru64-shared-rpath: link_a.tru64-rpath
580
link_app.tru64-shared-rpath: link_app.tru64-rpath
581
symlink.tru64-shared-rpath: symlink.tru64-rpath
582
link_o.solaris-shared: link_o.solaris
583
link_a.solaris-shared: link_a.solaris
584
link_app.solaris-shared: link_app.solaris
585
symlink.solaris-shared: symlink.solaris
586
link_o.svr3-shared: link_o.svr3
587
link_a.svr3-shared: link_a.svr3
588
link_app.svr3-shared: link_app.svr3
589
symlink.svr3-shared: symlink.svr3
590
link_o.svr5-shared: link_o.svr5
591
link_a.svr5-shared: link_a.svr5
592
link_app.svr5-shared: link_app.svr5
593
symlink.svr5-shared: symlink.svr5
594
link_o.irix-shared: link_o.irix
595
link_a.irix-shared: link_a.irix
596
link_app.irix-shared: link_app.irix
597
symlink.irix-shared: symlink.irix
598
link_o.hpux-shared: link_o.hpux
599
link_a.hpux-shared: link_a.hpux
600
link_app.hpux-shared: link_app.hpux
601
symlink.hpux-shared: symlink.hpux
602
link_o.aix-shared: link_o.aix
603
link_a.aix-shared: link_a.aix
604
link_app.aix-shared: link_app.aix
605
symlink.aix-shared: symlink.aix
606
link_o.reliantunix-shared: link_o.reliantunix
607
link_a.reliantunix-shared: link_a.reliantunix
608
link_app.reliantunix-shared: link_app.reliantunix
609
symlink.reliantunix-shared: symlink.reliantunix