You can create a static analysis database
for a FUSE project without starting FUSE by using the
-xref
target
option to the
fuse
command.
For example, you might want to create a static analysis database for a large program that can take an hour or more to process. You can create the database overnight and it will be ready for you when you start FUSE the next day.
This appendix describes how to create a static analysis database outside a FUSE session. See Chapter Chapter 11 for information about creating a static analysis database inside a FUSE session.
You must have an existing FUSE project before you attempt to create the database. Follow the steps below for a project named TicTacToe:
Start FUSE, create your project,
and save it.
Be sure to remember the project name and the project's
data directory name.
(If you don't specify a data directory, FUSE
uses the working directory as the data directory.) For TicTacToe,
assume that your data directory is
/usr/users/foo/data
.
Set the environment variable
FUSE_PROJ_ROOT_DATA_DIR
to point to the static analysis data directory.
The static analysis
data directory is a directory tree created by FUSE in the data directory.
This directory tree is named
project_name.data
.
For TicTacToe, the static analysis data directory is
/usr/users/foo/data/TicTacToe.data
.
Modify calls to compilers in your build scripts
and makefiles to call the FUSE wrapper routines.
FUSE normally
installs in
/usr/opt
, so the wrapper routines
will be found in
/usr/opt/FUS400/bin
for FUSE
Version 4.0.
The wrapper routines used for various compilers are:
C:
fuse_cc
C++:
fuse_cxx
Fortran 90:
fuse_f90
Fortran 77:
fuse_f77
Pascal:
fuse_pc
Cobol:
fuse_cobol
/usr/local/bin/gcc
,
then you should change this macro to the following:
CC = /usr/opt/FUS400/bin/fuse_cc /usr/local/bin/gcc
If you use build scripts and the calls to the compilers are hard-coded, you need to replace these calls and set environment variables.
Run your build.
The wrapper routines will take
care of generating the static analysis data you need and placing
it in your static analysis data directory (for this project,
/usr/users/foo/data/TicTacToe.data
).
Invoke FUSE using the following command:
fuse
-xref static_analysis_data_dir
, where
static_analysis_data_dir
is the name of the static analysis data directory (for this project,
/usr/users/foo/data/TicTacToe.data
).
The static
analysis database will be created for you.
Now you can start FUSE and open the project TicTacToe. Any browser tool you bring up (C++ Class Browser, Call Graph Browser, or Cross-Referencer) will use the static analysis database you created.