Synchronise with Makefiles.
[openssl.git] / Makefile.shared
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 # LDFLAGS contains flags to be used when the temporary object file is
11 # created.  SHARED_LDFLAGS contains flags to be used when the shared
12 # library is created.
13 LDFLAGS=
14 SHARED_LDFLAGS=
15
16 # LIBNAME contains just the name of thhe library, without prefix ("lib"
17 # on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
18 # .dll, ...).  This one MUST have a value when using this makefile.
19 # For example, to build libfoo.so, you need to do the following:
20 #LIBNAME=foo
21 LIBNAME=
22
23 # LIBEXTRAS contains extra modules to link together with the library.
24 # For example, if a second library, say libbar.a needs to be linked into
25 # libfoo.so, you need to do the following:
26 #LIBEXTRAS=libbar.a
27 # Note that this MUST be used when using the link_o targets, to hold the
28 # names of all object files that go into the target library.
29 LIBEXTRAS=
30
31 # LIBVERSION contains the current version of the library.
32 # For example, to build libfoo.so.1.2, you need to do the following:
33 #LIBVERSION=1.2
34 LIBVERSION=
35
36 # LIBCOMPATVERSIONS contains the compatibility versions (a list) of
37 # the library.  They MUST be in decreasing order.
38 # For example, if libfoo.so.1.2.1 is backward compatible with libfoo.so.1.2
39 # and libfoo.so.1, you need to do the following:
40 #LIBCOMPATVERSIONS=1.2 1
41 # Note that on systems that use sonames, the last number will appear as
42 # part of it.
43 # It's also possible, for systems that support it (Tru64, for example),
44 # to add extra compatibility info with more precision, by adding a second
45 # list of versions, separated from the first with a semicolon, like this:
46 #LIBCOMPATVERSIONS=1.2 1;1.2.0 1.1.2 1.1.1 1.1.0 1.0.0
47 LIBCOMPATVERSIONS=
48
49 # LIBDEPS contains all the flags necessary to cover all necessary
50 # dependencies to other libraries.
51 LIBDEPS=
52
53 #------------------------------------------------------------------------------
54 # The rest is private to this makefile.
55
56 #DEBUG=:
57 DEBUG=set -x
58
59 top:
60         echo "Trying to use this makefile interactively?  Don't."
61
62 CALC_VERSIONS=  \
63         SHLIB_COMPAT=; SHLIB_SOVER=; \
64         if [ -n "$(LIBVERSION)$(LIBCOMPATVERSIONS)" ]; then \
65                 prev=""; \
66                 for v in `echo "$(LIBVERSION) $(LIBCOMPATVERSIONS)" | cut -d';' -f1`; do \
67                         SHLIB_SOVER_NODOT=$$v \
68                         SHLIB_SOVER=.$$v; \
69                         if [ -n "$$prev" ]; then \
70                                 SHLIB_COMPAT="$$SHLIB_COMPAT .$$prev"; \
71                         fi; \
72                         prev=$$v; \
73                 done; \
74         fi
75
76 LINK_SO=        \
77   ( $(DEBUG); \
78     nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
79     $$SHAREDCMD $(SHARED_LDFLAGS) $$SHAREDFLAGS -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
80         $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS ) && \
81   $(SYMLINK_SO); ( $(DEBUG); rm -f lib$(LIBNAME).exp )
82 SYMLINK_SO=     \
83         if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
84                 prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
85                 if [ -n "$$SHLIB_COMPAT" ]; then \
86                         for x in $$SHLIB_COMPAT; do \
87                                 ( $(DEBUG); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \
88                                   ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \
89                                 prev=$$SHLIB$$x$$SHLIB_SUFFIX; \
90                         done; \
91                 fi; \
92                 if [ -n "$$SHLIB_SOVER" ]; then \
93                         ( $(DEBUG); rm -f $$SHLIB$$SHLIB_SUFFIX; \
94                           ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \
95                 fi; \
96         fi
97
98 LINK_SO_A=      SHOBJECTS="lib$(LIBNAME).a $(LIBEXTRAS)"; $(LINK_SO)
99 LINK_SO_O=      SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
100 LINK_SO_A_VIA_O=        \
101   SHOBJECTS=lib$(LIBNAME).o ALL=$$ALLSYMSFLAGS ALLSYMSFLAGS= NOALLSYMSFLAGS=; \
102   ( $(DEBUG); \
103     ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS) ); \
104   $(LINK_SO) && rm -f $(LIBNAME).o
105 LINK_SO_A_UNPACKED=     \
106   UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
107   (cd $$UNPACKDIR; ar x ../lib$(LIBNAME).a) && cp $(LIBEXTRAS) $$UNPACKDIR && \
108   SHOBJECTS=$$UNPACKDIR/*.o; \
109   $(LINK_SO) && rm -rf $$UNPACKDIR
110
111 DETECT_GNU_LD=(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
112
113 DO_GNU=$(CALC_VERSIONS); \
114         SHLIB=lib$(LIBNAME).so \
115         SHLIB_SUFFIX= \
116         LIBDEPS="$(LIBDEPS) -lc" \
117         ALLSYMSFLAGS='-Wl,--whole-archive' \
118         NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
119         SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX" \
120         SHAREDCMD='$(CC)'
121
122 link_o.gnu:
123         @ $(DO_GNU); $(LINK_SO_O)
124 link_a.gnu:
125         @ $(DO_GNU); $(LINK_SO_A)
126
127 # For Darwin AKA Mac OS/X (dyld)
128 link_o.darwin:
129         @ $(CALC_VERSIONS); \
130         SHLIB=lib$(LIBNAME) \
131         SHLIB_SUFFIX=.dylib \
132         LIBDEPS="$(LIBDEPS) -lc" \
133         ALLSYMSFLAGS='-all_load' \
134         NOALLSYMSFLAGS='' \
135         SHAREDFLAGS="-dynamiclib" \
136         SHAREDCMD='$(CC)'; \
137         if [ -n "$(LIBVERSION)" ]; then \
138                 SHAREDFLAGS="$SHAREDFLAGS -current_version $(LIBVERSION)"; \
139         fi; \
140         if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
141                 SHAREDFLAGS="$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
142         fi; \
143         $(LINK_SO_O)
144 link_a.darwin:
145         @ $(CALC_VERSIONS); \
146         SHLIB=lib$(LIBNAME) \
147         SHLIB_SUFFIX=.dylib \
148         LIBDEPS="$(LIBDEPS) -lc" \
149         ALLSYMSFLAGS='-all_load' \
150         NOALLSYMSFLAGS='' \
151         SHAREDFLAGS="-dynamiclib" \
152         SHAREDCMD='$(CC)'; \
153         if [ -n "$(LIBVERSION)" ]; then \
154                 SHAREDFLAGS="$SHAREDFLAGS -current_version $(LIBVERSION)"; \
155         fi; \
156         if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
157                 SHAREDFLAGS="$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
158         fi; \
159         $(LINK_SO_A)
160
161 link_o.cygwin:
162         @ $(CALC_VERSIONS); \
163         INHIBIT_SYMLINKS=yes; \
164         SHLIB=cyg$(LIBNAME) \
165         SHLIB_SUFFIX=.dll \
166         LIBDEPS="$(LIBDEPS) -lc" \
167         SHLIB_SOVER=-$(LIBVERSION) \
168         ALLSYMSFLAGS='-Wl,--whole-archive' \
169         NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
170         SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a" \
171         SHAREDCMD='${CC}'; \
172         $(LINK_SO_O)
173 link_a.cygwin:
174         @ $(CALC_VERSIONS); \
175         INHIBIT_SYMLINKS=yes; \
176         SHLIB=cyg$(LIBNAME) \
177         SHLIB_SUFFIX=.dll \
178         LIBDEPS="$(LIBDEPS) -lc" \
179         SHLIB_SOVER= \
180         ALLSYMSFLAGS='-Wl,--whole-archive' \
181         NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
182         SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a" \
183         SHAREDCMD='${CC}'; \
184         $(LINK_SO_A)
185
186 link_o.alpha-osf1:
187         @ if ${DETECT_GNU_LD}; then \
188                 $(DO_GNU); \
189         else \
190                 SHLIB=lib$(LIBNAME).so \
191                 SHLIB_SUFFIX= \
192                 LIBDEPS="$(LIBDEPS) -lc" \
193                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
194                 if [ -n "$$SHLIB_HIST" ]; then \
195                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
196                 else \
197                         SHLIB_HIST="$(LIBVERSION)"; \
198                 fi
199                 SHLIB_SOVER= \
200                 ALLSYMSFLAGS='-all' \
201                 NOALLSYMSFLAGS='-none' \
202                 SHAREDFLAGS="-shared" \
203                 SHAREDCMD='$(CC)'; \
204                 if [ -n "$$SHLIB_HIST" ]; then \
205                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
206                 fi; \
207         fi; \
208         $(LINK_SO_O)
209 link_a.alpha-osf1:
210         @ if ${DETECT_GNU_LD}; then \
211                 $(DO_GNU); \
212         else \
213                 SHLIB=lib$(LIBNAME).so \
214                 SHLIB_SUFFIX= \
215                 LIBDEPS="$(LIBDEPS) -lc" \
216                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
217                 if [ -n "$$SHLIB_HIST" ]; then \
218                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
219                 else \
220                         SHLIB_HIST="$(LIBVERSION)"; \
221                 fi
222                 SHLIB_SOVER= \
223                 ALLSYMSFLAGS='-all' \
224                 NOALLSYMSFLAGS='-none' \
225                 SHAREDFLAGS="-shared" \
226                 SHAREDCMD='$(CC)'; \
227                 if [ -n "$$SHLIB_HIST" ]; then \
228                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
229                 fi; \
230         fi; \
231         $(LINK_SO_A)
232
233 # The difference between alpha-osf1-shared and tru64-shared is the `-msym'
234 # option passed to the linker.
235 link_o.tru64:
236         @ if ${DETECT_GNU_LD}; then \
237                 $(DO_GNU); \
238         else \
239                 SHLIB=lib$(LIBNAME).so \
240                 SHLIB_SUFFIX= \
241                 LIBDEPS="$(LIBDEPS) -lc" \
242                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
243                 if [ -n "$$SHLIB_HIST" ]; then \
244                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
245                 else \
246                         SHLIB_HIST="$(LIBVERSION)"; \
247                 fi
248                 SHLIB_SOVER= \
249                 ALLSYMSFLAGS='-all' \
250                 NOALLSYMSFLAGS='-none' \
251                 SHAREDFLAGS="-shared -msym" \
252                 SHAREDCMD='$(CC)'; \
253                 if [ -n "$$SHLIB_HIST" ]; then \
254                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
255                 fi; \
256         fi; \
257         $(LINK_SO_O)
258 link_a.tru64:
259         @ if ${DETECT_GNU_LD}; then \
260                 $(DO_GNU); \
261         else \
262                 SHLIB=lib$(LIBNAME).so \
263                 SHLIB_SUFFIX= \
264                 LIBDEPS="$(LIBDEPS) -lc" \
265                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
266                 if [ -n "$$SHLIB_HIST" ]; then \
267                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
268                 else \
269                         SHLIB_HIST="$(LIBVERSION)"; \
270                 fi
271                 SHLIB_SOVER= \
272                 ALLSYMSFLAGS='-all' \
273                 NOALLSYMSFLAGS='-none' \
274                 SHAREDFLAGS="-shared -msym" \
275                 SHAREDCMD='$(CC)'; \
276                 if [ -n "$$SHLIB_HIST" ]; then \
277                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
278                 fi; \
279         fi; \
280         $(LINK_SO_A)
281
282 # The difference between tru64-shared and tru64-shared-rpath is the
283 # -rpath ${LIBRPATH} passed to the linker.
284 link_o.tru64-rpath:
285         @ if ${DETECT_GNU_LD}; then \
286                 $(DO_GNU); \
287         else \
288                 SHLIB=lib$(LIBNAME).so \
289                 SHLIB_SUFFIX= \
290                 LIBDEPS="$(LIBDEPS) -lc" \
291                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
292                 if [ -n "$$SHLIB_HIST" ]; then \
293                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
294                 else \
295                         SHLIB_HIST="$(LIBVERSION)"; \
296                 fi
297                 SHLIB_SOVER= \
298                 ALLSYMSFLAGS='-all' \
299                 NOALLSYMSFLAGS='-none' \
300                 SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)" \
301                 SHAREDCMD='$(CC)'; \
302                 if [ -n "$$SHLIB_HIST" ]; then \
303                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
304                 fi; \
305         fi; \
306         $(LINK_SO_O)
307 link_a.tru64-rpath:
308         @ if ${DETECT_GNU_LD}; then \
309                 $(DO_GNU); \
310         else \
311                 SHLIB=lib$(LIBNAME).so \
312                 SHLIB_SUFFIX= \
313                 LIBDEPS="$(LIBDEPS) -lc" \
314                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
315                 if [ -n "$$SHLIB_HIST" ]; then \
316                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
317                 else \
318                         SHLIB_HIST="$(LIBVERSION)"; \
319                 fi
320                 SHLIB_SOVER= \
321                 ALLSYMSFLAGS='-all' \
322                 NOALLSYMSFLAGS='-none' \
323                 SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)" \
324                 SHAREDCMD='$(CC)'; \
325                 if [ -n "$$SHLIB_HIST" ]; then \
326                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
327                 fi; \
328         fi; \
329         $(LINK_SO_A)
330
331 link_o.solaris:
332         @ if ${DETECT_GNU_LD}; then \
333                 $(DO_GNU); \
334         else \
335                 $(CALC_VERSIONS); \
336                 SHLIB=lib$(LIBNAME).so \
337                 SHLIB_SUFFIX= \
338                 LIBDEPS="$(LIBDEPS) -lc" \
339                 ALLSYMSFLAGS='-z allextract' \
340                 NOALLSYMSFLAGS='' \
341                 SHAREDFLAGS='-G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
342                 SHAREDCMD='$(CC)'; \
343         fi; \
344         $(LINK_SO_O)
345 link_a.solaris:
346         @ if ${DETECT_GNU_LD}; then \
347                 $(DO_GNU); \
348         else \
349                 $(CALC_VERSIONS); \
350                 SHLIB=lib$(LIBNAME).so \
351                 SHLIB_SUFFIX= \
352                 LIBDEPS="$(LIBDEPS) -lc" \
353                 ALLSYMSFLAGS='-z allextract' \
354                 NOALLSYMSFLAGS='' \
355                 SHAREDFLAGS='-G -dy -z text -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
356                 SHAREDCMD='$(CC)'; \
357         fi; \
358         $(LINK_SO_A)
359
360 # OpenServer 5 native compilers used
361 # UnixWare 7 and OpenUNIX 8 native compilers used
362 link_o.svr3:
363         @ if ${DETECT_GNU_LD}; then \
364                 $(DO_GNU); \
365         else \
366                 $(CALC_VERSIONS); \
367                 SHLIB=lib$(LIBNAME).so \
368                 SHLIB_SUFFIX= \
369                 LIBDEPS="$(LIBDEPS) -lc" \
370                 ALLSYMSFLAGS='-z allextract' \
371                 NOALLSYMSFLAGS='' \
372                 SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
373                 SHAREDCMD='$(CC)'; \
374         fi; \
375         $(LINK_SO_O)
376 link_a.svr3:
377         @ if ${DETECT_GNU_LD}; then \
378                 $(DO_GNU); \
379         else \
380                 $(CALC_VERSIONS); \
381                 SHLIB=lib$(LIBNAME).so \
382                 SHLIB_SUFFIX= \
383                 LIBDEPS="$(LIBDEPS) -lc" \
384                 ALLSYMSFLAGS='-z allextract' \
385                 NOALLSYMSFLAGS='' \
386                 SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
387                 SHAREDCMD='$(CC)'; \
388         fi; \
389         $(LINK_SO_A_UNPACKED)
390
391 link_o.irix:
392         @ if ${DETECT_GNU_LD}; then \
393                 $(DO_GNU); \
394         else \
395                 $(CALC_VERSIONS); \
396                 SHLIB=lib$(LIBNAME).so \
397                 SHLIB_SUFFIX= \
398                 LIBDEPS="$(LIBDEPS) -lc" \
399                 ALLSYMSFLAGS='-all' \
400                 NOALLSYMSFLAGS='' \
401                 SHAREDFLAGS='-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
402                 SHAREDCMD='$(CC)'; \
403         fi; \
404         $(LINK_SO_O)
405 link_a.irix:
406         @ if ${DETECT_GNU_LD}; then \
407                 $(DO_GNU); \
408         else \
409                 $(CALC_VERSIONS); \
410                 SHLIB=lib$(LIBNAME).so \
411                 SHLIB_SUFFIX= \
412                 LIBDEPS="$(LIBDEPS) -lc" \
413                 ALLSYMSFLAGS='-all' \
414                 NOALLSYMSFLAGS='' \
415                 SHAREDFLAGS='-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
416                 SHAREDCMD='$(CC)'; \
417         fi; \
418         $(LINK_SO_A)
419
420 # HP-UX includes the full pathname of libs we depend on, so we would get
421 # ./libcrypto (with ./ as path information) compiled into libssl, hence
422 # we omit the SHLIBDEPS. Applications must be linked with -lssl -lcrypto
423 # anyway.
424 # The object modules are loaded from lib$i.a using the undocumented -Fl
425 # option.
426 #
427 # WARNING: Until DSO is fixed to support a search path, we support SHLIB_PATH
428 #          by temporarily specifying "+s"!
429 #
430 link_o.hpux32:
431         @ $(CALC_VERSIONS); \
432         SHLIB=lib$(LIBNAME).sl \
433         SHLIB_SUFFIX= \
434         LIBDEPS="$(LIBDEPS) -lc" \
435         ALLSYMSFLAGS='-Fl' \
436         NOALLSYMSFLAGS='' \
437         SHAREDFLAGS='+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
438         SHAREDCMD='/usr/ccs/bin/ld'; \
439         $(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
440 link_a.hpux32:
441         @ $(CALC_VERSIONS); \
442         SHLIB=lib$(LIBNAME).sl \
443         SHLIB_SUFFIX= \
444         LIBDEPS="$(LIBDEPS) -lc" \
445         ALLSYMSFLAGS='-Fl' \
446         NOALLSYMSFLAGS='' \
447         SHAREDFLAGS='+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
448         SHAREDCMD='/usr/ccs/bin/ld'; \
449         $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
450
451 # HP-UX includes the full pathname of libs we depend on, so we would get
452 # ./libcrypto (with ./ as path information) compiled into libssl, hence
453 # we omit the SHLIBDEPS. Applications must be linked with -lssl -lcrypto
454 # anyway.
455 #
456 # HP-UX in 64bit mode has "+s" enabled by default; it will search for
457 # shared libraries along LD_LIBRARY_PATH _and_ SHLIB_PATH.
458 #
459 link_o.hpux64:
460         @ $(CALC_VERSIONS); \
461         SHLIB=lib$(LIBNAME).sl \
462         SHLIB_SUFFIX= \
463         LIBDEPS="$(LIBDEPS) -lc" \
464         ALLSYMSFLAGS='+forceload' \
465         NOALLSYMSFLAGS='' \
466         SHAREDFLAGS='-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
467         SHAREDCMD='/usr/ccs/bin/ld'; \
468         $(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
469 link_a.hpux64:
470         @ $(CALC_VERSIONS); \
471         SHLIB=lib$(LIBNAME).sl \
472         SHLIB_SUFFIX= \
473         LIBDEPS="$(LIBDEPS) -lc" \
474         ALLSYMSFLAGS='+forceload' \
475         NOALLSYMSFLAGS='' \
476         SHAREDFLAGS='-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
477         SHAREDCMD='/usr/ccs/bin/ld'; \
478         $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
479
480 link_o.aix:
481         @ $(CALC_VERSIONS); \
482         SHLIB=lib$(LIBNAME).so \
483         SHLIB_SUFFIX= \
484         LIBDEPS="$(LIBDEPS) -lc" \
485         ALLSYMSFLAGS='-bnogc' \
486         NOALLSYMSFLAGS='' \
487         SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE' \
488         SHAREDCMD='$(CC)'; \
489         $(LINK_SO_O)
490 link_a.aix:
491         @ $(CALC_VERSIONS); \
492         SHLIB=lib$(LIBNAME).so \
493         SHLIB_SUFFIX= \
494         LIBDEPS="$(LIBDEPS) -lc" \
495         ALLSYMSFLAGS='-bnogc' \
496         NOALLSYMSFLAGS='' \
497         SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE' \
498         SHAREDCMD='$(CC)'; \
499         $(LINK_SO_A_VIA_O)
500
501 link_o.reliantunix:
502         @ $(CALC_VERSIONS); \
503         SHLIB=lib$(LIBNAME).so \
504         SHLIB_SUFFIX= \
505         LIBDEPS="$(LIBDEPS) -lc" \
506         ALLSYMSFLAGS= \
507         NOALLSYMSFLAGS='' \
508         SHAREDFLAGS='-G' \
509         SHAREDCMD='$(CC)'; \
510         $(LINK_SO_O)
511 link_a.reliantunix:
512         @ $(CALC_VERSIONS); \
513         SHLIB=lib$(LIBNAME).so \
514         SHLIB_SUFFIX= \
515         LIBDEPS="$(LIBDEPS) -lc" \
516         ALLSYMSFLAGS= \
517         NOALLSYMSFLAGS='' \
518         SHAREDFLAGS='-G' \
519         SHAREDCMD='$(CC)'; \
520         $(LINK_SO_A_UNPACKED)
521
522 # Targets to build symbolic links when needed
523 symlink.gnu symlink.solaris symlink.svr3 symlink.irix \
524 symlink.aix symlink.reliantunix:
525         @ $(CALC_VERSIONS); \
526         SHLIB=lib$(LIBNAME).so; \
527         $(SYMLINK_SO)
528 symlink.darwin:
529         @ $(CALC_VERSIONS); \
530         SHLIB=lib$(LIBNAME) \
531         SHLIB_SUFFIX=.dylib; \
532         $(SYMLINK_SO)
533 symlink.hpux32 symlink.hpux64:
534         @ $(CALC_VERSIONS); \
535         SHLIB=lib$(LIBNAME).sl; \
536         $(SYMLINK_SO)
537 # The following lines means those specific architectures do no symlinks
538 symlink.cygwin symlib.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
539
540 # Compatibility targets
541 link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
542 link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared: link_a.gnu
543 symlink.bsd-gcc-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
544 link_o.darwin-shared: link_o.darwin
545 link_a.darwin-shared: link_a.darwin
546 symlink.darwin-shared: symlink.darwin
547 link_o.cygwin-shared: link_o.cygwin
548 link_a.cygwin-shared: link_a.cygwin
549 symlink.cygwin-shared: symlink.cygwin
550 link_o.alpha-osf1-shared: link_o.alpha-osf1
551 link_a.alpha-osf1-shared: link_a.alpha-osf1
552 symlink.alpha-osf1-shared: symlink.alpha-osf1
553 link_o.tru64-shared: link_o.tru64
554 link_a.tru64-shared: link_a.tru64
555 symlink.tru64-shared: symlink.tru64
556 link_o.tru64-shared-rpath: link_o.tru64-rpath
557 link_a.tru64-shared-rpath: link_a.tru64-rpath
558 symlink.tru64-shared-rpath: symlink.tru64-rpath
559 link_o.solaris-shared: link_o.solaris
560 link_a.solaris-shared: link_a.solaris
561 symlink.solaris-shared: symlink.solaris
562 link_o.svr3-shared: link_o.svr3
563 link_a.svr3-shared: link_a.svr3
564 symlink.svr3-shared: symlink.svr3
565 link_o.svr5-shared: link_o.svr3
566 link_a.svr5-shared: link_a.svr3
567 symlink.svr5-shared: symlink.svr3
568 link_o.irix-shared: link_o.irix
569 link_a.irix-shared: link_a.irix
570 symlink.irix-shared: symlink.irix
571 link_o.hpux-shared: link_o.hpux32
572 link_a.hpux-shared: link_a.hpux32
573 symlink.hpux-shared: symlink.hpux32
574 link_o.hpux64-shared: link_o.hpux64
575 link_a.hpux64-shared: link_a.hpux64
576 symlink.hpux64-shared: symlink.hpux64
577 link_o.aix-shared: link_o.aix
578 link_a.aix-shared: link_a.aix
579 symlink.aix-shared: symlink.aix
580 link_o.reliantunix-shared: link_o.reliantunix
581 link_a.reliantunix-shared: link_a.reliantunix
582 symlink.reliantunix-shared: symlink.reliantunix