1 .\" Copyright 2012 Google Inc.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions are
8 .\" * Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" * Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" * Neither the name of Google Inc. nor the names of its contributors
14 .\" may be used to endorse or promote products derived from this software
15 .\" without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 .\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 .\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 .\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 .Nd Mechanics of build directories
36 (or object directories, target directories, product directories, etc.) is
37 the concept that allows a developer to keep the source tree clean from
38 build products by asking the build system to place such build products
39 under a separate subtree.
41 Most build systems today support build directories. For example, the GNU
42 Automake/Autoconf build system exposes such concept when invoked as
44 .Bd -literal -offset indent
52 Under such invocation, all the results of the build are left in the
53 .Pa my-project-1.0/build/
54 subdirectory while maintaining the contents of
58 Because build directories are an integral part of most build systems, and
59 because they are a tool that developers use frequently,
61 supports build directories too. This manifests in the form of
63 being able to run tests from build directories while reading the (often
64 immutable) test suite definition from the source tree.
66 One important property of build directories is that they follow (or need to
67 follow) the exact same layout as the source tree. For example, consider
68 the following directory listings:
69 .Bd -literal -offset indent
88 Note how the directory layout within
94 directory contains only source files and the definition of the test suite
95 (the Kyuafiles), while the
97 directory contains only the binaries generated during a build.
99 All commands that deal with the workspace support the
100 .Fl -build-root Ar path
101 option. When this option is provided, the directory specified by the
102 option is considered to be the root of the build directory. For example,
103 considering our previous fake tree layout, we could invoke
105 as any of the following:
106 .Bd -literal -offset indent
107 $ kyua test --kyuafile=src/Kyuafile --build-root=obj
108 $ cd src && kyua test --build-root=../obj