xref is a simple tool for building and maintaining source cross-references for subtrees of a workspace. By default, xref builds cscope-fast, ctags, and etags (if available; see NOTES) source cross-references for all of the eligible files underneath each named subtree, plus any additional eligible files reported by flg.flp(1). File eligibility is determined by pattern matching -- by default, files matching the following patterns are eligible: *.[Ccshlxy] Makefile* *.il* *.cc *.adb llib-* However, this default behavior can be changed, either through command-line options or by setting the cross-reference customization macros (see CUSTOMIZATION MACROS) in the Makefile rooted at each specified subtree.
Any number of subtrees can be specified; if no subtrees are specified, then the current working directory is assumed. Relative subtrees are assumed to be relative to the current working directory.
10 -c Clobber (rather than build) cross-references.
10 -f Do not use flg.flp(1) to locate additional related files. This option is ignored if -c is specified.
-m makefile Use the customization macros specified in makefile when building the cross-reference, rather than those in Makefile. If no Makefile exists or no customizations are desired, then /dev/null may be used.
10 -p Remove any proto-area include directories from the include path list when building the cross-reference. This is chiefly useful when the built cross-reference will be shared with others that either cannot or should not access the proto areas associated with the workspace used to construct the cross-reference. This option is ignored if -c is specified.
10 -x cscope|tags|etags Operate on only the specified cross-references. More than one cross-reference can be operated on by specifying a comma-separated list (see EXAMPLES). By default, all supported cross-references are operated on.
XRDIRS The list of directories to build the cross-reference over; defaults to `.'. Directories containing source files most likely to be of interest to those using the cross-reference should be listed earlier.
XRPRUNE The list of directories to prune out.
XRADD The list of additional filename patterns to include.
XRDEL The list of additional filename patterns to exclude.
XRINCDIRS The list of additional include paths, in "foo bar" format.
XRINCS The list of additional include paths, in "-Ifoo -Ibar" format.
$ xref
Build cscope-fast, ctags, and etags cross-references for $SRC/cmd/agents:
Build just the cscope-fast cross-reference for $SRC, and do not use flg.flp(1) (since there are no additional source files to find):
$ xref -f -x cscope $SRC
Build just the standard cscope cross-reference for $SRC/uts:
$ CSCOPE=cscope CSFLAGS=-b xref -x cscope $SRC/uts
Build a cscope database containing just the ZFS source:
$ cd $SRC $ cat > /tmp/zfs.mk XRDIRS=uts/common/fs/zfs common/zfs lib/libzfs cmd/zfs cmd/zpool$ xref -f -x cscope -m /tmp/zfs.mk
make(1), bringover(1), flg.flp(1)
The ETAGS environment variable can be used to specify an alternate path to the etags utility. For instance, to use the one packaged with Sun Freeware, set ETAGS to /opt/sfw/bin/etags prior to invoking xref.