[Contents] [Prev. Chapter] [Next Section] [Next Chapter] [Index] [Help]

4    Builder

This chapter provides an overview of the Builder's features and capabilities. For more detailed information on how to use this tool, choose Help: On Builder. You can print Help topics using the HyperHelp Viewer.

The FUSE Builder allows you to build applications quickly and consistently. The Builder supports all make utilities, including, but not limited to, Ultrix make, POSIX make, and gnumake. For detailed information about a specific utility, see your system documentation, or choose either the On Make(1u), On Make(1p), or On Gnumake option from the Help menu.

Figure Figure 4-1 shows the Builder main window.

Figure 4-1:  Builder Main Window

Key elements are the major window panes running from the top to the bottom of the window:

Configuration area

Displays basic information about the current build session such as the current project and build directory.

Graphic display area

Displays a graphical representation of the currently selected makefile. You can turn on and turn off the graph display. By default, the graph is turned off.

Controls area

Lets you set up the parameters for a build and start the compilation process.

Transcript area

Displays all error, warning, and status messages associated with the compilation of a makefile.

Information area

Displays information messages and Quick Help on menu items when you press and hold MB1 on the item.


[Contents] [Prev. Chapter] [Next Section] [Next Chapter] [Index] [Help]

4.1    Summary of Features

The Builder lets you do the following:


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.2    Requirements for Using the Builder

To use the Builder for program building:

If you are working with unsupported languages, you can still use the Builder to create, edit, and build files. However, interaction between the Builder and the FUSE Editor is compromised; the FUSE Editor cannot annotate compilation errors generated by a build that involves files coded in an unsupported language.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.3    Starting the Builder

You can start the Builder in several ways:

When you start the Builder, it searches for a file named makefile or Makefile in the working directory. If a makefile cannot be found, the Builder displays an informational message and displays the Builder main window. You can configure Builder properties for the current project to use a makefile (in the working directory) with a different name, or a makefile that may exist in a directory other than the working directory (see Section Section 4.4).


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.3.1    Use the Command Line

You can start the Builder from the command line using the following command:

% fusebuild [-f path] [-cwd] [-Xt-Options]

See Appendix Appendix D and the specific reference pages for the command syntax and options.

If the Control Panel is not running, it starts automatically as a minimized icon. If FUSE is already running, the Builder is placed in the current project.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.3.2    Use the Builder Icon from CDE

When you have CDE installed, FUSE provides a FUSE application group icon and icons for the individual tools that make up the FUSE environment.

To invoke the tool:

  1. Double click on the Application Manager icon in the CDE Front Panel to display the application group icons.

  2. Double click on the Application Manager icon in the CDE Front Panel to display the application group icons.

  3. Double click on the FUSE application group icon to display the icons in the FUSE application group.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.3.3    Use the FUSE Control Panel

To start the Builder from the FUSE Control Panel, choose Builder from the Tools menu. Like all tools, the Builder inherits its configuration data from the project settings. If these settings are already specified, the Builder main window appears. Otherwise, you will be prompted by an informational box to set project properties for the Builder. See Section Section 4.4 for more information on setting properties for the Builder. See Section Section 9.4 for more information on working with projects.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.3.4    Use the Tools Menu from Most FUSE Tools

Most FUSE tools have a Tools menu. To start the Builder, select Builder from the Tools menu.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.4    Setting Project Properties for the Builder

By default, the Builder uses the working directory as the build directory and uses a makefile in the working directory.

To set up the Builder to use a build directory different from the working directory, or a different makefile in the working directory, or a makefile that exists in a directory other than the working directory, choose Projects: Show/Modify... from the Control Panel. In the resulting Project Manager dialog box, click on the Settings Category options box at the top and choose Builder. This brings up the Project Manager dialog box shown in Figure Figure 4-2.

Figure 4-2:  Project Manager Dialog Box

The Project Manager displays the following information:

For more information (including information on syntax for the build and compile commands), click on the Help button on the dialog box to bring up the online Help topic Set Builder Properties for a Project.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.5    Using the Makefile Graph Display

The Builder makefile graph provides a graphical representation of the currently selected makefile. The graph lets you use the Builder main window to view a graph of the file, select targets in the makefile for building, and view a transcript of the build operation and any errors that it reports.

Use the makefile graph to become familiar with a new program, analyze changes you make to the build procedure, and select build targets. The makefile graph provides a graphical view of the relationships among files as defined in a makefile.

