It works on my laptop :-).
[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} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \
112         my_ld=`${CC} -print-prog-name=ld 2>&1` && \
113         [ -n "$$my_ld" ] && \
114         $$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
115 DO_GNU=$(CALC_VERSIONS); \
116         SHLIB=lib$(LIBNAME).so \
117         SHLIB_SUFFIX= \
118         LIBDEPS="$(LIBDEPS) -lc" \
119         ALLSYMSFLAGS='-Wl,--whole-archive' \
120         NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
121         SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX" \
122         SHAREDCMD='$(CC)'
123
124 link_o.gnu:
125         @ $(DO_GNU); $(LINK_SO_O)
126 link_a.gnu:
127         @ $(DO_GNU); $(LINK_SO_A)
128
129 # For Darwin AKA Mac OS/X (dyld)
130 link_o.darwin:
131         @ $(CALC_VERSIONS); \
132         SHLIB=lib$(LIBNAME) \
133         SHLIB_SUFFIX=.dylib \
134         LIBDEPS="$(LIBDEPS) -lc" \
135         ALLSYMSFLAGS='-all_load' \
136         NOALLSYMSFLAGS='' \
137         SHAREDFLAGS="-dynamiclib" \
138         SHAREDCMD='$(CC)'; \
139         if [ -n "$(LIBVERSION)" ]; then \
140                 SHAREDFLAGS="$SHAREDFLAGS -current_version $(LIBVERSION)"; \
141         fi; \
142         if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
143                 SHAREDFLAGS="$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
144         fi; \
145         $(LINK_SO_O)
146 link_a.darwin:
147         @ $(CALC_VERSIONS); \
148         SHLIB=lib$(LIBNAME) \
149         SHLIB_SUFFIX=.dylib \
150         LIBDEPS="$(LIBDEPS) -lc" \
151         ALLSYMSFLAGS='-all_load' \
152         NOALLSYMSFLAGS='' \
153         SHAREDFLAGS="-dynamiclib" \
154         SHAREDCMD='$(CC)'; \
155         if [ -n "$(LIBVERSION)" ]; then \
156                 SHAREDFLAGS="$SHAREDFLAGS -current_version $(LIBVERSION)"; \
157         fi; \
158         if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
159                 SHAREDFLAGS="$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
160         fi; \
161         $(LINK_SO_A)
162
163 link_o.cygwin:
164         @ $(CALC_VERSIONS); \
165         INHIBIT_SYMLINKS=yes; \
166         SHLIB=cyg$(LIBNAME) \
167         SHLIB_SUFFIX=.dll \
168         LIBDEPS="$(LIBDEPS) -lc" \
169         SHLIB_SOVER=-$(LIBVERSION) \
170         ALLSYMSFLAGS='-Wl,--whole-archive' \
171         NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
172         SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a" \
173         SHAREDCMD='${CC}'; \
174         $(LINK_SO_O)
175 link_a.cygwin:
176         @ $(CALC_VERSIONS); \
177         INHIBIT_SYMLINKS=yes; \
178         SHLIB=cyg$(LIBNAME) \
179         SHLIB_SUFFIX=.dll \
180         LIBDEPS="$(LIBDEPS) -lc" \
181         SHLIB_SOVER= \
182         ALLSYMSFLAGS='-Wl,--whole-archive' \
183         NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
184         SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a" \
185         SHAREDCMD='${CC}'; \
186         $(LINK_SO_A)
187
188 link_o.alpha-osf1:
189         @ if ${DETECT_GNU_LD}; then \
190                 $(DO_GNU); \
191         else \
192                 SHLIB=lib$(LIBNAME).so \
193                 SHLIB_SUFFIX= \
194                 LIBDEPS="$(LIBDEPS) -lc" \
195                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
196                 if [ -n "$$SHLIB_HIST" ]; then \
197                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
198                 else \
199                         SHLIB_HIST="$(LIBVERSION)"; \
200                 fi
201                 SHLIB_SOVER= \
202                 ALLSYMSFLAGS='-all' \
203                 NOALLSYMSFLAGS='-none' \
204                 SHAREDFLAGS="-shared" \
205                 SHAREDCMD='$(CC)'; \
206                 if [ -n "$$SHLIB_HIST" ]; then \
207                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
208                 fi; \
209         fi; \
210         $(LINK_SO_O)
211 link_a.alpha-osf1:
212         @ if ${DETECT_GNU_LD}; then \
213                 $(DO_GNU); \
214         else \
215                 SHLIB=lib$(LIBNAME).so \
216                 SHLIB_SUFFIX= \
217                 LIBDEPS="$(LIBDEPS) -lc" \
218                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
219                 if [ -n "$$SHLIB_HIST" ]; then \
220                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
221                 else \
222                         SHLIB_HIST="$(LIBVERSION)"; \
223                 fi
224                 SHLIB_SOVER= \
225                 ALLSYMSFLAGS='-all' \
226                 NOALLSYMSFLAGS='-none' \
227                 SHAREDFLAGS="-shared" \
228                 SHAREDCMD='$(CC)'; \
229                 if [ -n "$$SHLIB_HIST" ]; then \
230                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
231                 fi; \
232         fi; \
233         $(LINK_SO_A)
234
235 # The difference between alpha-osf1-shared and tru64-shared is the `-msym'
236 # option passed to the linker.
237 link_o.tru64:
238         @ if ${DETECT_GNU_LD}; then \
239                 $(DO_GNU); \
240         else \
241                 SHLIB=lib$(LIBNAME).so \
242                 SHLIB_SUFFIX= \
243                 LIBDEPS="$(LIBDEPS) -lc" \
244                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
245                 if [ -n "$$SHLIB_HIST" ]; then \
246                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
247                 else \
248                         SHLIB_HIST="$(LIBVERSION)"; \
249                 fi
250                 SHLIB_SOVER= \
251                 ALLSYMSFLAGS='-all' \
252                 NOALLSYMSFLAGS='-none' \
253                 SHAREDFLAGS="-shared -msym" \
254                 SHAREDCMD='$(CC)'; \
255                 if [ -n "$$SHLIB_HIST" ]; then \
256                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
257                 fi; \
258         fi; \
259         $(LINK_SO_O)
260 link_a.tru64:
261         @ if ${DETECT_GNU_LD}; then \
262                 $(DO_GNU); \
263         else \
264                 SHLIB=lib$(LIBNAME).so \
265                 SHLIB_SUFFIX= \
266                 LIBDEPS="$(LIBDEPS) -lc" \
267                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
268                 if [ -n "$$SHLIB_HIST" ]; then \
269                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
270                 else \
271                         SHLIB_HIST="$(LIBVERSION)"; \
272                 fi
273                 SHLIB_SOVER= \
274                 ALLSYMSFLAGS='-all' \
275                 NOALLSYMSFLAGS='-none' \
276                 SHAREDFLAGS="-shared -msym" \
277                 SHAREDCMD='$(CC)'; \
278                 if [ -n "$$SHLIB_HIST" ]; then \
279                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
280                 fi; \
281         fi; \
282         $(LINK_SO_A)
283
284 # The difference between tru64-shared and tru64-shared-rpath is the
285 # -rpath ${LIBRPATH} passed to the linker.
286 link_o.tru64-rpath:
287         @ if ${DETECT_GNU_LD}; then \
288                 $(DO_GNU); \
289         else \
290                 SHLIB=lib$(LIBNAME).so \
291                 SHLIB_SUFFIX= \
292                 LIBDEPS="$(LIBDEPS) -lc" \
293                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
294                 if [ -n "$$SHLIB_HIST" ]; then \
295                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
296                 else \
297                         SHLIB_HIST="$(LIBVERSION)"; \
298                 fi
299                 SHLIB_SOVER= \
300                 ALLSYMSFLAGS='-all' \
301                 NOALLSYMSFLAGS='-none' \
302                 SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)" \
303                 SHAREDCMD='$(CC)'; \
304                 if [ -n "$$SHLIB_HIST" ]; then \
305                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
306                 fi; \
307         fi; \
308         $(LINK_SO_O)
309 link_a.tru64-rpath:
310         @ if ${DETECT_GNU_LD}; then \
311                 $(DO_GNU); \
312         else \
313                 SHLIB=lib$(LIBNAME).so \
314                 SHLIB_SUFFIX= \
315                 LIBDEPS="$(LIBDEPS) -lc" \
316                 SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
317                 if [ -n "$$SHLIB_HIST" ]; then \
318                         SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
319                 else \
320                         SHLIB_HIST="$(LIBVERSION)"; \
321                 fi
322                 SHLIB_SOVER= \
323                 ALLSYMSFLAGS='-all' \
324                 NOALLSYMSFLAGS='-none' \
325                 SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)" \
326                 SHAREDCMD='$(CC)'; \
327                 if [ -n "$$SHLIB_HIST" ]; then \
328                         SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
329                 fi; \
330         fi; \
331         $(LINK_SO_A)
332
333 link_o.solaris:
334         @ if ${DETECT_GNU_LD}; then \
335                 $(DO_GNU); \
336         else \
337                 $(CALC_VERSIONS); \
338                 SHLIB=lib$(LIBNAME).so \
339                 SHLIB_SUFFIX= \
340                 LIBDEPS="$(LIBDEPS) -lc" \
341                 ALLSYMSFLAGS='-z allextract' \
342                 NOALLSYMSFLAGS='' \
343                 SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
344                 SHAREDCMD='$(CC)'; \
345         fi; \
346         $(LINK_SO_O)
347 link_a.solaris:
348         @ if ${DETECT_GNU_LD}; then \
349                 $(DO_GNU); \
350         else \
351                 $(CALC_VERSIONS); \
352                 SHLIB=lib$(LIBNAME).so \
353                 SHLIB_SUFFIX= \
354                 LIBDEPS="$(LIBDEPS) -lc" \
355                 ALLSYMSFLAGS='-z allextract' \
356                 NOALLSYMSFLAGS='' \
357                 SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
358                 SHAREDCMD='$(CC)'; \
359         fi; \
360         $(LINK_SO_A)
361
362 # OpenServer 5 native compilers used
363 # UnixWare 7 and OpenUNIX 8 native compilers used
364 link_o.svr3:
365         @ if ${DETECT_GNU_LD}; then \
366                 $(DO_GNU); \
367         else \
368                 $(CALC_VERSIONS); \
369                 SHLIB=lib$(LIBNAME).so \
370                 SHLIB_SUFFIX= \
371                 LIBDEPS="$(LIBDEPS) -lc" \
372                 ALLSYMSFLAGS='-z allextract' \
373                 NOALLSYMSFLAGS='' \
374                 SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
375                 SHAREDCMD='$(CC)'; \
376         fi; \
377         $(LINK_SO_O)
378 link_a.svr3:
379         @ if ${DETECT_GNU_LD}; then \
380                 $(DO_GNU); \
381         else \
382                 $(CALC_VERSIONS); \
383                 SHLIB=lib$(LIBNAME).so \
384                 SHLIB_SUFFIX= \
385                 LIBDEPS="$(LIBDEPS) -lc" \
386                 ALLSYMSFLAGS='-z allextract' \
387                 NOALLSYMSFLAGS='' \
388                 SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
389                 SHAREDCMD='$(CC)'; \
390         fi; \
391         $(LINK_SO_A_UNPACKED)
392
393 link_o.irix:
394         @ if ${DETECT_GNU_LD}; then \
395                 $(DO_GNU); \
396         else \
397                 $(CALC_VERSIONS); \
398                 SHLIB=lib$(LIBNAME).so \
399                 SHLIB_SUFFIX= \
400                 LIBDEPS="$(LIBDEPS) -lc" \
401                 ALLSYMSFLAGS='-all' \
402                 NOALLSYMSFLAGS='' \
403                 SHAREDFLAGS='-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
404                 SHAREDCMD='$(CC)'; \
405         fi; \
406         $(LINK_SO_O)
407 link_a.irix:
408         @ if ${DETECT_GNU_LD}; then \
409                 $(DO_GNU); \
410         else \
411                 $(CALC_VERSIONS); \
412                 SHLIB=lib$(LIBNAME).so \
413                 SHLIB_SUFFIX= \
414                 LIBDEPS="$(LIBDEPS) -lc" \
415                 ALLSYMSFLAGS='-all' \
416                 NOALLSYMSFLAGS='' \
417                 SHAREDFLAGS='-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
418                 SHAREDCMD='$(CC)'; \
419         fi; \
420         $(LINK_SO_A)
421
422 # HP-UX includes the full pathname of libs we depend on, so we would get
423 # ./libcrypto (with ./ as path information) compiled into libssl, hence
424 # we omit the SHLIBDEPS. Applications must be linked with -lssl -lcrypto
425 # anyway.
426 # The object modules are loaded from lib$i.a using the undocumented -Fl
427 # option.
428 #
429 # WARNING: Until DSO is fixed to support a search path, we support SHLIB_PATH
430 #          by temporarily specifying "+s"!
431 #
432 link_o.hpux32:
433         @ $(CALC_VERSIONS); \
434         SHLIB=lib$(LIBNAME).sl \
435         SHLIB_SUFFIX= \
436         LIBDEPS="$(LIBDEPS) -lc" \
437         ALLSYMSFLAGS='-Fl' \
438         NOALLSYMSFLAGS='' \
439         SHAREDFLAGS='+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
440         SHAREDCMD='/usr/ccs/bin/ld'; \
441         $(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
442 link_a.hpux32:
443         @ $(CALC_VERSIONS); \
444         SHLIB=lib$(LIBNAME).sl \
445         SHLIB_SUFFIX= \
446         LIBDEPS="$(LIBDEPS) -lc" \
447         ALLSYMSFLAGS='-Fl' \
448         NOALLSYMSFLAGS='' \
449         SHAREDFLAGS='+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
450         SHAREDCMD='/usr/ccs/bin/ld'; \
451         $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
452
453 # HP-UX includes the full pathname of libs we depend on, so we would get
454 # ./libcrypto (with ./ as path information) compiled into libssl, hence
455 # we omit the SHLIBDEPS. Applications must be linked with -lssl -lcrypto
456 # anyway.
457 #
458 # HP-UX in 64bit mode has "+s" enabled by default; it will search for
459 # shared libraries along LD_LIBRARY_PATH _and_ SHLIB_PATH.
460 #
461 link_o.hpux64:
462         @ $(CALC_VERSIONS); \
463         SHLIB=lib$(LIBNAME).sl \
464         SHLIB_SUFFIX= \
465         LIBDEPS="$(LIBDEPS) -lc" \
466         ALLSYMSFLAGS='+forceload' \
467         NOALLSYMSFLAGS='' \
468         SHAREDFLAGS='-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
469         SHAREDCMD='/usr/ccs/bin/ld'; \
470         $(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
471 link_a.hpux64:
472         @ $(CALC_VERSIONS); \
473         SHLIB=lib$(LIBNAME).sl \
474         SHLIB_SUFFIX= \
475         LIBDEPS="$(LIBDEPS) -lc" \
476         ALLSYMSFLAGS='+forceload' \
477         NOALLSYMSFLAGS='' \
478         SHAREDFLAGS='-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
479         SHAREDCMD='/usr/ccs/bin/ld'; \
480         $(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
481
482 link_o.aix:
483         @ $(CALC_VERSIONS); \
484         SHLIB=lib$(LIBNAME).so \
485         SHLIB_SUFFIX= \
486         LIBDEPS="$(LIBDEPS) -lc" \
487         ALLSYMSFLAGS='-bnogc' \
488         NOALLSYMSFLAGS='' \
489         SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE' \
490         SHAREDCMD='$(CC)'; \
491         $(LINK_SO_O)
492 link_a.aix:
493         @ $(CALC_VERSIONS); \
494         SHLIB=lib$(LIBNAME).so \
495         SHLIB_SUFFIX= \
496         LIBDEPS="$(LIBDEPS) -lc" \
497         ALLSYMSFLAGS='-bnogc' \
498         NOALLSYMSFLAGS='' \
499         SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE' \
500         SHAREDCMD='$(CC)'; \
501         $(LINK_SO_A_VIA_O)
502
503 link_o.reliantunix:
504         @ $(CALC_VERSIONS); \
505         SHLIB=lib$(LIBNAME).so \
506         SHLIB_SUFFIX= \
507         LIBDEPS="$(LIBDEPS) -lc" \
508         ALLSYMSFLAGS= \
509         NOALLSYMSFLAGS='' \
510         SHAREDFLAGS='-G' \
511         SHAREDCMD='$(CC)'; \
512         $(LINK_SO_O)
513 link_a.reliantunix:
514         @ $(CALC_VERSIONS); \
515         SHLIB=lib$(LIBNAME).so \
516         SHLIB_SUFFIX= \
517         LIBDEPS="$(LIBDEPS) -lc" \
518         ALLSYMSFLAGS= \
519         NOALLSYMSFLAGS='' \
520         SHAREDFLAGS='-G' \
521         SHAREDCMD='$(CC)'; \
522         $(LINK_SO_A_UNPACKED)
523
524 # Targets to build symbolic links when needed
525 symlink.gnu symlink.solaris symlink.svr3 symlink.irix \
526 symlink.aix symlink.reliantunix:
527         @ $(CALC_VERSIONS); \
528         SHLIB=lib$(LIBNAME).so; \
529         $(SYMLINK_SO)
530 symlink.darwin:
531         @ $(CALC_VERSIONS); \
532         SHLIB=lib$(LIBNAME) \
533         SHLIB_SUFFIX=.dylib; \
534         $(SYMLINK_SO)
535 symlink.hpux32 symlink.hpux64:
536         @ $(CALC_VERSIONS); \
537         SHLIB=lib$(LIBNAME).sl; \
538         $(SYMLINK_SO)
539 # The following lines means those specific architectures do no symlinks
540 symlink.cygwin symlib.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
541
542 # Compatibility targets
543 link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
544 link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared: link_a.gnu
545 symlink.bsd-gcc-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
546 link_o.darwin-shared: link_o.darwin
547 link_a.darwin-shared: link_a.darwin
548 symlink.darwin-shared: symlink.darwin
549 link_o.cygwin-shared: link_o.cygwin
550 link_a.cygwin-shared: link_a.cygwin
551 symlink.cygwin-shared: symlink.cygwin
552 link_o.alpha-osf1-shared: link_o.alpha-osf1
553 link_a.alpha-osf1-shared: link_a.alpha-osf1
554 symlink.alpha-osf1-shared: symlink.alpha-osf1
555 link_o.tru64-shared: link_o.tru64
556 link_a.tru64-shared: link_a.tru64
557 symlink.tru64-shared: symlink.tru64
558 link_o.tru64-shared-rpath: link_o.tru64-rpath
559 link_a.tru64-shared-rpath: link_a.tru64-rpath
560 symlink.tru64-shared-rpath: symlink.tru64-rpath
561 link_o.solaris-shared: link_o.solaris
562 link_a.solaris-shared: link_a.solaris
563 symlink.solaris-shared: symlink.solaris
564 link_o.svr3-shared: link_o.svr3
565 link_a.svr3-shared: link_a.svr3
566 symlink.svr3-shared: symlink.svr3
567 link_o.svr5-shared: link_o.svr3
568 link_a.svr5-shared: link_a.svr3
569 symlink.svr5-shared: symlink.svr3
570 link_o.irix-shared: link_o.irix
571 link_a.irix-shared: link_a.irix
572 symlink.irix-shared: symlink.irix
573 link_o.hpux-shared: link_o.hpux32
574 link_a.hpux-shared: link_a.hpux32
575 symlink.hpux-shared: symlink.hpux32
576 link_o.hpux64-shared: link_o.hpux64
577 link_a.hpux64-shared: link_a.hpux64
578 symlink.hpux64-shared: symlink.hpux64
579 link_o.aix-shared: link_o.aix
580 link_a.aix-shared: link_a.aix
581 symlink.aix-shared: symlink.aix
582 link_o.reliantunix-shared: link_o.reliantunix
583 link_a.reliantunix-shared: link_a.reliantunix
584 symlink.reliantunix-shared: symlink.reliantunix