Next: Defining new Modes, Previous: Defining new Target Models, Up: Customizing build Targets and Models

##### 16.5.20.2 Defining new Targets

Targets are defined in a `target` node which has three attributes:

`name`
  Contains the name of the Target. It must be a unique name. Underscores are interpreted as menu mnemonics. To represent an actual underscore, use a double underscore.
`category`
  The category which contains the Target, for purposes of ordering the tree in the Target Configuration Dialog, and for ordering in the Build menu.Underscores are interpreted as menu mnemonics. To represent an actual underscore, use a double underscore. If `category` begins and ends with an underscore, the menu for the Target is placed in the toplevel Build menu.
`model`
  The name of the Model of which this Target inherits initially.

`<icon>`
  The stock name of the icon to associate by default with the Target.
`<in-toolbar>`
  Optional, defaulting to `False`. A boolean indicating whether the Target should have an associated icon in the Toolbar.
`<in-menu>`
  Optional, defaulting to `True`. A boolean indicating whether the Target should have an associated entry in the Build menu.
`<in-contextual-menus-for-projects>`
  Optional, defaulting to `False`. A boolean indicating whether the Target should have an associated entry in the contextual menu for projects.
`<in-contextual-menus-for-files>`
  Optional, defaulting to `False`. A boolean indicating whether the Target should have an associated entry in the contextual menu for files.
`<read-only>`
  Optional, defaulting to `False`. A boolean indicating whether the Target can be removed by the user.
`<target-type>`
  Optional, defaulting to an empty string. A string indicating whether the Target represents a simple target (if empty), or a family of Targets. The name represents a parameter passed to the `compute_build_targets` hook. If set to `main`, a new subtarget will be create for each Main source defined in the project.
`<launch-mode>`
  Optional, defaulting to `MANUALLY`. Indicates how the Target should be launched. Possible values are `MANUALLY`, `MANUALLY_WITH_DIALOG`, `MANUALLY_WITH_NO_DIALOG`, and `ON_FILE_SAVE`.
`<server>`
  Optional, defaulting to `Build_Server`. Indicates the server used for launching Target. See Remote operations.
`<command-line>`
  Contains a number of `<arg>` nodes, each containing an argument of the default command line for this Target, starting with the executable.

         <?xml version="1.0" ?>
         <my_target>
            <target model="gprclean" category="C_lean" name="Clean _All">
                <in-toolbar>TRUE</in-toolbar>
                <icon>gps-clean</icon>
                <launch-mode>MANUALLY_WITH_DIALOG</launch-mode>
                <read-only>TRUE</read-only>
                <command-line>
                   <arg>%gprclean</arg>
                   <arg>-r</arg>
                   <arg>%eL</arg>
                   <arg>-P%PP</arg>
                   <arg>%X</arg>
                </command-line>
           </target>
         </my_target>