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