[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2 Multilibs in Target Libraries

The target libraries in the Cygnus tree are automatically built with multilibs. That means that each library is built multiple times.

This default is set in the top level `configure.in' file, by adding `--enable-multilib' to the list of arguments passed to configure when it is run for the target libraries (see section 5.6.1 Host and Target Libraries).

Each target library uses the shell script `config-ml.in', written by Doug Evans, to prepare to build target libraries. This shell script is invoked after the `Makefile' has been created by the `configure' script. If multilibs are not enabled, it does nothing, otherwise it modifies the `Makefile' to support multilibs.

The `config-ml.in' script makes one copy of the `Makefile' for each multilib in the appropriate subdirectory. When configuring in the source directory (which is not recommended), it will build a symlink tree of the sources in each subdirectory.

The `config-ml.in' script sets several variables in the various `Makefile's. The `Makefile.in' must have definitions for these variables already; `config-ml.in' simply changes the existing values. The `Makefile' should use default values for these variables which will do the right thing in the subdirectories.

`MULTISRCTOP'
`config-ml.in' will set this to a sequence of `../' strings, where the number of strings is the number of multilib levels in the source tree. The default value should be the empty string.
`MULTIBUILDTOP'
`config-ml.in' will set this to a sequence of `../' strings, where the number of strings is number of multilib levels in the object directory. The default value should be the empty string. This will differ from `MULTISRCTOP' when configuring in the source tree (which is not recommended).
`MULTIDIRS'
In the top level `Makefile' only, `config-ml.in' will set this to the list of multilib subdirectories. The default value should be the empty string.
`MULTISUBDIR'
`config-ml.in' will set this to the installed subdirectory name to use for this subdirectory, with a leading `/'. The default value shold be the empty string.
`MULTIDO'
`MULTICLEAN'
In the top level `Makefile' only, `config-ml.in' will set these variables to commands to use when doing a recursive make. These variables should both default to the string `true', so that by default nothing happens.

All references to the parent of the source directory should use the variable `MULTISRCTOP'. Instead of writing `$(srcdir)/..', you must write `$(srcdir)/$(MULTISRCTOP)..'.

Similarly, references to the parent of the object directory should use the variable `MULTIBUILDTOP'.

In the installation target, the libraries should be installed in the subdirectory `MULTISUBDIR'. Instead of installing `$(libdir)/libfoo.a', install `$(libdir)$(MULTISUBDIR)/libfoo.a'.

The `config-ml.in' script also modifies the top level `Makefile' to add `multi-do' and `multi-clean' targets which are used when building multilibs.

The default target of the `Makefile' should include the following command:
 
@$(MULTIDO) $(FLAGS_TO_PASS) DO=all multi-do
This assumes that `$(FLAGS_TO_PASS)' is defined as a set of variables to pass to a recursive invocation of `make'. This will build all the multilibs. Note that the default value of `MULTIDO' is `true', so by default this command will do nothing. It will only do something in the top level `Makefile' if multilibs were enabled.

The `install' target of the `Makefile' should include the following command:
 
@$(MULTIDO) $(FLAGS_TO_PASS) DO=install multi-do

In general, any operation, other than clean, which should be performed on all the multilibs should use a `$(MULTIDO)' line, setting the variable `DO' to the target of each recursive call to `make'.

The `clean' targets (`clean', `mostlyclean', etc.) should use `$(MULTICLEAN)'. For example, the `clean' target should do this:
 
@$(MULTICLEAN) DO=clean multi-clean


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by system on December, 2 2004 using texi2html