Using Sun WorkShop

Building a Program

You can begin a build without having to specify a build command, makefile, or target. Or you can specify one or all of these. You can also customize a build by specifying make options, specifying a build mode, overriding makefile macros, or editing environment variables (see "Customizing a Build").

Define New Target and Edit Target Dialog Boxes

You specify build parameters using the Define New Target and Edit Target dialog boxes, which are basically identical. You use the Define New Target dialog box to specify a new WorkShop target and the Edit Target dialog box to modify an existing WorkShop target. Figure 4-2 shows the Define New Target dialog box.

Figure 4-2 Define New Target Dialog Box

Graphic

Directory text box 

Lets you type a build directory path. You can also select a directory by clicking on the browse button. 

Makefile text box 

Lets you specify a makefile (the default file name is makefile or Makefile. You can also select a makefile by clicking on the browse button.

Target text box 

Lets you specify a make target. You can also select a target by clicking on the browse button. 

Browse (..) buttons 

Let you display dialog boxes in which you can choose a build directory, makefile, or make target 

Command text box 

Lets you type a make command; the default command is dmake (described in "Running a Distributed Build").

Options button 

Opens the Make Options dialog box (see "Specifying Make Options"). The Make Options dialog box allows you to modify the parameters of a build using the options provided.

Macros button 

Opens the Make Macros dialog box (see "Using Makefile Macros"), which allows you to add, change, or delete macros to be passed into the build.

Environment Variables button 

Opens the Environment Variables dialog box (see "Using Environment Variables"), which allows you to add, change, or delete environment variables to be passed into the build.

OK button 

Applies the build parameters and closes the dialog box. 

Apply button 

Applies the build parameters. 

Build button 

Applies the build parameters and builds the target. 

Cancel button 

Closes the dialog box without applying changes. 

Help button 

Displays online help for the dialog box. 

Building With Default Values

You can begin a build without having to specify a build command, makefile, or target. Sun WorkShop provides a default makefile name (makefile), a default make target, and a default make command, dmake (see "Running a Distributed Build"). All you need to supply is the path name for the build directory.

Default Makefile and Make Target

The Define New Target dialog box contains the value Default in the Makefile and Target text boxes. If you do not specify a particular makefile or make target, Sun WorkShop looks for a file named makefile in the build directory and uses the first make target in that makefile. However, if make finds an SCCS history file (s.makefile) that is newer than the file named makefile, Sun WorkShop uses the most recent version of s.makefile. If makefile does not exist, Sun WorkShop searches for a file named Makefile. Again, if an SCCS history file (s.Makefile) exists that is newer than Makefile, Sun WorkShop uses the most recent version of s.Makefile.

Using Default Values

To build a program using default build values:

  1. Look in the Directory status field in the Building window to be sure you have the correct build directory set.

  2. If the current build directory is correct, click the Build button, choose Build > Build in the Sun WorkShop main window or the Building window, or select a WorkShop target from the list at the bottom of the Build menu in either window.

  3. If no build directory is displayed in the Directory status field or you want to change build directories, choose Build > New Target to open the Define New Target dialog box. Type the build path in the Directory text box.

    You can also click the browse button to open a directory chooser. Choose a directory in the list and click OK to load it into the Directory text box. Then click Build at the bottom of the dialog box.

The build output is displayed in the Build Output display pane in the Building window. Click the Stop Build button in the Building window or choose Build > Stop Build to stop the build process.


Note -

The next time you open the Building window, the build directory is set to the last directory in which you ran a build job. You can see the path name in the Directory status field.


Building With Nondefault Values

If you have a makefile with a unique name, a certain make target, or a specific build command, specify it in the Define New Target dialog box or Edit Target dialog box by clicking on the appropriate browse button (see Figure 4-2). Each browse button displays a dialog box.

  1. Type the name of the directory in which you want to build and click Apply to apply the change.

    You can also select another directory from the Set Build Directory dialog box. If you have not specified a build directory, Sun WorkShop either tries to build in the directory currently displayed in the build directory field or, if no directory is displayed, displays an error message pop-up window.

  2. Type the name of the makefile you want in the Makefile text box.

    If you want to choose another makefile from the current build directory, type the name of the makefile in the Makefile text box, or choose a makefile from the list in the Set Makefile dialog box, and click OK.

    You can run your build in a directory that is different from the one the makefile is in. Just specify the full path name of the makefile in the Makefile text box.

  3. Type the name of the make target you want in the Target text box.

    Type the name of the make target in the Target text box, or choose another make target in the current makefile in the Target Chooser dialog box, and click OK.

  4. Type the name of the build command you want in the Command text box.

    If the build command you specify is something other than make or dmake, you can specify the command and any of its arguments in the Command text box. The build command is formed by prepending setenv commands for any environment variables specified through the Environment Variables dialog box and by appending any of the make options specified through the Make Options and Make Macros dialog boxes.


    Note -

    If the path to the build command is not in your PATH environment variable, you might have to specify the full command path.


  5. Click Build in the dialog box to start a build with the settings you supplied.

The build output is displayed in the Build Output display pane in the Building window. Click the Stop Build button in the Building window or choose Build > Stop Build to stop the build process.

Collecting Build Output

Build output is cleared from the Build Output display pane each time you run a build job. You can keep the build output from previous builds by setting the Accumulate Output switch to on.

To collect build output, choose Edit > Accumulate Output.

The Accumulate Output command toggles the switch on and off. When a build is performed, output for that build is displayed below the output for the previous build. You can scroll through the pane to see the output for each build. To identify specific build jobs, each build output begins with the build path and the name of the build target.

To clear the build output log, choose Edit > Clear Results.

Saving Build Output

You can maintain a history of build output information for one or more build jobs by saving the output to a file.

To save build output:

  1. Choose Build > Save Output As.

  2. Choose or create a file in which to save the output using the Save Build Output dialog box.

The build output log is saved as a text file.