1.\" Copyright 2012 Google Inc. 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.Dd September 9, 2012 29.Dt KYUA-BUILD-ROOT 7 30.Os 31.Sh NAME 32.Nm build-root 33.Nd Mechanics of build directories 34.Sh DESCRIPTION 35.Em Build directories 36(or object directories, target directories, product directories, etc.) is 37the concept that allows a developer to keep the source tree clean from 38build products by asking the build system to place such build products 39under a separate subtree. 40.Pp 41Most build systems today support build directories. For example, the GNU 42Automake/Autoconf build system exposes such concept when invoked as 43follows: 44.Bd -literal -offset indent 45$ cd my-project-1.0 46$ mkdir build 47$ cd build 48$ ../configure 49$ make 50.Ed 51.Pp 52Under such invocation, all the results of the build are left in the 53.Pa my-project-1.0/build/ 54subdirectory while maintaining the contents of 55.Pa my-project-1.0/ 56intact. 57.Pp 58Because build directories are an integral part of most build systems, and 59because they are a tool that developers use frequently, 60.Xr kyua 1 61supports build directories too. This manifests in the form of 62.Xr kyua 1 63being able to run tests from build directories while reading the (often 64immutable) test suite definition from the source tree. 65.Pp 66One important property of build directories is that they follow (or need to 67follow) the exact same layout as the source tree. For example, consider 68the following directory listings: 69.Bd -literal -offset indent 70src/Kyuafile 71src/bin/ls/ 72src/bin/ls/Kyuafile 73src/bin/ls/ls.c 74src/bin/ls/ls_test.c 75src/sbin/su/ 76src/sbin/su/Kyuafile 77src/sbin/su/su.c 78src/sbin/su/su_test.c 79 80obj/bin/ls/ 81obj/bin/ls/ls* 82obj/bin/ls/ls_test* 83obj/sbin/su/ 84obj/sbin/su/su* 85obj/sbin/su/su_test* 86.Ed 87.Pp 88Note how the directory layout within 89.Pa src/ 90matches that of 91.Pa obj/ . 92The 93.Pa src/ 94directory contains only source files and the definition of the test suite 95(the Kyuafiles), while the 96.Pa obj/ 97directory contains only the binaries generated during a build. 98.Pp 99All commands that deal with the workspace support the 100.Fl -build-root Ar path 101option. When this option is provided, the directory specified by the 102option is considered to be the root of the build directory. For example, 103considering our previous fake tree layout, we could invoke 104.Xr kyua-test 1 105as 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 109.Ed 110.Sh SEE ALSO 111.Xr kyua 1 , 112.Xr kyua-debug 1 , 113.Xr kyua-list 1 , 114.Xr kyua-test 1 115