Name

mk_system — Set target system

Synopsis

MODULES="... platform ..."

mk_system sys

Description

Sets the system which will be the target of subsequent configure tests or build products. This is important for cross-compiling or multiarchitecture builds. The parameter sys may be either "host" to target the host system (the system that will run the end product of the build), or "build" to target the build system (the system running MakeKit).

Each system may support several ISAs (instruction set architectures) which can be targetted individually by suffixing /isa to the end of sys, e.g. build/x86_64 or host/ppc64. This allows exact control over which ISA is used for a configure test or a program or library.

When targetting "host" or "build" rather than a specific ISA, the behavior is more complicated. During the configure phase, tests will target the primary ISA for the system but assume that the result applies to all ISAs for the sake of speed. During the make phase, the behavior varies by OS. On systems that use "fat" or "universal" binaries, a multiarchitecture binary targetting all ISAs will be produced. On other systems, the primary ISA will be targetted.

Certain shell variables are considered "system" variables and will have their values swapped out appropriately when switching the target system, e.g. MK_LIBDIR. You can declare your own system variables with mk_declare -s.

This function gives fine-grained control that may not be necessary if all you need is multiarchitecture support. In this case, use mk_multiarch_do.