Property compile -- List the source files that should be built if this option
is active and enabled.
Synopsis
cdl_option <name> {
compile [-library=libxxx.a] <list of files>
…
}
Description
The compile property allows component developers to specify source
files which should be compiled and added to one of the target
libraries. Usually each source file will end up the library
libtarget.a. It is possible for component writers
to specify an alternative library for an entire package using the
library property. Alternatively
the desired library can be specified on the compile line itself. For
example, to add a particular source file to the
libextras.a library the following could be used:
Details of the build process including such issues as compiler flags
and the order in which things happen can be found in
Chapter 4.
compile properties can occur in any of cdl_option,
cdl_component, cdl_package or cdl_interface. A compile
property has effect if and only if the entity that contains it is
active and enabled. Typically the body of a cdl_package will define
any source files that need to be built irrespective of individual
options, and each cdl_component, cdl_option, and cdl_interface
will define source files that are more specific. A single compile
property can list any number of source files, all destined for the
same library. A cdl_option or other entity can contain multiple
compile properties, each of which can specify a different library.
It is possible for a given source file to be specified in compile
properties for several different options, in which case the source
file will get built if any of these options are active and enabled.
If the package follows the directory
layout conventions then the configuration tools will search for
the specified source files first in the
src subdirectory of the
package, then relative to the package directory itself.
Note: A shortcoming of the current specification of compile properties is
that there is no easy way to specify source files that should be built
unless an option is enabled. It would sometimes be useful to be able
to say: “if option A is enabled then compile
file x.c, otherwise compile file
y.c. There are two simple ways of achieving this:
Always compile y.c, typically by listing it in
the body of the cdl_package, but use
#ifndef A to produce an empty object file if
option A is not enabled. This has the big
disadvantage that the file always gets compiled and hence for some
configurations builds will take longer than necessary.
Use a calculated option whose value is !A, and
have a compile y.c property in its body. This
has the big disadvantage of adding another calculated option to the
configuration.
It is likely that this will be resolved in the future, possibly by
using some sort of expression as the argument to a compile property.
Note: Currently it is not possible to control the priority of a compile
property, in other words the order in which a file gets compiled
relative to other build steps. This functionality might prove useful
for complicated packages and should be added.