build(1) UNIX Programmer's Manual build(1)
NAME
build- build target(s)
SYNOPSIS
build [-here -info -verbose] [sandbox flags] [make flags]
[targets...]
sandbox flags:
[-sb sandbox] [-rc rc-file] [-sb_rc sb-rc-
file]
FLAGS
-here
Build, clean, lint all of the targets within a subtree
of the source area. When this switch is specified,
targets should be the path to the directory that will
be the root of the subtree to build. For example, a
target of /usr/cs/include would invoke build for all
the files in /usr/cs/include.
-info
Display verbose information about building each target
component, but do not actually invoke make. If -info is
used in conjunction with any other flag, -info takes
precedence and no real work is done.
-verbose
Display verbose information about building each target
component including the syntax of the call to make.
This option can be used in conjunction with -info to
get additional information about what build would do
without actually doing anything, and it can be used in
conjunction with make's -n option to get a listing of
what build would do followed by what make would do,
again, without actually doing anything. For example,
build -verbose -info myfile prints out the environment
build sets up and the command to execute make with; it
then exits before actually calling make. build -verbose
-n myfile prints out the same information plus executes
make with the -n flag. make then prints out what it
would do.
sandbox flags:
-sb sandbox
Name of the sandbox to use if it is not the current
sandbox. If this option is not used, the sandbox will
be determined by the environment variable SANDBOX or,
if that is not set, by the user's default sandbox.
-rc rc-file
Provides the path and name of the user's rc file to use
Printed 1/23/91 5/14/90 1
build(1) UNIX Programmer's Manual build(1)
instead of the default file ${HOME}/.sandboxrc. If
this option is not used, the default rc file will be
used.
-sb_rc sb-rc-file
Provides the path and name of the sandbox's rc file to
use instead of the default file sandbox/rc_files/local.
If this option is not used, the default sandbox's rc
file will be used.
make flags:
build accepts any flag, target, or macro which makes
accepts. build passes these along to make without
changing them.
build is a cover for make, reading the sandbox rc files and
setting the environment to understand backing trees. It
then calls make to do the actual "building."
DESCRIPTION
build uses information from the command line and the
sandbox's rc files to create the environment make needs to
"build" its targets. The output of build is literally a
string containing the make command and the targets to
create. build also includes in this string any options
which it does not understand, assuming the options are meant
for make. A target can be anything the Makefiles understand
how to "build." It is frequently the name of the built
object, for example, foo would normally be the target to
create the executable foo from foo.c. However, a target may
need to be resolved or expanded when it corresponds to a
directory name containing multiple files or targets to be
built. Hence, targets may be explicit, individual files or
subdirectories containing multiple targets.
As a simple example, "build foo" (read as "build target
foo") is a single file and might translate into the string
"make -cF _build_prefix_foo" which make executes with the
target "_build_prefix_foo" interpreted through one of the
common makefiles. Build will resolve "target foo" into its
component targets should any exist. Next, for each target,
build decides on a per-target basis what information should
be passed to make. For example if build is given the line:
build foo.lint
build will interpret "foo.lint" to mean lint the target foo,
and it will pass this information to make.
build defines the variables that make uses to determine
where targets are located. For example, build sets the
variable SOURCEDIR so searches for source begin in the local
Printed 1/23/91 5/14/90 2
build(1) UNIX Programmer's Manual build(1)
sandbox and continue through each backing tree. It uses the
sandbox's rc files to determine this information.
build obviously understands how to translate targets the
user enters into the format understood by the common
makefiles. build uses a consistent set of rules to do this
translation.
build will not invoke make and will report an error if
information from the rc files, the command line, or the
current environment is inconsistent.
EXAMPLES
Building an explicit target which creates a single object
file; to create the binary "foo" from "foo.c":
build foo
Building a subdirectory which creates multiple object files;
to create the binaries "foo", "bar", and "fred" from the
sources "foo.c", "bar.c", and "fred.c" which are in the
directory "/usr/bin/foobar":
from a workon to the directory "/usr/bin"
build foobar
Building include file "sys.h"
build sys.h
All this target in the Makefile currently does is copy the
source header file into the object directory.
List verbose information about the compile:
build C_ARGS=-v foo
Building a file with the debug option instead of the optim-
ize option:
build OPT_LEVEL=-g foo
FILES
build reads information from the sandbox rc files to define
environment variables and determine the base paths to where
source files are located. The -verbose or -info will expli-
citly list the environment variables and how they are set.
Files are first looked for in the current sandbox, which may
be resolved through links, and next in the backing tree.
${HOME}/.sandboxrc
rc file that specifies default sandbox and paths to
each sandbox
Printed 1/23/91 5/14/90 3
build(1) UNIX Programmer's Manual build(1)
/sandbox/rc_files/local
the primary sandbox rc file with environment informa-
tion
/sandbox/rc_files/shared
included in /sandbox/rc_files/local, this sandbox rc
file has additional environment information and the
link to the backing tree's rc files.
EXIT VALUES
build exits with "0" if successful; non-zero otherwise. If
build gets as far as calling make, it will return the same
value as make.
RELATED INFORMATION
make(1), sandbox(7), sandboxrc(5), sbinfo(1).
Printed 1/23/91 5/14/90 4