By default, the makefile graph display is turned off. When you turn on the graph, the Builder searches first for the makefile specified when you configured the Builder. If the Builder does not find that makefile, it searches the working directory for the file named makefile or Makefile. If the Builder finds a makefile, it parses it and then displays the makefile graph in the Builder main window display area. If it does not find a makefile, it displays a pentagon symbol.

The makefile graph uses shapes and colors (or gray scale), and line patterns and widths to provide information about file category, update status, and dependency relationships. See the online Help for an explanation of what each color and shape represents.

Note

If a makefile is recursive (that is, it calls another makefile), the makefile graph displays only those nodes in the second makefile that are directly referenced by the calling command.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.5.1    Turning the Makefile Graph Off and On

Before the Builder displays a makefile graph, it must first parse the makefile. Depending on the complexity of the makefile, the parsing could take a few minutes. Therefore, by default, the Builder does not display a makefile graph. If you want the Builder to display a graph of the currently selected makefile, choose Show Graph from the Graph menu. When the graph is turned on, the Show Graph option has a check mark beside it. Click on the option again to turn off the graph.

Note

The graph is turned off if you choose Other as the make engine.

To change the default settings of the Builder so that the makefile graph is automatically displayed when you start the Builder, do the following:

Step Action
1

Click on the Graph menu. If a check mark does not appear next to the Show Graph option, click on this option. A check mark next to the Show Graph option indicates that the graph display is turned on.

2

Choose Save Options from the Options menu.

An informational dialog box indicates that the saved options will be in effect the next time you invoke the Builder.

3

Click on OK in the informational dialog box.

If you change the graph settings during your Builder session but do not save the new settings before exiting the Builder as described in steps 2 and 3, a dialog box is displayed when you exit the Builder asking if you want to save your settings.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.5.2    Using the Mouse for Viewing Information in the Makefile Graph

Table Table 4-1 lists the mouse actions you can use to display information about the makefile graph.

Table 4-1:  Makefile Graph Mouse Actions

Use this mouse action... To...
Press and hold MB1 and drag the pointer across a node or line Display the file name or dependency in the information area of the Builder main window.
Press MB1 on the node. Select a node, display its dependency graph, and make it the current build target.
Double click on a source file node. Display the file in an editor.
Position the pointer over the node and press MB3. See the dependency graph for single node (without selecting it).
Press MB3 on a selected node. Clear the selection and display the top-level graph.

In the case of a particularly complex graph, you may want to reduce the information in the graph and change the graph layout. Use the Builder Graph menu to adjust the layout and filter information.

When a build operation starts, check the transcript. For a successful build, the transcript lists no errors and the Error buttons remain grayed out. The makefile graph is updated to show that all nodes that are part of the target's dependency are up-to-date. If a build is unsuccessful, the transcript lists the errors and the First error button is enabled. The makefile graph reflects only intermediate targets that were successfully built.

To facilitate your interpretation of the file graph, you can click on the zoom buttons located below the graph. These buttons allow you to increase or reduce the size of graph objects, or redraw the graph so that all object labels are visible.

Figure Figure 4-3 shows a typical makefile graph.

Figure 4-3:  Builder Makefile Graph

Compare the graph with the following example, which is the makefile from which the graph was generated. The example contains callouts that clarify the relationship between makefile entries and their graphical representations.

 
SRCS = count.c fileops.c misc.c    (1)
 OBJS = count.o fileops.o misc.o   (2)    
 CFLAGS = -g 
 all: count    (3)
 count: $(OBJS)     cc -non_shared -o count $(OBJS)    (4)
 clean:     rm -f count $(OBJS) core *~                (5) 
 depend:    @cat < /dev/null > makedep             (6)
      @for i in ${SRCS}; do \                   
                   ($(CC) -M $(INCLUDES)  $$i >> makedep); done      
      @echo `/^# DO NOT DELETE THIS LINE/+1,$$d' > eddep      
      @echo `$$r makedep' >> eddep      
      @echo `w' >> eddep
      @$(RM) -f makefile      
      @$(CP) Makefile makefile      
      @chmod 644 makefile      
      @ed - makefile < eddep      
      @$(RM) -f eddep makedep      
      @echo `# DEPENDENCIES MUST END AT END OF FILE' >> makefile
      @echo `# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> makefile
      @echo `# see make depend above' >> makefile      
      # DO NOT DELETE THIS LINE -- make depend uses it

  1. Source (.c) files for the executable, count. Each source file is represented on the graph by a rounded rectangle.

  2. Object files on which the count executable directly depends. These are intermediate files and are represented on the graph by rounded rectangles.

  3. The all node on the graph represents a final build target for the entire count application and is represented on the graph as a diamond. As the first target specified in the makefile, all is also the default build target for the Builder.

  4. Build command for the count executable file that counts the number of times each letter of the alphabet appears in a specified file. The count executable file is represented on the graph as a hexagon because it is a makefile target that is an intermediate file in terms of file dependency relationships.

  5. Makefile targets used for deleting program files from the Builder working directory. The clean option removes intermediate program files.

  6. A makefile target that creates the dependencies of all the sources in the SRCS list from the relative include files. The depend option is represented on the graph by a diamond; it does not depend on other options nor is it a dependency for other options.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.6    Executing a Local Build

