1*6b3a42afSjmmv.\" Copyright 2012 Google Inc. 2*6b3a42afSjmmv.\" All rights reserved. 3*6b3a42afSjmmv.\" 4*6b3a42afSjmmv.\" Redistribution and use in source and binary forms, with or without 5*6b3a42afSjmmv.\" modification, are permitted provided that the following conditions are 6*6b3a42afSjmmv.\" met: 7*6b3a42afSjmmv.\" 8*6b3a42afSjmmv.\" * Redistributions of source code must retain the above copyright 9*6b3a42afSjmmv.\" notice, this list of conditions and the following disclaimer. 10*6b3a42afSjmmv.\" * Redistributions in binary form must reproduce the above copyright 11*6b3a42afSjmmv.\" notice, this list of conditions and the following disclaimer in the 12*6b3a42afSjmmv.\" documentation and/or other materials provided with the distribution. 13*6b3a42afSjmmv.\" * Neither the name of Google Inc. nor the names of its contributors 14*6b3a42afSjmmv.\" may be used to endorse or promote products derived from this software 15*6b3a42afSjmmv.\" without specific prior written permission. 16*6b3a42afSjmmv.\" 17*6b3a42afSjmmv.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18*6b3a42afSjmmv.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19*6b3a42afSjmmv.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20*6b3a42afSjmmv.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21*6b3a42afSjmmv.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22*6b3a42afSjmmv.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23*6b3a42afSjmmv.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24*6b3a42afSjmmv.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25*6b3a42afSjmmv.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26*6b3a42afSjmmv.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27*6b3a42afSjmmv.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28*6b3a42afSjmmv.Dd September 9, 2012 29*6b3a42afSjmmv.Dt KYUA-BUILD-ROOT 7 30*6b3a42afSjmmv.Os 31*6b3a42afSjmmv.Sh NAME 32*6b3a42afSjmmv.Nm build-root 33*6b3a42afSjmmv.Nd Mechanics of build directories 34*6b3a42afSjmmv.Sh DESCRIPTION 35*6b3a42afSjmmv.Em Build directories 36*6b3a42afSjmmv(or object directories, target directories, product directories, etc.) is 37*6b3a42afSjmmvthe concept that allows a developer to keep the source tree clean from 38*6b3a42afSjmmvbuild products by asking the build system to place such build products 39*6b3a42afSjmmvunder a separate subtree. 40*6b3a42afSjmmv.Pp 41*6b3a42afSjmmvMost build systems today support build directories. For example, the GNU 42*6b3a42afSjmmvAutomake/Autoconf build system exposes such concept when invoked as 43*6b3a42afSjmmvfollows: 44*6b3a42afSjmmv.Bd -literal -offset indent 45*6b3a42afSjmmv$ cd my-project-1.0 46*6b3a42afSjmmv$ mkdir build 47*6b3a42afSjmmv$ cd build 48*6b3a42afSjmmv$ ../configure 49*6b3a42afSjmmv$ make 50*6b3a42afSjmmv.Ed 51*6b3a42afSjmmv.Pp 52*6b3a42afSjmmvUnder such invocation, all the results of the build are left in the 53*6b3a42afSjmmv.Pa my-project-1.0/build/ 54*6b3a42afSjmmvsubdirectory while maintaining the contents of 55*6b3a42afSjmmv.Pa my-project-1.0/ 56*6b3a42afSjmmvintact. 57*6b3a42afSjmmv.Pp 58*6b3a42afSjmmvBecause build directories are an integral part of most build systems, and 59*6b3a42afSjmmvbecause they are a tool that developers use frequently, 60*6b3a42afSjmmv.Xr kyua 1 61*6b3a42afSjmmvsupports build directories too. This manifests in the form of 62*6b3a42afSjmmv.Xr kyua 1 63*6b3a42afSjmmvbeing able to run tests from build directories while reading the (often 64*6b3a42afSjmmvimmutable) test suite definition from the source tree. 65*6b3a42afSjmmv.Pp 66*6b3a42afSjmmvOne important property of build directories is that they follow (or need to 67*6b3a42afSjmmvfollow) the exact same layout as the source tree. For example, consider 68*6b3a42afSjmmvthe following directory listings: 69*6b3a42afSjmmv.Bd -literal -offset indent 70*6b3a42afSjmmvsrc/Kyuafile 71*6b3a42afSjmmvsrc/bin/ls/ 72*6b3a42afSjmmvsrc/bin/ls/Kyuafile 73*6b3a42afSjmmvsrc/bin/ls/ls.c 74*6b3a42afSjmmvsrc/bin/ls/ls_test.c 75*6b3a42afSjmmvsrc/sbin/su/ 76*6b3a42afSjmmvsrc/sbin/su/Kyuafile 77*6b3a42afSjmmvsrc/sbin/su/su.c 78*6b3a42afSjmmvsrc/sbin/su/su_test.c 79*6b3a42afSjmmv 80*6b3a42afSjmmvobj/bin/ls/ 81*6b3a42afSjmmvobj/bin/ls/ls* 82*6b3a42afSjmmvobj/bin/ls/ls_test* 83*6b3a42afSjmmvobj/sbin/su/ 84*6b3a42afSjmmvobj/sbin/su/su* 85*6b3a42afSjmmvobj/sbin/su/su_test* 86*6b3a42afSjmmv.Ed 87*6b3a42afSjmmv.Pp 88*6b3a42afSjmmvNote how the directory layout within 89*6b3a42afSjmmv.Pa src/ 90*6b3a42afSjmmvmatches that of 91*6b3a42afSjmmv.Pa obj/ . 92*6b3a42afSjmmvThe 93*6b3a42afSjmmv.Pa src/ 94*6b3a42afSjmmvdirectory contains only source files and the definition of the test suite 95*6b3a42afSjmmv(the Kyuafiles), while the 96*6b3a42afSjmmv.Pa obj/ 97*6b3a42afSjmmvdirectory contains only the binaries generated during a build. 98*6b3a42afSjmmv.Pp 99*6b3a42afSjmmvAll commands that deal with the workspace support the 100*6b3a42afSjmmv.Fl -build-root Ar path 101*6b3a42afSjmmvoption. When this option is provided, the directory specified by the 102*6b3a42afSjmmvoption is considered to be the root of the build directory. For example, 103*6b3a42afSjmmvconsidering our previous fake tree layout, we could invoke 104*6b3a42afSjmmv.Xr kyua-test 1 105*6b3a42afSjmmvas any of the following: 106*6b3a42afSjmmv.Bd -literal -offset indent 107*6b3a42afSjmmv$ kyua test --kyuafile=src/Kyuafile --build-root=obj 108*6b3a42afSjmmv$ cd src && kyua test --build-root=../obj 109*6b3a42afSjmmv.Ed 110*6b3a42afSjmmv.Sh SEE ALSO 111*6b3a42afSjmmv.Xr kyua 1 , 112*6b3a42afSjmmv.Xr kyua-debug 1 , 113*6b3a42afSjmmv.Xr kyua-list 1 , 114*6b3a42afSjmmv.Xr kyua-test 1 115