‘mmake’ has support for alternative library directory hierarchies. These have the same structure as the prefix/lib/mercury tree, including the different subdirectories for different grades and different machine architectures.
In order to support the installation of a library into such a tree, you simply need to specify (e.g. in your Mmakefile) the path prefix and the list of grades to install:
INSTALL_PREFIX = /my/install/dir LIBGRADES = asm_fast asm_fast.gc.tr.debug
This specifies that libraries should be installed in /my/install/dir/lib/mercury, in the default grade plus ‘asm_fast’ and ‘asm_fast.gc.tr.debug’. If ‘INSTALL_PREFIX’ is not specified, ‘mmake’ will attempt to install the library in the same place as the standard Mercury libraries. If ‘LIBGRADES’ is not specified, ‘mmake’ will use the Mercury compiler’s default set of grades, which may or may not correspond to the actual set of grades in which the standard Mercury libraries were installed.
To actually install a library ‘libfoo’, use the ‘mmake’ target ‘libfoo.install’. This also installs all the needed interface files, and (if intermodule optimisation is enabled) the relevant intermodule optimisation files.
One can override the list of grades to install for a given library ‘libfoo’ by setting the ‘LIBGRADES-foo’ variable, or add to it by setting ‘EXTRA_LIBGRADES-foo’.
The command used to install each file is specified by ‘INSTALL’. If ‘INSTALL’ is not specified, ‘cp’ will be used.
The command used to create directories is specified by ‘INSTALL_MKDIR’. If ‘INSTALL_MKDIR’ is not specified, ‘mkdir -p’ will be used.
Note that currently it is not possible to set the installation prefix on a library-by-library basis.