The following imake macro is used to build shared libraries:
SharedLibraryTarget(shlib, shobjs, sharedLibs, staticLibs, slDeps, options)
shlib: the name of the resulting shared library (suffixed by .so).
shobjs: a list of binary object files in PIC format (suffixed by .o).
sharedLibs: a list of dependencies. This includes the shared libraries that must be loaded together with the resulting library. Each library can be defined in one of two ways:
-L path -l name
On the host, the linker looks for the library path/libname.so. On the target, the runtime linker looks for lib name.so in the library search path.
path
This is an absolute or relative library path used on the host by the linker, and on the target by the runtime linker. A relative path containing a "/" is interpreted as relative to the current directory by the runtime linker. A path without the "/" is searched in the library search path by the runtime linker.
staticLibs: a list of static libraries (.a) that are statically linked.
slDeps: a list of shared libraries on which the resulting library depends. If these libraries are changed, the resulting library slib will be rebuilt. Each library must be defined as a path on the host. Generally slDeps duplicates the libraries described in sharedLibs. To express the dependency without embedding a path in the executable, use the -L path -l name syntax.
options: any linker options, preceded by -Xlinker. This option must be used to supply system-specific linker options which cannot be recognized by the compiler. To pass an option that takes an argument, you must use -Xlinker twice, once for the option and once for the argument.
The following example builds a shared library named libfoo.so from the PIC binary objects files, a.o and b.o. When this library is loaded dynamically, the runtime linker will also load the libshared.so.
SharedLibraryTarget( libfoo.so, a.o b.o, , libshared.so, , )