| |||
| Home > Customizing Projects > Customizing the build > Adding a custom build group | |||
In this example, you add a new CUSTOM group
to the project build model and then configure this group to display
a message during the build. Custom groups can be created at different
points in the settings hierarchy and easily disabled when not required.
There are two ways to configure a CUSTOM group,
either:
Create
a new CUSTOM group in a specified location in
the hierarchy.
Copy the default CUSTOM=default group
for the project and then rename this group.
This example creates a new CUSTOM group so that default settings
are shown. Where you have not made any changes to the CUSTOM=default group
for the project, this gives the same result.
To set up the new build group:
Select Project → Project Properties... to display the Project Properties window.
Right-click on a group in the
List of Entries pane, the left pane.
Where you click defines the location of the new group in the
hierarchy, for example, right-click on the *COMPILE=arm group
to see the new entry inserted below this group.
Select Make New... from the context menu to display the Group Type/Name selector dialog box.
Highlight CUSTOM in the Group
Type display list.
Type MY_GROUP in the Group Name
field.
Click OK to close the Group Type/Name selector dialog box.
The contents of the new group are displayed in the Settings Values pane, the right pane, of the Project Properties window.
Right-click on the Message setting,
in the Settings Values pane, and select Edit Value from
the context menu.
Type Writing version to version file and
then press Enter to confirm the value.
This string is output every time you build or rebuild the application.
Right-click on the Files setting,
in the Settings Values pane, and select Edit Value from
the context menu.
Type version.txt and then press
Enter to confirm the value.
Right-click on the Depends_on setting,
in the Settings Values pane, and select Edit Value from
the context menu.
Type $(MAKENAME) and then press
Enter to confirm the value. Ensure that you do not include any spaces
in the entry.
This entry means that the output file is dependent on the
makefile so you rebuild version.txt each time
the makefile is updated. Usually, dependent files are inputs to
a build but this example illustrates the method.
Do not make the executable file, dhrystone.axf,
the dependent because that does not work. Instead, you must use
postlink commands as shown in Adding prelink and postlink commands.
Right-click on the Command setting,
in the Settings Values pane, and select Edit Value from
the context menu.
Type +echo ‘version = 1.00 >$@‘ and
then press Enter to confirm the value.
This command writes the message to the text file defined previously. You might use a command to run another program or to output the date.
Preceding the command with a plus sign means that the command is a built-in operating system shell command. Do not put a plus sign in the command when running normal applications. If you do not want the command to be shown while it is running, put an at sign (@) in front of the command string.
The Project Properties window looks like Figure 5.10.
Select File → Save and Close to regenerate the makefile(s) for the project, and close the Project Properties window.
Select Tools → Build... to rebuild the application.
Click on the Build tab, if necessary, to see the build output.
In this example, you are sending the output file version.txt to
the current working directory. Open the messages file in the File
Editor pane and view the contents.