With the mkmk tool, you can write portable description files. The files are independent of both the host system you use and the target for which the system you are creating is destined. The mkmk tool also provides high level abstraction rules which ensure the portability of the application build files.
The mkmk command uses three types of build description files, suffixed by .df, .bf, and .mf, to produce Makefiles and generate all.dp dependencies. With mkmk, you create a .mf file for each host. In this way the mkmk tool ensures portability during cross compilation and so ensures the portability of hosts and targets.
The .df files are used as shell scripts that are launched when the Makefile is created to adjust variables before they are written into the Makefile. The .df files define the following variables:
The cpp symbols
The header file directories
The list of subdirectories
The .df files have similar properties to the Project.tmpl files of the imake tool. See ChorusOS 4.0 Introduction for further information. They affect the building of the Makefiles for all the subdirectories. With mkmk, you can have several .df files in each directory of the source tree. This contrasts with the imake tool, which has only one Project.tmpl file per component.
The inheritance mechanism of the mkmk tool is different from that of the imake tool. With mkmk, every Makefile is dependent on the Makefile present in the parent directory. However, with imake, every Makefile is dependent on the Project.tmpl file present in the top-level of the component and on the few variables which are inherited from the parent directory. The variable and macros are defined in the production tools. Table 4-2 lists those which you must not modify and Table 4-3 lists those which you may modify.
Table 4-2 Variables for the .df files, that must not be changedTARGETMKRULES | <bin_dir>/tools/tgt-make/mktgt.rf |
MKRULES | <bin_dir>/tools/tgt-make/mktgt.rf |
DTL | <bin_dir>/tools/host/bin/ |
GROOT | ../../ |
BDIR | <bin_dir> |
BNAME | kern |
HOST | LINUX |
FAMILY | PowerPC |
COMPILER | gcc |
BFILES | List of .bf files found in your work directory |
MFILES | List of .lf files found in your work directory |
DFILES | kern.df |
Table 4-3 Variables in the .df files that you can modify
DEFINES | List of macro definitions to use in every compilation rule |
INCLUDES | List of directories to search for header files |
VARIABLES | The list of user defined variables to export in Makefiles produced in subdirectories |
SUB_DIRS | The list of directories to use when compiling; these are usually the subdirectories of your work directory |
EXTRA_DIRS | A list of directories to use, in addition to SUB_DIRS, when creating libraries or linking actors (usually empty) |
MODULES | The name of the module to which the object in your work directory (and subdirectories) belong; this is only useful in configurable actors |
FEXCEPTION | (ON/OFF); Compile with exception support |
FFPU | (ON/OFF): Compile with FPU support |
FOPTIM | (ON/OFF): Compile with optimization |
FPROF | (ON/OFF): Support for profiling |
FREMOTEDEB | (ON/OFF): Compile with debug options, to enable debug with XRAY |
FVERBOSE | (ON/OFF): Verbose compilations |
FWARN | (STRICT/ON/OFF): Enable warnings production during compilation; with STRICT, warnings are treated as errors, the NUCLEUS component uses STRICT |
The .bf files are equivalent to the Imakefiles. They define source files, binary files and compilation options. The .bf files contain link directives and source definitions, such as C__SRCS. You can have several .bf files per directory. The mkmk tool concatenates the .bf files inside the Makefile product. The .bf file is preprocessed by the macro processor m4(1).
Table 4-4 lists the macros used in a .bf file. Actor, ConfigurableActor, Library and BigObject, either directly, or indirectly use getExport to get the list of object files. DistFile and Export are defined in $(DEVTOOLS_DIR)/tgt-make/mkrules.m4.
Table 4-4 Macros used in .bf files.Actor(actor, libs) | build 'actor' using libs |
ConfigurableActor(actor, libs) | build 'actor' using libs |
Library(lib) | build 'lib' |
BigObject(obj) | build a relocatable object file |
DistFile(file,dir) | copy 'file' into 'dir' |
Export(file,dir) | same as DistFile |
The .mf files contain lists of source files. The .mf files are used when the binary file to be built uses many subdirectories, each subdirectory containing a variable number of files to be compiled.
Another form of .mf files are .lf files. The variables and macros used in the .mf and .lf files are listed in Table 4-5.
Table 4-5 Variables and macros used in .mf and .lf filesC++SRCS | C++ source files |
C__SRCS | C source files |
AS_SRCS | assembly code source files |
M4_SRCS | M4 source files (assembly code source files preprocessed with m4). |
OF_SRCS. | C++ source files used to produce offset files |