Previous: Defining new Targets, Up: Customizing build Targets and Models   [Index]


16.5.20.3 Defining new Modes

Modes are defined in a builder-mode node which has one attributes, name, which contains the name of the model, and which supports the following sub-nodes:

<description>

A one-line description of what the Mode does

<subdir>

Optional. The base name of the subdirectory to create for this Mode. The macro argument %subdir in the extra-args nodes will be substituted with this.

<supported-model>

The name of a model supported by this Mode. There can be multiple supported-model nodes, each corresponding to a supported Model. Optionally, you can specify a filter attribute for this node, corresponding to the switches that are relevant for this mode. By default, all switches will be taken into account. The extra-args of the Mode that match filter will be passed to commands of the supported Models.

<extra-args>

Contains a list of <arg> nodes, each containing one extra argument to append to the command line when launching Targets while this Mode is active. Macros are supported in the <arg> nodes.

<?xml version="1.0" ?>
<my_mode>
 <builder-mode name="optimization">
  <description>Build with code optimization activated</description>
  <subdir>optimized_objects</subdir>
  <supported-model>builder</supported-model>
  <supported-model>gnatmake</supported-model>
  <supported-model filter="--subdirs=">gprclean</supported-model>
  <extra-args>
     <arg>--subdirs=%subdir</arg>
     <arg>-cargs</arg>
     <arg>-O2</arg>
  </extra-args>
 </builder-mode>
</my_mode>