26.3. Adding Toolchains

For a compiler to be used by abuild, it must be named in an abuild platform. The platform can be added using either the platform or native-compiler directive as appropriate in the output of a list_platforms command.

To add a new compiler toolchain to abuild, in addition to declaring the native compiler or platform to make abuild try to use it, you must create a file file called compiler.mk where compiler is the name of the compiler that is being added, and place this file in the toolchains directory of a plugin. Abuild's internal toolchains are under make/toolchains. The best way to learn how to write a toolchain is to read existing ones. Most compiler toolchains will be designed to support C and C++ compilation and are therefore used by the ccxx rules. Details on the requirements for such toolchains can be found in make/rules/object-code/ccxx.mk in the abuild distribution (Appendix D, The ccxx.mk File).

Once you have written a support file for a new compiler, you will need to verify to make sure that it is working properly. A verification program is included with abuild: the program misc/compiler-verification/verify-compiler can be run to verify your compiler. This program creates a build tree that contains a mixture of static libraries, shared libraries, and executables and puts those items in the platform type of your choice. It then builds them with the specified compiler. You provide the path to the build tree containing the plugin, the name of the plugin, the platform type, and the compiler. The program can be used with either native compilers or non-native compilers. It also makes it very clear whether everything is working or not. Please run verify-compiler --help and see misc/compiler-verification/README.txt for additional details.