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