Makefile.shared 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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. # CC contains the current compiler. This one MUST be defined
  8. CC=cc
  9. CFLAGS=$(CFLAG)
  10. # LDFLAGS contains flags to be used when temporary object files (when building
  11. # shared libraries) are created, or when an application is linked.
  12. # SHARED_LDFLAGS contains flags to be used when the shared library is created.
  13. LDFLAGS=$(LDFLAG)
  14. SHARED_LDFLAGS=$(SHARED_LDFLAG)
  15. RC=windres
  16. # SHARED_RCFLAGS are flags used with windres, i.e. when build for Cygwin
  17. # or Mingw.
  18. SHARED_RCFLAGS=$(SHARED_RCFLAG)
  19. NM=nm
  20. ECHO=echo
  21. # LIBNAME contains just the name of the library, without prefix ("lib"
  22. # on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
  23. # .dll, ...). This one MUST have a value when using this makefile to
  24. # build shared libraries.
  25. # For example, to build libfoo.so, you need to do the following:
  26. #LIBNAME=foo
  27. LIBNAME=
  28. # STLIBNAME contains the path of the static library to build the shared
  29. # library from, for example:
  30. #STLIBNAME=libfoo.a
  31. STLIBNAME=
  32. # On most Unix platforms, SHLIBNAME contains the path of the short name of
  33. # the shared library to build, for example
  34. #SHLIBNAME=libfoo.so
  35. # On Windows POSIX layers (cygwin and mingw), SHLIBNAME contains the import
  36. # library name for the shared library to be built, for example:
  37. #SHLIBNAME=libfoo.dll.a
  38. # SHLIBNAME_FULL contains the path of the full name of the shared library to
  39. # build, for example:
  40. #SHLIBNAME_FULL=libfoo.so.1.2
  41. # When building DSOs, SHLIBNAME_FULL contains path of the full DSO name, for
  42. # example:
  43. #SHLIBNAME_FULL=dir/dso.so
  44. SHLIBNAME_FULL=
  45. # SHLIBVERSION contains the current version of the shared library (not to
  46. # be confused with the project version)
  47. #SHLIBVERSION=1.2
  48. SHLIBVERSION=
  49. # NOTE: to build shared libraries, LIBNAME, STLIBNAME, SHLIBNAME and
  50. # SHLIBNAME_FULL MUST have values when using this makefile, and in some
  51. # cases, SHLIBVERSION as well. To build DSOs, SHLIBNAME_FULL MUST have
  52. # a value, the rest can be left alone.
  53. # APPNAME contains just the name of the application, without suffix (""
  54. # on Unix, ".exe" on Windows, ...). This one MUST have a value when using
  55. # this makefile to build applications.
  56. # For example, to build foo, you need to do the following:
  57. #APPNAME=foo
  58. APPNAME=
  59. # SRCDIR is the top directory of the source tree.
  60. SRCDIR=.
  61. # OBJECTS contains all the object files to link together into the application.
  62. # This must contain at least one object file.
  63. #OBJECTS=foo.o
  64. OBJECTS=
  65. # LIBEXTRAS contains extra modules to link together with the library.
  66. # For example, if a second library, say libbar.a needs to be linked into
  67. # libfoo.so, you need to do the following:
  68. #LIBEXTRAS=libbar.a
  69. # Note that this MUST be used when using the link_dso targets, to hold the
  70. # names of all object files that go into the target shared object.
  71. LIBEXTRAS=
  72. # LIBDEPS contains all the flags necessary to cover all necessary
  73. # dependencies to other libraries.
  74. LIBDEPS=
  75. #------------------------------------------------------------------------------
  76. # The rest is private to this makefile.
  77. SET_X=:
  78. #SET_X=set -x
  79. top:
  80. echo "Trying to use this makefile interactively? Don't." ; exit 1
  81. LINK_APP= \
  82. ( $(SET_X); \
  83. LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
  84. LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS) $(LDFLAGS)}"; \
  85. LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
  86. LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
  87. $(ECHO) LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
  88. $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS}; \
  89. LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
  90. $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
  91. LINK_SO= \
  92. ( $(SET_X); \
  93. LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
  94. SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
  95. SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
  96. LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
  97. LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
  98. $(ECHO) LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
  99. $${SHAREDCMD} $${SHAREDFLAGS} \
  100. -o $(SHLIBNAME_FULL) \
  101. $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \
  102. LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
  103. $${SHAREDCMD} $${SHAREDFLAGS} \
  104. -o $(SHLIBNAME_FULL) \
  105. $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
  106. ) && $(SYMLINK_SO)
  107. SYMLINK_SO= \
  108. if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
  109. if [ -n "$(SHLIBNAME_FULL)" -a -n "$(SHLIBNAME)" -a \
  110. "$(SHLIBNAME_FULL)" != "$(SHLIBNAME)" ]; then \
  111. ( $(SET_X); \
  112. rm -f $(SHLIBNAME); \
  113. ln -s $(SHLIBNAME_FULL) $(SHLIBNAME) ); \
  114. fi; \
  115. fi
  116. LINK_SO_SHLIB= SHOBJECTS="$(STLIBNAME) $(LIBEXTRAS)"; $(LINK_SO)
  117. LINK_SO_DSO= INHIBIT_SYMLINKS=yes; SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
  118. LINK_SO_SHLIB_VIA_O= \
  119. SHOBJECTS=$(STLIBNAME).o; \
  120. ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
  121. ( $(ECHO) ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(STLIBNAME) $(LIBEXTRAS); \
  122. ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(STLIBNAME) $(LIBEXTRAS) ); \
  123. $(LINK_SO) && ( $(ECHO) rm -f $$SHOBJECTS; rm -f $$SHOBJECTS )
  124. LINK_SO_SHLIB_UNPACKED= \
  125. UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
  126. (cd $$UNPACKDIR; ar x ../$(STLIBNAME)) && \
  127. ([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \
  128. SHOBJECTS=$$UNPACKDIR/*.o; \
  129. $(LINK_SO) && rm -rf $$UNPACKDIR
  130. DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
  131. DO_GNU_SO_COMMON=\
  132. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$(SHLIBNAME_FULL)"
  133. DO_GNU_DSO=\
  134. $(DO_GNU_SO_COMMON)
  135. DO_GNU_SO=\
  136. ALLSYMSFLAGS='-Wl,--whole-archive'; \
  137. NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
  138. $(DO_GNU_SO_COMMON)
  139. DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS)"
  140. #This is rather special. It's a special target with which one can link
  141. #applications without bothering with any features that have anything to
  142. #do with shared libraries, for example when linking against static
  143. #libraries. It's mostly here to avoid a lot of conditionals everywhere
  144. #else...
  145. link_app.:
  146. $(LINK_APP)
  147. link_dso.gnu:
  148. @ $(DO_GNU_DSO); $(LINK_SO_DSO)
  149. link_shlib.gnu:
  150. @ $(DO_GNU_SO); $(LINK_SO_SHLIB)
  151. link_app.gnu:
  152. @ $(DO_GNU_APP); $(LINK_APP)
  153. link_shlib.linux-shared:
  154. @$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
  155. $(DO_GNU_SO); \
  156. ALLSYMSFLAGS='-Wl,--whole-archive,--version-script=$(LIBNAME).map'; \
  157. $(LINK_SO_SHLIB)
  158. link_dso.bsd:
  159. @if $(DETECT_GNU_LD); then $(DO_GNU_DSO); else \
  160. LIBDEPS=" "; \
  161. ALLSYMSFLAGS=; \
  162. NOALLSYMSFLAGS=; \
  163. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
  164. fi; $(LINK_SO_DSO)
  165. link_shlib.bsd:
  166. @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
  167. LIBDEPS=" "; \
  168. ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
  169. NOALLSYMSFLAGS=; \
  170. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
  171. fi; $(LINK_SO_SHLIB)
  172. link_app.bsd:
  173. @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
  174. LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
  175. fi; $(LINK_APP)
  176. # For Darwin AKA Mac OS/X (dyld)
  177. # Originally link_dso.darwin produced .so, because it was hard-coded
  178. # in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
  179. # extension in order to allow for run-time linking with vendor-
  180. # supplied shared libraries such as libz, so that link_dso.darwin had
  181. # to be harmonized with it. This caused minor controversy, because
  182. # it was believed that dlopen can't be used to dynamically load
  183. # .dylib-s, only so called bundle modules (ones linked with -bundle
  184. # flag). The belief seems to be originating from pre-10.4 release,
  185. # where dlfcn functionality was emulated by dlcompat add-on. In
  186. # 10.4 dlopen was rewritten as native part of dyld and is documented
  187. # to be capable of loading both dynamic libraries and bundles. In
  188. # order to provide compatibility with pre-10.4 dlopen, modules are
  189. # linked with -bundle flag, which makes .dylib extension misleading.
  190. # It works, because dlopen is [and always was] extension-agnostic.
  191. # Alternative to this heuristic approach is to develop specific
  192. # MacOS X dso module relying on whichever "native" dyld interface.
  193. link_dso.darwin:
  194. @ ALLSYMSFLAGS=''; \
  195. NOALLSYMSFLAGS=''; \
  196. SHAREDFLAGS="$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundle/`"; \
  197. $(LINK_SO_DSO)
  198. link_shlib.darwin:
  199. @ ALLSYMSFLAGS='-all_load'; \
  200. NOALLSYMSFLAGS=''; \
  201. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -current_version $(SHLIBVERSION) -compatibility_version $(SHLIBVERSION) -install_name $(INSTALLTOP)/$(LIBDIR)/$(SHLIBNAME_FULL)"; \
  202. $(LINK_SO_SHLIB)
  203. link_app.darwin: # is there run-path on darwin?
  204. $(LINK_APP)
  205. link_dso.cygwin:
  206. @ALLSYMSFLAGS=''; \
  207. NOALLSYMSFLAGS=''; \
  208. base=-Wl,--enable-auto-image-base; \
  209. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic"; \
  210. $(LINK_SO_DSO)
  211. link_shlib.cygwin:
  212. @ INHIBIT_SYMLINKS=yes; \
  213. $(ECHO) "$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) |" \
  214. "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
  215. $(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) | \
  216. $(RC) $(SHARED_RCFLAGS) -o rc.o; \
  217. ALLSYMSFLAGS='-Wl,--whole-archive'; \
  218. NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
  219. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,--enable-auto-image-base -Wl,-Bsymbolic -Wl,--out-implib,$(SHLIBNAME) rc.o"; \
  220. $(LINK_SO_SHLIB) || exit 1; \
  221. rm rc.o
  222. link_app.cygwin:
  223. $(LINK_APP)
  224. # link_dso.mingw-shared and link_app.mingw-shared are mapped to the
  225. # corresponding cygwin targets, as they do the exact same thing.
  226. link_shlib.mingw:
  227. @ INHIBIT_SYMLINKS=yes; \
  228. $(PERL) $(SRCDIR)/util/mkdef.pl 32 $(LIBNAME) \
  229. | sed -e 's|^\(LIBRARY *\)$(LIBNAME)32|\1$(SHLIBNAME_FULL)|' \
  230. > $(LIBNAME).def; \
  231. echo "$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) |" \
  232. "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
  233. $(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) | \
  234. $(RC) $(SHARED_RCFLAGS) -o rc.o; \
  235. ALLSYMSFLAGS='-Wl,--whole-archive'; \
  236. NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
  237. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,--out-implib,$(SHLIBNAME) $(LIBNAME).def rc.o"; \
  238. $(LINK_SO_SHLIB) || exit 1; \
  239. rm $(LIBNAME).def rc.o
  240. link_dso.alpha-osf1:
  241. @ if $(DETECT_GNU_LD); then \
  242. $(DO_GNU_DSO); \
  243. else \
  244. ALLSYMSFLAGS=''; \
  245. NOALLSYMSFLAGS=''; \
  246. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
  247. fi; \
  248. $(LINK_SO_DSO)
  249. link_shlib.alpha-osf1:
  250. @ if $(DETECT_GNU_LD); then \
  251. $(DO_GNU_SO); \
  252. else \
  253. ALLSYMSFLAGS='-all'; \
  254. NOALLSYMSFLAGS='-none'; \
  255. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic -set_version $(SHLIBVERSION)"; \
  256. fi; \
  257. $(LINK_SO_SHLIB)
  258. link_app.alpha-osf1:
  259. @if $(DETECT_GNU_LD); then \
  260. $(DO_GNU_APP); \
  261. else \
  262. LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
  263. fi; \
  264. $(LINK_APP)
  265. link_dso.solaris:
  266. @ if $(DETECT_GNU_LD); then \
  267. $(DO_GNU_DSO); \
  268. else \
  269. ALLSYMSFLAGS=""; \
  270. NOALLSYMSFLAGS=""; \
  271. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $(SHLIBNAME_FULL) -Wl,-Bsymbolic"; \
  272. fi; \
  273. $(LINK_SO_DSO)
  274. link_shlib.solaris:
  275. @ if $(DETECT_GNU_LD); then \
  276. $(DO_GNU_SO); \
  277. else \
  278. $(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
  279. ALLSYMSFLAGS="-Wl,-z,allextract,-M,$(LIBNAME).map"; \
  280. NOALLSYMSFLAGS="-Wl,-z,defaultextract"; \
  281. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $(SHLIBNAME_FULL) -Wl,-Bsymbolic"; \
  282. fi; \
  283. $(LINK_SO_SHLIB)
  284. link_app.solaris:
  285. @ if $(DETECT_GNU_LD); then \
  286. $(DO_GNU_APP); \
  287. else \
  288. LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
  289. fi; \
  290. $(LINK_APP)
  291. # OpenServer 5 native compilers used
  292. link_dso.svr3:
  293. @ if $(DETECT_GNU_LD); then \
  294. $(DO_GNU_DSO); \
  295. else \
  296. ALLSYMSFLAGS=''; \
  297. NOALLSYMSFLAGS=''; \
  298. SHAREDFLAGS="$(CFLAGS) -G -h $(SHLIBNAME_FULL)"; \
  299. fi; \
  300. $(LINK_SO_DSO)
  301. link_shlib.svr3:
  302. @ if $(DETECT_GNU_LD); then \
  303. $(DO_GNU_SO); \
  304. else \
  305. ALLSYMSFLAGS=''; \
  306. NOALLSYMSFLAGS=''; \
  307. SHAREDFLAGS="$(CFLAGS) -G -h $(SHLIBNAME_FULL)"; \
  308. fi; \
  309. $(LINK_SO_SHLIB_UNPACKED)
  310. link_app.svr3:
  311. @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
  312. $(LINK_APP)
  313. # UnixWare 7 and OpenUNIX 8 native compilers used
  314. link_dso.svr5:
  315. @ if $(DETECT_GNU_LD); then \
  316. $(DO_GNU_DSO); \
  317. else \
  318. SHARE_FLAG='-G'; \
  319. ($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
  320. ALLSYMSFLAGS=''; \
  321. NOALLSYMSFLAGS=''; \
  322. SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $(SHLIBNAME_FULL)"; \
  323. fi; \
  324. $(LINK_SO_DSO)
  325. link_shlib.svr5:
  326. @ if $(DETECT_GNU_LD); then \
  327. $(DO_GNU_SO); \
  328. else \
  329. SHARE_FLAG='-G'; \
  330. ($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
  331. ALLSYMSFLAGS=''; \
  332. NOALLSYMSFLAGS=''; \
  333. SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $(SHLIBNAME_FULL)"; \
  334. fi; \
  335. $(LINK_SO_SHLIB_UNPACKED)
  336. link_app.svr5:
  337. @$(DETECT_GNU_LD) && $(DO_GNU_APP); \
  338. $(LINK_APP)
  339. link_dso.irix:
  340. @ if $(DETECT_GNU_LD); then \
  341. $(DO_GNU_DSO); \
  342. else \
  343. ALLSYMSFLAGS=""; \
  344. NOALLSYMSFLAGS=""; \
  345. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic"; \
  346. fi; \
  347. $(LINK_SO_DSO)
  348. link_shlib.irix:
  349. @ if $(DETECT_GNU_LD); then \
  350. $(DO_GNU_SO); \
  351. else \
  352. MINUSWL=""; \
  353. ($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
  354. ALLSYMSFLAGS="$${MINUSWL}-all"; \
  355. NOALLSYMSFLAGS="$${MINUSWL}-none"; \
  356. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic"; \
  357. fi; \
  358. $(LINK_SO_SHLIB)
  359. link_app.irix:
  360. @LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
  361. $(LINK_APP)
  362. # 32-bit PA-RISC HP-UX embeds the -L pathname of libs we link with, so
  363. # we compensate for it with +cdp ../: and +cdp ./:. Yes, these rewrite
  364. # rules imply that we can only link one level down in catalog structure,
  365. # but that's what takes place for the moment of this writing. +cdp option
  366. # was introduced in HP-UX 11.x and applies in 32-bit PA-RISC link
  367. # editor context only [it's simply ignored in other cases, which are all
  368. # ELFs by the way].
  369. #
  370. link_dso.hpux:
  371. @if $(DETECT_GNU_LD); then $(DO_GNU_DSO); else \
  372. ALLSYMSFLAGS=''; \
  373. NOALLSYMSFLAGS=''; \
  374. expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
  375. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$(SHLIBNAME_FULL),+cdp,../:,+cdp,./:"; \
  376. fi; \
  377. rm -f $(SHLIBNAME_FULL) || :; \
  378. $(LINK_SO_DSO) && chmod a=rx $(SHLIBNAME_FULL)
  379. link_shlib.hpux:
  380. @if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
  381. ALLSYMSFLAGS='-Wl,-Fl'; \
  382. NOALLSYMSFLAGS=''; \
  383. expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
  384. SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$(SHLIBNAME_FULL),+cdp,../:,+cdp,./:"; \
  385. fi; \
  386. rm -f $(SHLIBNAME_FULL) || :; \
  387. $(LINK_SO_SHLIB) && chmod a=rx $(SHLIBNAME_FULL)
  388. link_app.hpux:
  389. @if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
  390. LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,+s,+cdp,../:,+cdp,./:"; \
  391. fi; \
  392. $(LINK_APP)
  393. link_dso.aix:
  394. @OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || :; \
  395. OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
  396. ALLSYMSFLAGS=''; \
  397. NOALLSYMSFLAGS=''; \
  398. SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
  399. rm -f $(SHLIBNAME_FULL) 2>&1 > /dev/null ; \
  400. $(LINK_SO_DSO);
  401. link_shlib.aix:
  402. @ OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || : ; \
  403. OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
  404. ALLSYMSFLAGS='-bnogc'; \
  405. NOALLSYMSFLAGS=''; \
  406. SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
  407. rm -f $(SHLIBNAME_FULL) 2>&1 > /dev/null ; \
  408. $(LINK_SO_SHLIB_VIA_O)
  409. link_app.aix:
  410. LDFLAGS="$(CFLAGS) -Wl,-bsvr4 $(LDFLAGS)"; \
  411. $(LINK_APP)
  412. # Targets to build symbolic links when needed
  413. symlink.gnu symlink.solaris symlink.svr3 symlink.svr5 symlink.irix \
  414. symlink.aix:
  415. @ $(SYMLINK_SO)
  416. symlink.darwin:
  417. @ $(SYMLINK_SO)
  418. symlink.hpux:
  419. @ $(SYMLINK_SO)
  420. # The following lines means those specific architectures do no symlinks
  421. symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
  422. # Compatibility targets
  423. link_dso.bsd-gcc-shared link_dso.linux-shared link_dso.gnu-shared: link_dso.gnu
  424. link_shlib.bsd-gcc-shared: link_shlib.linux-shared
  425. link_shlib.gnu-shared: link_shlib.gnu
  426. link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
  427. symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
  428. link_dso.bsd-shared: link_dso.bsd
  429. link_shlib.bsd-shared: link_shlib.bsd
  430. link_app.bsd-shared: link_app.bsd
  431. link_dso.darwin-shared: link_dso.darwin
  432. link_shlib.darwin-shared: link_shlib.darwin
  433. link_app.darwin-shared: link_app.darwin
  434. symlink.darwin-shared: symlink.darwin
  435. link_dso.cygwin-shared: link_dso.cygwin
  436. link_shlib.cygwin-shared: link_shlib.cygwin
  437. link_app.cygwin-shared: link_app.cygwin
  438. symlink.cygwin-shared: symlink.cygwin
  439. link_dso.mingw-shared: link_dso.cygwin
  440. link_shlib.mingw-shared: link_shlib.mingw
  441. link_app.mingw-shared: link_app.cygwin
  442. symlink.mingw-shared: symlink.cygwin
  443. link_dso.alpha-osf1-shared: link_dso.alpha-osf1
  444. link_shlib.alpha-osf1-shared: link_shlib.alpha-osf1
  445. link_app.alpha-osf1-shared: link_app.alpha-osf1
  446. symlink.alpha-osf1-shared: symlink.alpha-osf1
  447. link_dso.tru64-shared: link_dso.tru64
  448. link_shlib.tru64-shared: link_shlib.tru64
  449. link_app.tru64-shared: link_app.tru64
  450. symlink.tru64-shared: symlink.tru64
  451. link_dso.tru64-shared-rpath: link_dso.tru64-rpath
  452. link_shlib.tru64-shared-rpath: link_shlib.tru64-rpath
  453. link_app.tru64-shared-rpath: link_app.tru64-rpath
  454. symlink.tru64-shared-rpath: symlink.tru64-rpath
  455. link_dso.solaris-shared: link_dso.solaris
  456. link_shlib.solaris-shared: link_shlib.solaris
  457. link_app.solaris-shared: link_app.solaris
  458. symlink.solaris-shared: symlink.solaris
  459. link_dso.svr3-shared: link_dso.svr3
  460. link_shlib.svr3-shared: link_shlib.svr3
  461. link_app.svr3-shared: link_app.svr3
  462. symlink.svr3-shared: symlink.svr3
  463. link_dso.svr5-shared: link_dso.svr5
  464. link_shlib.svr5-shared: link_shlib.svr5
  465. link_app.svr5-shared: link_app.svr5
  466. symlink.svr5-shared: symlink.svr5
  467. link_dso.irix-shared: link_dso.irix
  468. link_shlib.irix-shared: link_shlib.irix
  469. link_app.irix-shared: link_app.irix
  470. symlink.irix-shared: symlink.irix
  471. link_dso.hpux-shared: link_dso.hpux
  472. link_shlib.hpux-shared: link_shlib.hpux
  473. link_app.hpux-shared: link_app.hpux
  474. symlink.hpux-shared: symlink.hpux
  475. link_dso.aix-shared: link_dso.aix
  476. link_shlib.aix-shared: link_shlib.aix
  477. link_app.aix-shared: link_app.aix
  478. symlink.aix-shared: symlink.aix