C H A P T E R  6

Editing and Compiling Programs

This chapter discusses editing and compiling source code while in the Prism environment. It is organized into the following sections:


Editing Source Code

The Prism environment provides an interface to the editor of your choice so that you can edit source code without having to leave the environment in which you compile and debug the code.


procedure icon  To Start the Default Editor on the Current Source File

single-step bulletPerform one of the following:

(prism all) edit [file-name | function-name]

You can specify which editor the Prism environment is to call by using the Customize window to set a Prism resource; see Changing Prism Resource Defaults. If this resource has no setting, Prism uses the setting of your EDITOR environment variable. Otherwise, the Prism environment uses the default editor listed in the Customize window.

The editor is invoked on the current file, as displayed in the source window. Some editors start at the current execution point. Other editors start at the beginning of the file.

After the editor has been created, it runs independently. This means that changes you make in the current file are not reflected in the source window. To update the source window, you must recompile and reload the program. You can do this using the Make selection from the Utilities menu, as described below.


Using the make Utility

The Prism environment provides an interface to the standard Solaris tool make. The make utility lets you automatically recompile and relink a program that is broken up into different source files. See your Solaris documentation for an explanation of make and makefiles.

Creating the Makefile

Create the makefile as you normally would. Within the Prism environment, you can choose the Edit selection from the Utilities menu to bring up a text editor in which you can create the file; see Editing Source Code.

Using the Makefile

After you have made changes in your program, you can run make to update the program.

The Prism environment uses the standard Solaris make utility, /usr/ccs/bin/make, unless you specify otherwise. You do this by using the Customize utility to change the setting of a Prism resource; see Changing Prism Resource Defaults.


procedure icon  To Run make From the Menu Bar

single-step bulletPerform the following:

A window like the one shown in FIGURE 6-1 appears.
If you leave the Makefile or the Target box empty, make uses a default. See your Solaris documentation for a discussion of these defaults. If you leave the Directory box empty, make looks for the makefile in the directory from which you started the Prism environment.
You can specify any standard make arguments in the Other Args box.
The dialog box also asks if you want to reload after the make. Answering Yes automatically reloads the newly compiled program into the Prism environment if the make is successful. If you answer No, the program is not reloaded. Yes is the default.

 FIGURE 6-1 The make Window

Screenshot of the make window.

procedure icon  To Run make From the Command Window

single-step bulletType

(prism all) make arguments

You can specify any arguments that are valid in the Solaris version of make.