The following imake macros build dynamic executables:
DynamicUserTarget(prog, objs, staticLibs, dynamicLibs, dlDeps, options) DynamicSupTarget(prog, objs, staticLibs, dynamicLibs, dlDeps, options) DynamicCXXUserTarget(prog, objs, staticLibs, dynamicLibs, dlDeps, options) DynamicCXXSupTarget(prog, objs, staticLibs, dynamicLibs, dlDeps, options) DynamicLibraryTarget(prog, objs, staticLibs, dynamicLibs, dlDeps, options)
The prog argument is the name of the resulting program. Other arguments are the same as the DynamicLibraryTarget() macro. For the options argument, the following options are particularly useful:
-Xlinker -soname=<name> within a DynamicLibraryTarget() rule sets the internal so-name of the library. If a library used as a dependency in a rule that builds a dynamic executable has a so-name defined, the executable records the so-name instead of the dynamicLibs argument.
-Xlinker -rpath -Xlinker <dir>: defines the runpath directory that is added to the library search path (see "Runtime Linker").
The following example builds a dynamic program named prog from the binary object files a.o and b.o. The program is statically linked with the static ChorusOS operating system library. When this program is started, the runtime linker will load the dynamic library libdyn.so. In the target file system, this library can be located in the /libraries directory, as this directory is added to the search path of the runtime linker.
DynamicUserTarget( prog, a.o b.o, , libdyn.so, , -Xlinker -rpath -Xlinker /libraries)