Using Sun WorkShop

Using Makefile Macros

Makefile macros let you refer conveniently to files or command options that appear more than once in the description file. (For information on defining macros, see Appendix B, The make Utility and Makefiles.)

Using the Make Macros dialog box (see Figure 4-5), you can add makefile macros to or delete them from the Persistent Build Macros list in your WorkShop target, and then reassign values for makefile macros in the list. You can also add macros currently defined in the makefile to the list and override their values.

All macros in the Persistent Build Macros list are saved with your WorkSet.

To open the Make Macros dialog box, click Macros in the Edit Target dialog box.

Figure 4-5 Make Macros Dialog Box

Graphic

Persistent Build Macros pane 

Lists macros that will be saved with your WorkSet 

More/Less button 

More opens the Filter text box and Makefile Macros list pane; the button toggles to Less, which closes the pane 

<<Add button 

Lets you add a macro in the Makefile Mactros list to the Persistent Build Macros list 

Name text box 

Lets you assign a name to a new macro or change the name of the selected macro on the Persistent Build Macros list 

Value text box 

Lets you assign a value to the macro named in the Name text box 

Add button 

Adds the macro defined in the Name and Value text boxes to the Persistent Build Macros list 

Change button 

Applies the values in the Name and Value text boxes to the selected macro on the Persistent Build Macros list 

Delete button 

Deletes the selected macro on the Persistent Build Macros list 

Delete All button 

Deletes all macros on the Persistent Build Macros list 

Clear button 

Clears the Name and Value text boxes 

Filter text box 

Lets you type a search pattern to filter the Makefile Macros list 

Makefile Macros list 

Lists the macros defined in the makefile in the current WorkSet 

OK button 

Applies the changes and closes the dialog box 

Apply button 

Applies the changes but leaves the dialog box open 

Cancel button 

Closes the dialog box without applying changes 

Help button 

Displays online help for the dialog box 

Adding a Macro

To add a macro to the Persistent Build Macros list:

  1. Type the name of a macro in the Name text box.

  2. Type a value for the macro in the Value text box.

    If you make a mistake, click Clear to remove entries in the Name and Value text boxes.

  3. Click Add to add the new macro to the list.

  4. Repeat the previous three steps to add other macros.

  5. Click OK to close the dialog box.

Deleting a Macro

To delete a macro from the Persistent Build Macros list:

  1. Select a macro in the list.

  2. Click Delete (Delete All removes all macros in the list).

  3. Click OK to establish the change and close the dialog box.

Changing a Macro

To change the value of a macro in the Persistent Build Macros list::

  1. Select a macro in the list.

  2. Type a new value in the Value text box and click Change.

  3. Click OK to establish the change and close the dialog box.

  4. Click Build in the Edit Target dialog box to start the build with the new values.

Reviewing and Overriding Makefile Macros

A macro definition that appears in the Persistent Build Macros list overrides any macro with the same name that appears in the makefile.

To review the current macro definitions, click More to open the Makefile Macros list, which displays all the macros that are defined in the makefile associated with the build target. You can filter the list using the Filter text box.

To override the value of a makefile macro:

  1. Select a macro in the Makefile Macros list.

  2. Click <<Add to add the macro to the Persistent Build Macros list.

  3. Type a new value in the Value text box and click Change.

  4. Click OK to establish the change and close the dialog box.

    The macro definition in the Persistent Build Macros list overrides the macro definition in the makefile, and is saved with your WorkSet.

  5. Click Build in the Edit Target dialog box to start the build with the new values.