]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/kyua/doc/build-root.mdoc
bhnd(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / contrib / kyua / doc / build-root.mdoc
1 .\" Copyright 2012 The Kyua Authors.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions are
6 .\" met:
7 .\"
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.
16 .\"
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.
28 .Em Build directories
29 (or object directories, target directories, product directories, etc.) is
30 the concept that allows a developer to keep the source tree clean from
31 build products by asking the build system to place such build products
32 under a separate subtree.
33 .Pp
34 Most build systems today support build directories.
35 For example, the GNU Automake/Autoconf build system exposes such concept when
36 invoked as follows:
37 .Bd -literal -offset indent
38 $ cd my-project-1.0
39 $ mkdir build
40 $ cd build
41 $ ../configure
42 $ make
43 .Ed
44 .Pp
45 Under such invocation, all the results of the build are left in the
46 .Pa my-project-1.0/build/
47 subdirectory while maintaining the contents of
48 .Pa my-project-1.0/
49 intact.
50 .Pp
51 Because build directories are an integral part of most build systems, and
52 because they are a tool that developers use frequently,
53 .Nm
54 supports build directories too.
55 This manifests in the form of
56 .Nm
57 being able to run tests from build directories while reading the (often
58 immutable) test suite definition from the source tree.
59 .Pp
60 One important property of build directories is that they follow (or need to
61 follow) the exact same layout as the source tree.
62 For example, consider the following directory listings:
63 .Bd -literal -offset indent
64 src/Kyuafile
65 src/bin/ls/
66 src/bin/ls/Kyuafile
67 src/bin/ls/ls.c
68 src/bin/ls/ls_test.c
69 src/sbin/su/
70 src/sbin/su/Kyuafile
71 src/sbin/su/su.c
72 src/sbin/su/su_test.c
73
74 obj/bin/ls/
75 obj/bin/ls/ls*
76 obj/bin/ls/ls_test*
77 obj/sbin/su/
78 obj/sbin/su/su*
79 obj/sbin/su/su_test*
80 .Ed
81 .Pp
82 Note how the directory layout within
83 .Pa src/
84 matches that of
85 .Pa obj/ .
86 The
87 .Pa src/
88 directory contains only source files and the definition of the test suite
89 (the Kyuafiles), while the
90 .Pa obj/
91 directory contains only the binaries generated during a build.
92 .Pp
93 All commands that deal with the workspace support the
94 .Fl -build-root Ar path
95 option.
96 When this option is provided, the directory specified by the
97 option is considered to be the root of the build directory.
98 For example, considering our previous fake tree layout, we could invoke
99 .Nm
100 as any of the following:
101 .Bd -literal -offset indent
102 $ kyua __COMMAND__ --kyuafile=src/Kyuafile --build-root=obj
103 $ cd src && kyua __COMMAND__ --build-root=../obj
104 .Ed