There are two types of local build:

To execute a local build:

Step Action
1

Use the Project Manager dialog box to make sure your build directory, makefile, make engine, and build and compile commands are correct. (See Section Section 4.4 for information.)

2

Click on the Make Options field in the Builder main window and enter the options to be used by the make engine that you chose to execute the build.

3

Click on the Target field and specify the Target file. It can be a source file, executable, or object file.

4

Choose Control Distributed Build... from the Execution menu. The Builder displays the Distributed Build Control dialog box.

5

In the Build Execution options box, choose Local Sequential or Local Parallel.

6

If you want to execute a parallel build, click on Max Jobs and specify the maximum number of processes that can be executed at one time. Before you do this, consult your system manager for details of the current workload on the system. You should be careful not to request execution of a large number of jobs in parallel if current system activity is already making high demands on resources.

7

Click on OK in the Distributed Build Control dialog box.

8

Click on the Start Build button. The Builder starts execution of the build process by invoking the make utility you specified.

Note

If you select make to perform the build, the Builder cannot annotate any error messages resulting from the compilation that refer to the relative pathnames of files.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.7    Executing a Distributed Build

A distributed build executes parallel processing of objects at the remote host(s) specified in the host configuration file. To execute a distributed parallel build:

Step Action
1

Use the Project Manager dialog box to make sure your build directory, makefile, make engine, and build and compile commands are correct. (See Section Section 4.4 for information.)

2

Click on the Make Options field in the Builder main window and enter the options to be used by gnumake.

3

Click on the Target field and enter the name of the target for the build. It can be a source file, executable, or object file.

4

You must give the Builder the necessary information about the remote host(s) on which it is to build the target makefile. Likewise, if the local host is to be included in the build, you must specify the relevant configuration.

Choose Edit Host Configuration... from the Execution menu. The Host Configurations dialog box appears, along with the Host Configuration Selection dialog box.

5

Select a file from the list. The Builder loads the data from the file into the dialog box (see Figure Figure 4-4), allowing you to modify the configuration parameters as required. See the online Help for information about how to complete this dialog box.

6

To save the host configuration file with the new settings, pull down the File menu and choose Save. The Builder asks whether you want to to load the newly saved configuration file; to load the file, click on OK. Otherwise, click on Cancel and choose Load Host Configuration... from the Execution menu in the Builder main window. You can then select the host configuration file of your choice.

7

Choose Control Distributed Build... from the Execution menu. The Builder displays the Distributed Build Control dialog box.

8

In the Build Execution options box, choose Distributed Parallel.

9

Click on the Max Jobs field and enter the maximum number of processes that can be executed at one time. Before you do this, consult your system manager for details of the current workload on the system. You should be careful not to request execution of a large number of jobs in parallel if current system activity is already making high demands on resources. In any case, this value is limited at run time to the maximum number of processes that the local host can create.

10

In the Platform options box, choose the target platform on which the build is to be executed. The possible selections are:

        Digital-UNIX_ALPHA
        SPARC.SUNOS
        RS6000.AIX
        PA-RISC.HPUX

Click on OK.

11

In the Execution menu, choose Monitor Distributed Build... to bring up the Build Monitor window. During the course of a distributed build, this window displays information regarding the status of all hosts participating in the build. If there is no current build process, it displays the equivalent information for the most recent build process. The Build Monitor window also displays all system messages resulting from the build.

12

Click on the Start Build button. The Builder starts execution of the build process by invoking gnumake.

13

Repeat steps 10 and 12 for each new target platform.

Note

The Builder executes all makefile commands in the shell. Observe shell syntax rules when entering commands.

Figure 4-4:  Edit Host Configuration Dialog Box


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.8    Generating Static Analysis Data with the Build

The browser tools (Call Graph Browser, Cross-Referencer, and C++ Class Browser) rely on a database that is generated using a set of static analysis data files. The Builder can create the static analysis data files as part of its build process. In order to use any of the browser tools, you must generate the static analysis data files as part of the build.

