Creating a Scripting Build Phase

With a custom build phase, you can specify a shell script that's executed on specified files in your target. You can copy release notes to the user's disk or compile files with a compiler that wasn't included with Project Builder. Note that you need to know how to use a shell language such as the Bourne shell or C shell.

Custom build phases replace the makefile preamble and postamble files used in previous versions of Project Builder. Project Builder does not let you edit a target's makefile.

To create a custom build phase:

  1. Click the Targets tab, select the target's name, click the Files tab, and choose Project > New Shell Script Build Phase.
  2. Enter the pathname for the script's shell, and then enter the script. The script field expands as you type.
  3. If you want to run the script only when installing the target's product, select "Run only when installing."
    Otherwise, the script runs whenever the target is built.

To delete a custom build phase:

Here are some tips on how to write shell scripts for custom build phases:

The shell script can use any variable defined in the target's Build Settings. To add a new variable:

  1. Click the Build Settings tab.
  2. In the Build Flags section, find an empty line, and enter the variable's name and value.

Related Topics

Build Variables