Name

mk_chain_generic — Chain into component with foreign build system

Synopsis

MODULES="... chain-generic ..."

mk_chain_generic TARGETS=targets CONFIGURE=cfunc BUILD=bfunc

Options

SOURCEDIR=dir

Specifies that source files for the component are found in dir relative to the current MakeKitBuild file. Defaults to '.'.

TARGETS=targets

Specifies a list of targets that will be generated by the component. As an extension to the usual target syntax (see mk_resolve_target), you may suffix each target with a : and a list of targets it depends on. This is useful for specifying interdependencies between targets generated by the component. Note that these lists within a list require an additional level of shell quoting.

DEPS=deps

Specifies a list of target dependencies before the component can be configured

BUILDDEPS=bdeps

Specifies a list of target dependencies needed to build but not configure the component

CONFIGURE=cfunc

Specifies a function which will be invoked with the source directory and build directory as its two arguments. It should prepare the build directory for building the component (e.g. by running a configure script or similar).

BUILD=bfunc

Specifies a function which will be invoked with the build directory and output directory as its two arguments. It should build and install any build products into the output directory (e.g. by running make and make DESTDIR=... install).

STAGE=sfunc

Specifies a function which will be invoked with one of the targets in targets as its first parameter and a list of output directories as its subsequent parameters. It should generate the target from the output directories in a sensible way (e.g. simply copying it). This defaults to mk_chain_generic_stage.

PASSVARS=vars

Specifies a list of variables whose current values will be captured and made available to cfunc, bfunc, and sfunc when they are invoked.

Description

This function provides a generic mechanism to chain into a bundled component with a foreign build system. You must specify a list of targets which will be generated and at least two functions to carry out the actual build. The first, cfunc, should make preparations for the component to be built in a dedicated build directory. The second, bfunc, should build the component and install it into a dedicated output directory. You may optionally specify your own sfunc which transfers the installed files from the output directories into the staging area, but the default will work fine as long as the output directory has the same layout as the staging area.

On systems that support "fat" binaries, and when targeting the host system (but not a particular ISA), the component will be be configured and built for each ISA. A custom sfunc can be used to decide how to to create each target from the multiple outputs.

This function is very generic. If you wish to build projects which invoke the C or C++ compiler, consider using mk_chain_compiler instead.

This function sets result to a target that depends on all other targets it defined.