To generate static analysis data, follow these steps:

  1. Use the Project Manager to specify a data directory. This data directory is the location where FUSE places the directory tree (project_name.data) that contains the database and static analysis data files. If you don't specify a data directory, the working directory will be used.

  2. Use the Project Manager (Browser Tools Settings Category) to specify information about your environment, such as files to ignore during a scan, and whether or not to compress the database. This lets you customize how you want the static analysis database to be populated after the scanning process.

  3. Build your target, including static analysis data.

  4. Open a browser tool, for example, the C++ Class Browser, whose data display relies on the generated database.

See the online Help topic Generating Static Analysis Data as Part of the Build for details on these steps.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.9    Creating a Makefile

The Builder provides support to create a simple makefile. In addition, the Builder provides support to create simple KAP-specific and Motif-specific makefiles. To create a more complex makefile that uses numerous source and data files and even calls in other makefiles, it is advisable to load the basic makefile into a FUSE Editor buffer and enter the instructions manually.

Choose Create Makefile... from the Makefile menu. The Builder displays the Create Makefile dialog box, shown in Figure Figure 4-5. The only fields that you must complete are:

This dialog box has a toggle button that appears only if you brought the dialog box up from the Builder. You can choose to use this newly created makefile as your project makefile.

If you brought the dialog box up from within the Project Manager, the newly created makefile becomes the project makefile by default.

Figure 4-5:  Create Makefile Dialog Box

See the online Help for more information about these and the other fields in the Create Makefile dialog box.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.10    Tailoring Makefiles

The Create Makefile... option offers substantial support for generating a simple makefile, but it assumes certain default states that may be undesirable. The following solutions allow you to personalize your makefile to override these states.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.10.1    Dependencies on System Include Files

Dependencies on system include files (/usr/include/*.h) rarely undergo modification. For this reason, when the Builder processes the depend target of a makefile generated with the Create Makefile... option it automatically excludes these dependencies from the makefile and does not display them in the makefile graph.If you prefer to have dependencies on system include files in the makefile and shown in the graph, remove the following lines from the depend target in the makefile:

@grep -v "\.o[   ]*/usr/include" makedep > makedep1
@mv makedep1 makedep


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.10.2    Dependencies on RCS and SCCS in gnumake

By default, if the gnumake utility is unable to locate specified sources in the working directory, it automatically checks them out of the RCS or SCCS libraries without displaying a message to inform the user that it has done so. This situation may be undesirable for a number of reasons.

To disable the automatic checkout option, enter the following lines in your makefile:

%:: RCS/%,v%:: SCCS/s.%%:: %,v%:: s.%

The effects of this modification are:


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.10.3    Demangling Output from the Linker when Using C++

The C++ language allows you to overload function names. To make these names unique for the linker (ld), the compiler encodes them using a process called mangling. Error output by the linker may include these mangled names. For example, in the following error output from ld, the function init(void) has been mangled into init__Xv:

ld:
Error: Undefined:
init_Xv

To decode these names, you can pipe the error output from the linker through the demangle utility. If you are using the Bourne shell (/bin/sh), the default used by make and gnumake, pipe ld errors through demangle as follows:

$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBRARIES) 2>1 | demangle

If you are using the C shell (/bin/csh), pipe ld errors through demangle as follows:

$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBRARIES) | demangle


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

4.11    Tracking and Correcting Build Errors

All error and warning messages resulting from a build are displayed in the transcript area. The following is an example of some output that could be displayed in the transcript area:

ccom: Warning: count1.c, line 95: illegal combination of
pointer and integer      
      s = i;   
   -------^
ccom: Error: count1.c, line 97: a undefined      
      a = 5;    
   ----^
*** Error code 1

The subsequent interaction between the Builder and the FUSE Editor following completion of a build is consistent with the behavior described in the following scenarios:

The Builder does not detect linker errors, such as unresolved function references that arise when multiple object files are linked to form a single executable file. Check to make sure that objects and libraries are specified correctly in the makefile.


[Contents] [Prev. Chapter] [Prev. Section] [Next Chapter] [Index] [Help]

4.11.1    Navigating and Filtering Porting Assistant Diagnostic Messages

If you perform a build from within the Porting Assistant, the Porting Assistant automatically starts the Builder and displays diagnostic messages in the Builder's transcript area. Use the First, Next, Previous, and Last buttons in the Builder main window to move the transcript window's focus to the appropriate message and display the code associated with the message in the default editor. Choose Filter... on the Builder's Buffer menu to filter out specific diagnostic messages.See Chapter Chapter 17 for additional information about navigating and filtering Porting Assistant diagnostic messages.


[Contents] [Prev. Chapter] [Prev. Section] [Next Chapter] [Index] [Help]