summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2012-10-22 01:18:41 +0000
committermarcel <marcel@FreeBSD.org>2012-10-22 01:18:41 +0000
commit8412efbea82a893c704af85b8b51e68d1fdc217c (patch)
tree7dfa45acec5e77f85aeea486243e3989c98529c5
parent6731953527d251334ba5f2b979c2eb86dccdf755 (diff)
downloadFreeBSD-src-8412efbea82a893c704af85b8b51e68d1fdc217c.zip
FreeBSD-src-8412efbea82a893c704af85b8b51e68d1fdc217c.tar.gz
Add ATF to the build. This is may be a bit rought around the egdes,
but committing it helps to get everyone on the same page and makes sure we make progress. Tinderbox breakages that are the result of this commit are entirely the committer's fault -- in other words: buildworld testing on amd64 only. Credits follow: Submitted by: Garrett Cooper <yanegomi@gmail.com> Sponsored by: Isilon Systems Based on work by: keramida@ Thanks to: gnn@, mdf@, mlaier@, sjg@ Special thanks to: keramida@
-rw-r--r--Makefile.inc15
-rw-r--r--etc/Makefile3
-rw-r--r--etc/atf/FreeBSD.conf12
-rw-r--r--etc/atf/Makefile39
-rw-r--r--etc/atf/common.conf12
-rw-r--r--etc/group1
-rw-r--r--etc/master.passwd1
-rw-r--r--etc/mtree/BSD.include.dist4
-rw-r--r--etc/mtree/BSD.root.dist2
-rw-r--r--etc/mtree/BSD.usr.dist16
-rw-r--r--lib/Makefile5
-rw-r--r--lib/atf/Makefile36
-rw-r--r--lib/atf/Makefile.inc54
-rw-r--r--lib/atf/libatf-c++/Makefile74
-rw-r--r--lib/atf/libatf-c/Makefile76
-rw-r--r--libexec/Makefile7
-rw-r--r--libexec/atf/Makefile30
-rw-r--r--libexec/atf/Makefile.inc32
-rw-r--r--libexec/atf/atf-check/Makefile45
-rw-r--r--share/Makefile9
-rw-r--r--share/atf/Makefile37
-rw-r--r--share/doc/Makefile15
-rw-r--r--share/doc/atf/Makefile39
-rw-r--r--share/examples/Makefile3
-rw-r--r--share/examples/atf/Makefile39
-rw-r--r--share/man/man1/Makefile8
-rw-r--r--share/man/man4/Makefile7
-rw-r--r--share/man/man5/Makefile7
-rw-r--r--share/man/man7/Makefile15
-rw-r--r--share/mk/bsd.libnames.mk2
-rw-r--r--share/mk/bsd.own.mk1
-rw-r--r--share/mk/bsd.progs.mk350
-rw-r--r--share/xml/Makefile36
-rw-r--r--share/xml/Makefile.inc30
-rw-r--r--share/xml/atf/Makefile39
-rw-r--r--share/xsl/Makefile36
-rw-r--r--share/xsl/Makefile.inc30
-rw-r--r--share/xsl/atf/Makefile39
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc71
-rw-r--r--tools/build/options/WITHOUT_ATF2
-rw-r--r--usr.bin/Makefile5
-rw-r--r--usr.bin/atf/Makefile34
-rw-r--r--usr.bin/atf/Makefile.inc8
-rw-r--r--usr.bin/atf/atf-config/Makefile42
-rw-r--r--usr.bin/atf/atf-report/Makefile42
-rw-r--r--usr.bin/atf/atf-run/Makefile44
-rw-r--r--usr.bin/atf/atf-sh/Makefile47
-rw-r--r--usr.bin/atf/atf-version/Makefile52
48 files changed, 1540 insertions, 3 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index ef8b192..81bb6bc 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1285,6 +1285,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
${_kerberos5_lib_libroken} \
${_kerberos5_lib_libwind} \
+ ${_lib_atf_libatf_c} \
lib/libbz2 ${_libcom_err} lib/libcrypt \
lib/libexpat \
${_lib_libgssapi} ${_lib_libipx} \
@@ -1297,6 +1298,10 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_secure_lib_libcrypto} ${_secure_lib_libssh} \
${_secure_lib_libssl}
+.if ${MK_ATF} != "no"
+_lib_atf_libatf_c= lib/atf/libatf-c
+.endif
+
.if ${MK_LIBTHR} != "no"
_lib_libthr= lib/libthr
.endif
diff --git a/etc/Makefile b/etc/Makefile
index 48124b9..bbb5018 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -198,6 +198,9 @@ distribution:
.endif
pwd_mkdb ${PWD_MKDB_ENDIAN} -i -p -d ${DESTDIR}/etc \
${DESTDIR}/etc/master.passwd
+.if ${MK_ATF} != "no"
+ ${_+_}cd ${.CURDIR}/atf; ${MAKE} install
+.endif
.if ${MK_BLUETOOTH} != "no"
${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
.endif
diff --git a/etc/atf/FreeBSD.conf b/etc/atf/FreeBSD.conf
new file mode 100644
index 0000000..23c1fa1
--- /dev/null
+++ b/etc/atf/FreeBSD.conf
@@ -0,0 +1,12 @@
+# $FreeBSD$
+Content-Type: application/X-atf-config; version="1"
+
+#
+# Configuration file for the FreeBSD test suite.
+#
+# See atf-formats(5) for details on the syntax of this file and tests(7) for
+# details on the FreeBSD test suite.
+#
+
+#variable1 = value1
+#variable2 = value2
diff --git a/etc/atf/Makefile b/etc/atf/Makefile
new file mode 100644
index 0000000..5eaa830
--- /dev/null
+++ b/etc/atf/Makefile
@@ -0,0 +1,39 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../contrib/atf
+
+.PATH: ${ATF}/atf-run/sample
+
+NO_OBJ=
+
+FILESGROUPS= ETC
+
+ETCDIR= /etc/atf
+ETC= FreeBSD.conf atf-run.hooks common.conf
+
+.include <bsd.prog.mk>
diff --git a/etc/atf/common.conf b/etc/atf/common.conf
new file mode 100644
index 0000000..2ac08da
--- /dev/null
+++ b/etc/atf/common.conf
@@ -0,0 +1,12 @@
+# $FreeBSD$
+Content-Type: application/X-atf-config; version="1"
+
+#
+# Sample configuration file for properties affecting all test suites.
+#
+
+# When running the test suite as root, some tests require to switch to
+# an unprivileged user to perform extra checks. Set this variable to
+# the user you want to use in those cases. If not set, those tests will
+# be skipped.
+unprivileged-user = "_atf"
diff --git a/etc/group b/etc/group
index 54d5c59..79e5360 100644
--- a/etc/group
+++ b/etc/group
@@ -16,6 +16,7 @@ staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
+_atf:*:27:
guest:*:31:
bind:*:53:
proxy:*:62:
diff --git a/etc/master.passwd b/etc/master.passwd
index 02163ef..4e1d113 100644
--- a/etc/master.passwd
+++ b/etc/master.passwd
@@ -13,6 +13,7 @@ man:*:9:9::0:0:Mister Man Pages:/usr/share/man:/usr/sbin/nologin
sshd:*:22:22::0:0:Secure Shell Daemon:/var/empty:/usr/sbin/nologin
smmsp:*:25:25::0:0:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin
mailnull:*:26:26::0:0:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin
+_atf:*:27:27::0:0:& pseudo-user:/nonexistent:/usr/sbin/nologin
bind:*:53:53::0:0:Bind Sandbox:/:/usr/sbin/nologin
proxy:*:62:62::0:0:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin
_pflogd:*:64:64::0:0:pflogd privsep user:/var/empty:/usr/sbin/nologin
diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist
index 81f0e5b..4a4deee 100644
--- a/etc/mtree/BSD.include.dist
+++ b/etc/mtree/BSD.include.dist
@@ -9,6 +9,10 @@
..
arpa
..
+ atf-c
+ ..
+ atf-c++
+ ..
bsm
..
bsnmp
diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist
index a6cba24..352ac21 100644
--- a/etc/mtree/BSD.root.dist
+++ b/etc/mtree/BSD.root.dist
@@ -24,6 +24,8 @@
etc
X11
..
+ atf
+ ..
bluetooth
..
defaults
diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist
index 9ff82d5..336d055 100644
--- a/etc/mtree/BSD.usr.dist
+++ b/etc/mtree/BSD.usr.dist
@@ -58,6 +58,8 @@
sbin
..
share
+ atf
+ ..
calendar
de_DE.ISO8859-1
..
@@ -77,6 +79,8 @@
doc
IPv6
..
+ atf
+ ..
atm
..
bind9
@@ -211,6 +215,8 @@
..
IPv6
..
+ atf
+ ..
bootforth
..
csh
@@ -1324,6 +1330,14 @@
catalog
..
..
+ xml
+ atf
+ ..
+ ..
+ xsl
+ atf
+ ..
+ ..
zoneinfo
Africa
..
@@ -1361,4 +1375,6 @@
..
src nochange
..
+ tests
+ ..
..
diff --git a/lib/Makefile b/lib/Makefile
index 09a9bc4..199e08b 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -118,6 +118,7 @@ SUBDIR= ${SUBDIR_ORDERED} \
libwrap \
liby \
libz \
+ ${_atf} \
${_bind} \
${_clang}
@@ -133,6 +134,10 @@ _csu=csu
# NB: keep these sorted by MK_* knobs
+.if ${MK_ATF} != "no"
+_atf= atf
+.endif
+
.if ${MK_ATM} != "no"
_libngatm= libngatm
.endif
diff --git a/lib/atf/Makefile b/lib/atf/Makefile
new file mode 100644
index 0000000..0da9aa8
--- /dev/null
+++ b/lib/atf/Makefile
@@ -0,0 +1,36 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+SUBDIR= \
+ libatf-c \
+ libatf-c++
+
+.ORDER: ${SUBDIR}
+
+.include <bsd.subdir.mk>
diff --git a/lib/atf/Makefile.inc b/lib/atf/Makefile.inc
new file mode 100644
index 0000000..937187a
--- /dev/null
+++ b/lib/atf/Makefile.inc
@@ -0,0 +1,54 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../../contrib/atf
+
+_CFLAGS:= ${CFLAGS}
+_CPPFLAGS:= ${CPPFLAGS}
+_CXXFLAGS:= ${CXXFLAGS}
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -DATF_ARCH='"${MACHINE}"'
+CFLAGS+= -DATF_BUILD_CC='"${CC}"'
+CFLAGS+= -DATF_BUILD_CFLAGS='"${_CFLAGS}"'
+CFLAGS+= -DATF_BUILD_CPP='"${CPP}"'
+CFLAGS+= -DATF_BUILD_CPPFLAGS='"${_CPPFLAGS}"'
+CFLAGS+= -DATF_BUILD_CXX='"${CXX}"'
+CFLAGS+= -DATF_BUILD_CXXFLAGS='"${_CXXFLAGS}"'
+CFLAGS+= -DATF_CONFDIR='"${CONFDIR}/atf"'
+CFLAGS+= -DATF_INCLUDEDIR='"${INCLUDEDIR}"'
+CFLAGS+= -DATF_LIBDIR='"${LIBDIR}"'
+CFLAGS+= -DATF_LIBEXECDIR='"${LIBEXECDIR}"'
+CFLAGS+= -DATF_MACHINE='"${MACHINE_ARCH}"'
+CFLAGS+= -DATF_M4='"/usr/bin/m4"'
+CFLAGS+= -DATF_PKGDATADIR='"${SHAREDIR}/atf"'
+CFLAGS+= -DATF_SHELL='"/bin/sh"'
+CFLAGS+= -DATF_WORKDIR='"/tmp"'
+
+WARNS?= 3
+
+# vim: syntax=make
diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile
new file mode 100644
index 0000000..71369e2
--- /dev/null
+++ b/lib/atf/libatf-c++/Makefile
@@ -0,0 +1,74 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+LIB= atf-c++
+SHLIB_MAJOR= 1
+
+# libatf-c++ depends on the C version of the ATF library to build.
+DPADD= ${LIBATFC}
+LDADD= -L${.OBJDIR}/../libatf-c -latf-c
+
+.PATH: ${ATF}
+.PATH: ${ATF}/atf-c++
+.PATH: ${ATF}/atf-c++/detail
+
+CFLAGS+= -I${ATF}
+CFLAGS+= -I${.CURDIR}/../libatf-c
+CFLAGS+= -I.
+
+CFLAGS+= -DHAVE_CONFIG_H
+
+SRCS= application.cpp \
+ build.cpp \
+ check.cpp \
+ config.cpp \
+ env.cpp \
+ exceptions.cpp \
+ expand.cpp \
+ fs.cpp \
+ parser.cpp \
+ process.cpp \
+ tests.cpp \
+ text.cpp \
+ ui.cpp
+
+INCS= build.hpp \
+ check.hpp \
+ config.hpp \
+ macros.hpp \
+ tests.hpp \
+ utils.hpp
+INCSDIR= ${INCLUDEDIR}/atf-c++
+
+INCS+= atf-c++.hpp
+INCSDIR_atf-c++.hpp= ${INCLUDEDIR}
+
+MAN= atf-c++-api.3
+
+.include <bsd.lib.mk>
diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile
new file mode 100644
index 0000000..26fba5c
--- /dev/null
+++ b/lib/atf/libatf-c/Makefile
@@ -0,0 +1,76 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+LIB= atf-c
+SHLIB_MAJOR= 1
+
+.PATH: ${ATF}
+.PATH: ${ATF}/atf-c
+.PATH: ${ATF}/atf-c/detail
+
+CFLAGS+= -I${ATF}
+CFLAGS+= -I${.CURDIR}
+CFLAGS+= -I.
+
+SRCS= build.c \
+ check.c \
+ config.c \
+ dynstr.c \
+ env.c \
+ error.c \
+ fs.c \
+ list.c \
+ map.c \
+ process.c \
+ sanity.c \
+ text.c \
+ user.c \
+ utils.c \
+ tc.c \
+ tp.c \
+ tp_main.c
+
+INCS= build.h \
+ check.h \
+ config.h \
+ defs.h \
+ error.h \
+ error_fwd.h \
+ macros.h \
+ tc.h \
+ tp.h \
+ utils.h
+INCSDIR= ${INCLUDEDIR}/atf-c
+
+INCS+= atf-c.h
+INCSDIR_atf-c.h= ${INCLUDEDIR}
+
+MAN= atf-c-api.3
+
+.include <bsd.lib.mk>
diff --git a/libexec/Makefile b/libexec/Makefile
index 78953b4..0b9c961 100644
--- a/libexec/Makefile
+++ b/libexec/Makefile
@@ -3,7 +3,8 @@
.include <bsd.own.mk>
-SUBDIR= ${_atrun} \
+SUBDIR= ${_atf} \
+ ${_atrun} \
bootpd \
${_comsat} \
fingerd \
@@ -32,6 +33,10 @@ SUBDIR= ${_atrun} \
ulog-helper \
${_ypxfr}
+.if ${MK_ATF} != "no"
+_atf= atf
+.endif
+
.if ${MK_AT} != "no"
_atrun= atrun
.endif
diff --git a/libexec/atf/Makefile b/libexec/atf/Makefile
new file mode 100644
index 0000000..dc222c3
--- /dev/null
+++ b/libexec/atf/Makefile
@@ -0,0 +1,30 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+SUBDIR= atf-check
+
+.include <bsd.subdir.mk>
diff --git a/libexec/atf/Makefile.inc b/libexec/atf/Makefile.inc
new file mode 100644
index 0000000..a28f546
--- /dev/null
+++ b/libexec/atf/Makefile.inc
@@ -0,0 +1,32 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ATF = ${.CURDIR}/../../../contrib/atf
+
+CFLAGS+= -DHAVE_CONFIG_H
+
+WARNS?= 3
diff --git a/libexec/atf/atf-check/Makefile b/libexec/atf/atf-check/Makefile
new file mode 100644
index 0000000..fafb1e4
--- /dev/null
+++ b/libexec/atf/atf-check/Makefile
@@ -0,0 +1,45 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-sh
+
+BINDIR= /usr/libexec
+PROG_CXX= atf-check
+SRCS= atf-check.cpp
+MAN= atf-check.1
+
+CFLAGS+= -I${ATF}
+
+DPADD+= ${LIBATF_CXX} ${LIBATF_C}
+
+LDFLAGS+= -L${.OBJDIR}/../../../lib/atf/libatf-c++
+LDFLAGS+= -L${.OBJDIR}/../../../lib/atf/libatf-c
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
diff --git a/share/Makefile b/share/Makefile
index e39da7f..075f116 100644
--- a/share/Makefile
+++ b/share/Makefile
@@ -5,7 +5,8 @@
# Do not include `info' in the SUBDIR list, it is handled separately.
-SUBDIR= ${_colldef} \
+SUBDIR= ${_atf} \
+ ${_colldef} \
${_dict} \
${_doc} \
dtrace \
@@ -26,10 +27,16 @@ SUBDIR= ${_colldef} \
tabset \
termcap \
${_timedef} \
+ xml \
+ xsl \
${_zoneinfo}
# NB: keep these sorted by MK_* knobs
+.if ${MK_ATF} != "no"
+_atf= atf
+.endif
+
.if ${MK_BSNMP} != "no"
_snmp= snmp
.endif
diff --git a/share/atf/Makefile b/share/atf/Makefile
new file mode 100644
index 0000000..f5318c4
--- /dev/null
+++ b/share/atf/Makefile
@@ -0,0 +1,37 @@
+#-
+# Copyright (c) 2012 EMC Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../contrib/atf
+
+.PATH: ${ATF}/atf-run/sample
+
+NO_OBJ=
+
+FILESDIR= ${SHAREDIR}/atf
+FILES= atf-run.hooks
+
+.include <bsd.prog.mk>
diff --git a/share/doc/Makefile b/share/doc/Makefile
index 7eabbd9..3f36375 100644
--- a/share/doc/Makefile
+++ b/share/doc/Makefile
@@ -3,7 +3,16 @@
.include <bsd.own.mk>
-SUBDIR= ${_bind9} IPv6 legal ${_llvm} ${_roffdocs}
+SUBDIR= ${_IPv6} \
+ ${_atf} \
+ ${_bind9} \
+ legal \
+ ${_llvm} \
+ ${_roffdocs}
+
+.if ${MK_ATF} != "no"
+_atf= atf
+.endif
.if ${MK_BIND} != "no"
_bind9= bind9
@@ -13,6 +22,10 @@ _bind9= bind9
_llvm= llvm
.endif
+.if ${MK_INET6} != "no"
+_IPv6= IPv6
+.endif
+
# FIXME this is not a real solution ...
.if ${MK_GROFF} != "no"
_roffdocs= papers psd smm usd
diff --git a/share/doc/atf/Makefile b/share/doc/atf/Makefile
new file mode 100644
index 0000000..1da915b
--- /dev/null
+++ b/share/doc/atf/Makefile
@@ -0,0 +1,39 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../../contrib/atf
+.PATH: ${ATF}
+.PATH: ${ATF}/doc
+
+NO_OBJ=
+
+FILESGROUPS= TOP
+
+TOPDIR= ${SHAREDIR}/doc/atf
+TOP= AUTHORS COPYING NEWS README
+
+.include <bsd.prog.mk>
diff --git a/share/examples/Makefile b/share/examples/Makefile
index d3fab14..5cfd76b 100644
--- a/share/examples/Makefile
+++ b/share/examples/Makefile
@@ -242,6 +242,9 @@ etc-examples:
.endif
.if ${SHARED} != "symlinks"
+.if ${MK_ATF} != "no"
+SUBDIR+=atf
+.endif
.if ${MK_IPFILTER} != "no"
SUBDIR+=ipfilter
.endif
diff --git a/share/examples/atf/Makefile b/share/examples/atf/Makefile
new file mode 100644
index 0000000..774502a
--- /dev/null
+++ b/share/examples/atf/Makefile
@@ -0,0 +1,39 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../../contrib/atf
+
+.PATH: ${ATF}/atf-report
+.PATH: ${ATF}/atf-run/sample
+
+NO_OBJ=
+
+FILESDIR= ${SHAREDIR}/examples/atf
+FILES= atf-run.hooks \
+ tests-results.css
+
+.include <bsd.prog.mk>
diff --git a/share/man/man1/Makefile b/share/man/man1/Makefile
index 43bf944..23bc1d8 100644
--- a/share/man/man1/Makefile
+++ b/share/man/man1/Makefile
@@ -1,8 +1,16 @@
# @(#)Makefile 8.1 (Berkeley) 6/5/93
# $FreeBSD$
+.include <bsd.own.mk>
+
MAN= builtin.1 intro.1
+.if ${MK_ATF} != "no"
+ATF= ${.CURDIR}/../../../contrib/atf
+.PATH: ${ATF}/doc
+MAN+= atf-test-program.1
+.endif
+
# Create MLINKS for Shell built in commands for which there are no userland
# utilities of the same name:
MLINKS= builtin.1 alias.1 \
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 5ac8ff6..7e10d6a 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -60,6 +60,7 @@ MAN= aac.4 \
atkbd.4 \
atkbdc.4 \
${_atp.4} \
+ ${_atf_test_case.4} \
${_atrtc.4} \
${_attimer.4} \
audit.4 \
@@ -805,6 +806,12 @@ _nvram2env.4= nvram2env.4
SUBDIR= man4.${MACHINE_CPUARCH}
.endif
+.if ${MK_ATF} != "no"
+ATF= ${.CURDIR}/../../../contrib/atf
+.PATH: ${ATF}/doc
+_atf_test_case.4= atf-test-case.4
+.endif
+
.if ${MK_PF} != "no"
_pf.4= pf.4
_pflog.4= pflog.4
diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile
index dac1066..5a337b8 100644
--- a/share/man/man5/Makefile
+++ b/share/man/man5/Makefile
@@ -6,6 +6,7 @@
#MISSING: dump.5 plot.5
MAN= acct.5 \
ar.5 \
+ ${_atf_formats.5} \
a.out.5 \
bluetooth.device.conf.5 \
bluetooth.hosts.5 \
@@ -80,6 +81,12 @@ MLINKS+=quota.user.5 quota.group.5
MLINKS+=rc.conf.5 rc.conf.local.5
MLINKS+=resolver.5 resolv.conf.5
+.if ${MK_ATF} != "no"
+ATF= ${.CURDIR}/../../../contrib/atf
+.PATH: ${ATF}/doc
+_atf_formats.5= atf-formats.5
+.endif
+
.if ${MK_HESIOD} != "no"
MAN+= hesiod.conf.5
.endif
diff --git a/share/man/man7/Makefile b/share/man/man7/Makefile
index 011fbaf..8417934 100644
--- a/share/man/man7/Makefile
+++ b/share/man/man7/Makefile
@@ -1,6 +1,8 @@
# @(#)Makefile 8.1 (Berkeley) 6/5/93
# $FreeBSD$
+.include <bsd.own.mk>
+
#MISSING: eqnchar.7 ms.7 term.7
MAN= adding_user.7 \
ascii.7 \
@@ -34,4 +36,17 @@ MLINKS+= c99.7 c78.7
MLINKS+= c99.7 c89.7
MLINKS+= c99.7 c90.7
+.if ${MK_ATF} != "no"
+ATF= ${.CURDIR}/../../../contrib/atf
+.PATH: ${ATF}/doc
+MAN+= atf.7
+
+CLEANFILES+= atf.7 atf.7.tmp
+atf.7: atf.7.in
+ sed -e 's,__DOCDIR__,${DOCDIR}/atf,g' \
+ -e 's,__TESTSDIR__,${TESTSBASE},g' \
+ < ${.ALLSRC} > ${.TARGET}.tmp
+ mv ${.TARGET}.tmp ${.TARGET}
+.endif
+
.include <bsd.prog.mk>
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
index f74959f..bcaec4b 100644
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -13,6 +13,8 @@ LIBCRT0?= ${DESTDIR}${LIBDIR}/crt0.o
LIBALIAS?= ${DESTDIR}${LIBDIR}/libalias.a
LIBARCHIVE?= ${DESTDIR}${LIBDIR}/libarchive.a
LIBASN1?= ${DESTDIR}${LIBDIR}/libasn1.a
+LIBATF_C?= ${DESTDIR}${LIBDIR}/libatf-c.a
+LIBATF_CXX?= ${DESTDIR}${LIBDIR}/libatf-c++.a
LIBATM?= ${DESTDIR}${LIBDIR}/libatm.a
LIBAUDITD?= ${DESTDIR}${LIBDIR}/libauditd.a
LIBAVL?= ${DESTDIR}${LIBDIR}/libavl.a
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 2c1c04e..3a2658c 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -306,6 +306,7 @@ __DEFAULT_YES_OPTIONS = \
APM \
ASSERT_DEBUG \
AT \
+ ATF \
ATM \
AUDIT \
AUTHPF \
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
new file mode 100644
index 0000000..531c2ef
--- /dev/null
+++ b/share/mk/bsd.progs.mk
@@ -0,0 +1,350 @@
+# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm
+
+.if ${MK_MAN} == "no"
+NO_MAN=
+.endif
+
+# Legacy knobs
+.if defined(PROG) || defined(PROG_CXX)
+. if defined(PROG)
+PROGS= ${PROG}
+. endif
+. if defined(PROG_CXX)
+PROGS= ${PROG_CXX}
+PROGS_CXX= ${PROG_CXX}
+. endif
+# Loop once to keep pattern and avoid namespace pollution
+. for _P in ${PROGS}
+. if defined(INTERNALPROG)
+INTERNALPROG.${_P}=
+. endif
+. if !defined(NO_MAN)
+. if defined(MAN)
+MAN.${_P}= ${MAN}
+. else
+. for sect in 1 1aout 2 3 4 5 6 7 8 9
+. if defined(MAN${sect})
+MAN.${_P}= ${MAN${sect}}
+. endif
+. endfor
+. endif
+. endif # defined(NO_MAN)
+. if defined(NLSNAME) && !empty(NLSNAME)
+NLSNAME.${P}:= ${NLSNAME}
+. endif
+. if defined(OBJS)
+OBJS.${_P}:= ${OBJS}
+. endif
+. if defined(PRECIOUSPROG)
+PRECIOUSPROG.${_P}=
+. endif
+. if defined(PROGNAME)
+PROGNAME.${_P}= ${PROGNAME}
+. endif
+. if defined(SRCS)
+SRCS.${_P}:= ${SRCS}
+. endif
+. endfor
+.else # !defined(PROG) && !defined(PROG_CXX)
+. if defined(PROGS_CXX) && !empty(PROGS_CXX)
+PROGS+= ${PROGS_CXX}
+. endif
+.endif # defined(PROG) || defined(PROG_CXX)
+
+.if defined(PROGS_CXX) && !empty(PROGS_CXX)
+. for _P in ${PROGS_CXX}
+PROG_CXX.${_P}=
+. endfor
+.endif
+
+# Avoid recursive variables
+.undef NLSNAME
+
+.if defined(COPTS)
+CFLAGS+=${COPTS}
+.endif
+
+.if defined(DEBUG_FLAGS)
+. if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
+CTFFLAGS+= -g
+. endif
+CFLAGS+=${DEBUG_FLAGS}
+CXXFLAGS+=${DEBUG_FLAGS}
+.endif
+
+STRIP?= -s
+
+.if ${MK_ASSERT_DEBUG} == "no"
+CFLAGS+= -DNDEBUG
+NO_WERROR=
+.endif
+
+.for _P in ${PROGS}
+
+BINDIR.${_P}?= ${BINDIR}
+BINGRP.${_P}?= ${BINGRP}
+BINMODE.${_P}?= ${BINMODE}
+BINOWN.${_P}?= ${BINOWN}
+
+CFLAGS.${_P}+= ${CFLAGS}
+CXXFLAGS.${_P}+= ${CXXFLAGS}
+DPADD.${_P}+= ${DPADD}
+LDADD.${_P}+= ${LDADD}
+LDFLAGS.${_P}+= ${LDFLAGS}
+
+INSTALLFLAGS.${_P}?= ${INSTALLFLAGS}
+
+. if defined(PRECIOUSPROG.${_P})
+. if !defined(NO_FSCHG) && !defined(NO_FSCHG.${_P})
+INSTALLFLAGS.${_P}+= -fschg
+. endif
+INSTALLFLAGS.${_P}+= -S
+. endif
+
+NO_SHARED.${_P}?= ${NO_SHARED}
+
+. if !defined(NLSDIR.${_P})
+NLSDIR.${_P}:= ${NLSDIR}
+. endif
+. undef NLSDIR
+
+. if !empty(NO_SHARED.${_P}) && ${NO_SHARED.${_P}:tl} != "no"
+LDFLAGS.${_P}+= -static
+. endif
+
+. if defined(SRCS.${_P})
+
+_SRCS:= ${SRCS.${_P}}
+OBJS.${_P}+= ${_SRCS:N*.h:R:S/$/.o/g}
+
+. if target(beforelinking)
+${_P}: ${OBJS.${_P}} beforelinking
+. else
+${_P}: ${OBJS.${_P}}
+. endif
+. if defined(PROG_CXX.${_P})
+ ${CXX} ${CXXFLAGS.${_P}} ${LDFLAGS.${_P}} -o ${.TARGET} ${OBJS.${_P}} \
+ ${LDADD.${_P}}
+. else
+ ${CC} ${CFLAGS.${_P}} ${LDFLAGS.${_P}} -o ${.TARGET} ${OBJS.${_P}} \
+ ${LDADD.${_P}}
+. endif
+. if ${MK_CTF} != "no"
+ ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS.${_P}}
+. endif
+
+. else # !defined(SRCS.${_P})
+
+. if !target(${_P})
+. if defined(PROG_CXX.${_P})
+SRCS.${_P}?= ${_P}.cc
+. else
+SRCS.${_P}?= ${_P}.c
+. endif
+
+# Always make an intermediate object file because:
+# - it saves time rebuilding when only the library has changed
+# - the name of the object gets put into the executable symbol table instead of
+# the name of a variable temporary object.
+# - it's useful to keep objects around for crunching.
+OBJS.${_P}:= ${_P}.o
+
+. if target(beforelinking)
+${_P}: ${OBJS.${_P}} beforelinking
+. else
+${_P}: ${OBJS.${_P}}
+. endif # target(beforelinking)
+. if defined(PROG_CXX.${_P})
+ ${CXX} ${CXXFLAGS.${_P}} ${LDFLAGS.${_P}} -o ${.TARGET} ${OBJS.${_P}} \
+ ${LDADD.${_P}}
+. else
+ ${CC} ${CFLAGS.${_P}} ${LDFLAGS.${_P}} -o ${.TARGET} ${OBJS.${_P}} \
+ ${LDADD.${_P}}
+. endif
+. if ${MK_CTF} != "no"
+ ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS.${_P}}
+. endif
+
+. endif # !target(${_P})
+
+. endif # defined(SRCS.${_P})
+
+CLEANFILES+= ${OBJS.${_P}}
+
+.endfor # for _P in ${PROGS}
+
+all: objwarn ${PROGS} ${SCRIPTS}
+
+.if !defined(NO_MAN)
+. for _P in ${PROGS}
+MAN.${_P}?= ${_P}.1
+MAN:= ${MAN.${_P}}
+. include <bsd.man.mk>
+. endfor
+. if target(_manpages) # bsd.man.mk was included
+all: _manpages
+. endif
+.endif
+
+CLEANFILES+= ${PROGS}
+
+.include <bsd.libnames.mk>
+
+_EXTRADEPEND:
+.for _P in ${PROGS}
+. if !empty(LDFLAGS.${P}:M-nostdlib)
+. if !empty(DPADD.${_P})
+ echo ${_P}: ${DPADD.${_P}} >> ${DEPENDFILE}
+. endif
+. else
+ echo ${_P}: ${LIBC} ${DPADD.${_P}} >> ${DEPENDFILE}
+. if defined(PROG_CXX.${_P})
+. if !empty(CXXFLAGS.${P}:M-stdlib=libc++)
+ echo ${_P}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
+. else
+ echo ${_P}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
+. endif
+. endif
+. endif
+.endfor
+
+.if !target(install)
+
+. if !target(realinstall)
+
+. for _P in ${PROGS}
+
+. if !defined(INTERNALPROG.${_P})
+
+.ORDER: beforeinstall _proginstall.${_P}
+_proginstall.${_P}:
+. if defined(PROGNAME.${_P})
+ ${INSTALL} ${STRIP} -o ${BINOWN.${_P}} -g ${BINGRP.${_P}} \
+ -m ${BINMODE.${_P}} ${INSTALLFLAGS.${_P}} ${_P} \
+ ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}
+. else
+ ${INSTALL} ${STRIP} -o ${BINOWN.${_P}} -g ${BINGRP.${_P}} \
+ -m ${BINMODE.${_P}} ${INSTALLFLAGS.${_P}} ${_P} \
+ ${DESTDIR}${BINDIR.${_P}}
+. endif
+
+realinstall: _proginstall.${_P}
+
+. endif # !defined(INTERNALPROG.${_P})
+
+. endfor # for _P in ${PROGS}
+
+. endif # !target(realinstall)
+
+. if defined(SCRIPTS) && !empty(SCRIPTS)
+SCRIPTSDIR?= ${BINDIR}
+SCRIPTSOWN?= ${BINOWN}
+SCRIPTSGRP?= ${BINGRP}
+SCRIPTSMODE?= ${BINMODE}
+
+. for S in ${SCRIPTS}
+
+realinstall: scriptsinstall
+.ORDER: beforeinstall scriptsinstall
+
+. if defined(SCRIPTSNAME)
+SCRIPTSNAME_${S}?= ${SCRIPTSNAME}
+. else
+SCRIPTSNAME_${S}?= ${S:T:R}
+. endif
+
+SCRIPTSDIR_${S}?= ${SCRIPTSDIR}
+SCRIPTSOWN_${S}?= ${SCRIPTSOWN}
+SCRIPTSGRP_${S}?= ${SCRIPTSGRP}
+SCRIPTSMODE_${S}?= ${SCRIPTSMODE}
+
+scriptsinstall: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}
+
+${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: ${S}
+ ${INSTALL} -o ${SCRIPTSOWN_${S}} \
+ -g ${SCRIPTSGRP_${S}} \
+ -m ${SCRIPTSMODE_${S}} \
+ ${.ALLSRC} \
+ ${.TARGET}
+
+. endfor # for S in ${SCRIPTS}
+
+. endif # defined(SCRIPTS) && !empty(SCRIPTS)
+
+.endif # !target(install)
+
+.if !defined(NO_MAN)
+. if target(_manpages) # bsd.man.mk was included
+realinstall: _maninstall
+. endif
+.endif
+
+# Wrap bsd.nls.mk because I can't force that Makefile snippet to work only with
+# ${PROGS}.
+.for _P in ${PROGS}
+NLSNAME.${_P}?= ${_P}
+NLS:= ${NLS.${_P}}
+NLSDIR:= ${NLSDIR.${_P}}
+NLSNAME:= ${NLSNAME.${_P}}
+.include <bsd.nls.mk>
+.endfor
+
+.include <bsd.files.mk>
+.include <bsd.incs.mk>
+.include <bsd.links.mk>
+
+.if !target(lint)
+. for _P in ${PROGS}
+. if !target(lint.${_P})
+. if defined(PROG_CXX.${_P})
+lint.${_P}:
+. else
+_CFLAGS:= ${CFLAGS.${_P}}
+_SRCS:= ${SRCS.${_P}}
+lint.${_P}: ${_SRCS:M*.c}
+ ${LINT} ${LINTFLAGS} ${_CFLAGS:M-[DIU]*} ${.ALLSRC}
+. endif
+. endif
+lint: lint.${_P}
+
+. endfor
+.endif # !target(lint)
+
+.for _P in ${PROGS}
+CFLAGS:= ${CFLAGS.${_P}}
+CXXFLAGS:= ${CXXFLAGS.${_P}}
+# XXX: Pollutes DPADD.${_P} and LDADD.${_P} above
+#DPADD:= ${DPADD.${_P}}
+#LDADD:= ${LDADD.${_P}}
+SRCS:= ${SRCS.${_P}}
+. include <bsd.dep.mk>
+# bsd.dep.mk mangles SRCS
+SRCS.${_P}:= ${SRCS}
+. undef DPADD LDADD
+.endfor
+
+# XXX: emulate the old bsd.prog.mk by allowing Makefiles that didn't set
+# ${PROG*} to function with this Makefile snippet.
+.if empty(PROGS)
+. include <bsd.dep.mk>
+.endif
+
+.if !exists(${.OBJDIR}/${DEPENDFILE})
+. for _P in ${PROGS}
+_SRCS:= ${SRCS.${_P}}
+${OBJS.${_P}}: ${_SRCS:M*.h}
+. endfor
+.endif
+
+.include <bsd.obj.mk>
+
+.include <bsd.sys.mk>
+
+.if defined(PORTNAME)
+.include <bsd.pkg.mk>
+.endif
diff --git a/share/xml/Makefile b/share/xml/Makefile
new file mode 100644
index 0000000..0fb0225
--- /dev/null
+++ b/share/xml/Makefile
@@ -0,0 +1,36 @@
+#-
+# Copyright (c) 2012 EMC Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+SUBDIR+= ${_atf}
+
+.if ${MK_ATF} != "no"
+_atf= atf
+.endif
+
+.include <bsd.subdir.mk>
diff --git a/share/xml/Makefile.inc b/share/xml/Makefile.inc
new file mode 100644
index 0000000..e1c3398
--- /dev/null
+++ b/share/xml/Makefile.inc
@@ -0,0 +1,30 @@
+#-
+# Copyright (c) 2012 EMC Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+BINDIR?= ${SHAREDIR}/xml
+
+# vim: syntax=make
diff --git a/share/xml/atf/Makefile b/share/xml/atf/Makefile
new file mode 100644
index 0000000..cf56ff1
--- /dev/null
+++ b/share/xml/atf/Makefile
@@ -0,0 +1,39 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../../contrib/atf
+
+.PATH: ${ATF}/atf-report
+
+NO_OBJ=
+
+FILESGROUPS= XML
+
+XMLDIR= ${SHAREDIR}/xml/atf
+XML= tests-results.dtd
+
+.include <bsd.prog.mk>
diff --git a/share/xsl/Makefile b/share/xsl/Makefile
new file mode 100644
index 0000000..0fb0225
--- /dev/null
+++ b/share/xsl/Makefile
@@ -0,0 +1,36 @@
+#-
+# Copyright (c) 2012 EMC Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+SUBDIR+= ${_atf}
+
+.if ${MK_ATF} != "no"
+_atf= atf
+.endif
+
+.include <bsd.subdir.mk>
diff --git a/share/xsl/Makefile.inc b/share/xsl/Makefile.inc
new file mode 100644
index 0000000..c2ed469
--- /dev/null
+++ b/share/xsl/Makefile.inc
@@ -0,0 +1,30 @@
+#-
+# Copyright (c) 2012 EMC Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+BINDIR?= ${SHAREDIR}/xsl
+
+# vim: syntax=make
diff --git a/share/xsl/atf/Makefile b/share/xsl/atf/Makefile
new file mode 100644
index 0000000..73e84f2
--- /dev/null
+++ b/share/xsl/atf/Makefile
@@ -0,0 +1,39 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../../contrib/atf
+
+.PATH: ${ATF}/atf-report
+
+NO_OBJ=
+
+FILESGROUPS= XSL
+
+XSLDIR= ${SHAREDIR}/xsl/atf
+XSL= tests-results.xsl
+
+.include <bsd.prog.mk>
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index ed04322..7125018 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -68,6 +68,77 @@ OLD_FILES+=usr/share/man/man1/batch.1.gz
OLD_FILES+=usr/share/man/man8/atrun.8.gz
.endif
+.if ${MK_ATF} == no
+OLD_DIRS+=etc/atf
+OLD_FILES+=etc/atf/FreeBSD.conf
+OLD_FILES+=etc/atf/atf-run.hooks
+OLD_FILES+=etc/atf/common.conf
+OLD_FILES+=usr/bin/atf-config
+OLD_FILES+=usr/bin/atf-report
+OLD_FILES+=usr/bin/atf-run
+OLD_FILES+=usr/bin/atf-sh
+OLD_FILES+=usr/bin/atf-version
+OLD_DIRS+=usr/include/atf-c
+OLD_FILES+=usr/include/atf-c/build.h
+OLD_FILES+=usr/include/atf-c/check.h
+OLD_FILES+=usr/include/atf-c/config.h
+OLD_FILES+=usr/include/atf-c/defs.h
+OLD_FILES+=usr/include/atf-c/error.h
+OLD_FILES+=usr/include/atf-c/error_fwd.h
+OLD_FILES+=usr/include/atf-c/macros.h
+OLD_FILES+=usr/include/atf-c/tc.h
+OLD_FILES+=usr/include/atf-c/tp.h
+OLD_FILES+=usr/include/atf-c/utils.h
+OLD_FILES+=usr/include/atf-c/atf-c.h
+OLD_FILES+=usr/include/atf-c.h
+OLD_DIRS+=usr/include/atf-c++
+OLD_FILES+=usr/include/atf-c++/build.hpp
+OLD_FILES+=usr/include/atf-c++/check.hpp
+OLD_FILES+=usr/include/atf-c++/config.hpp
+OLD_FILES+=usr/include/atf-c++/macros.hpp
+OLD_FILES+=usr/include/atf-c++/tests.hpp
+OLD_FILES+=usr/include/atf-c++/utils.hpp
+OLD_FILES+=usr/include/atf-c++/atf-c++.hpp
+OLD_FILES+=usr/include/atf-c++.hpp
+OLD_FILES+=usr/lib/libatf-c_p.a
+OLD_FILES+=usr/lib/libatf-c.so.1
+OLD_FILES+=usr/lib/libatf-c.so
+OLD_FILES+=usr/lib/libatf-c++.a
+OLD_FILES+=usr/lib/libatf-c++_p.a
+OLD_FILES+=usr/lib/libatf-c++.so.1
+OLD_FILES+=usr/lib/libatf-c++.so
+OLD_FILES+=usr/lib/libatf-c.a
+OLD_FILES+=usr/libexec/atf-check
+OLD_DIRS+=usr/share/atf
+OLD_FILES+=usr/share/atf/atf-run.hooks
+OLD_FILES+=usr/share/atf/libatf-sh.subr
+OLD_DIRS+=usr/share/doc/atf
+OLD_FILES+=usr/share/doc/atf/AUTHORS
+OLD_FILES+=usr/share/doc/atf/COPYING
+OLD_FILES+=usr/share/doc/atf/NEWS
+OLD_FILES+=usr/share/doc/atf/README
+OLD_DIRS+=usr/share/examples/atf
+OLD_FILES+=usr/share/examples/atf/atf-run.hooks
+OLD_FILES+=usr/share/examples/atf/tests-results.css
+OLD_FILES+=usr/share/man/man1/atf-check.1.gz
+OLD_FILES+=usr/share/man/man1/atf-config.1.gz
+OLD_FILES+=usr/share/man/man1/atf-report.1.gz
+OLD_FILES+=usr/share/man/man1/atf-run.1.gz
+OLD_FILES+=usr/share/man/man1/atf-sh.1.gz
+OLD_FILES+=usr/share/man/man1/atf-test-program.1.gz
+OLD_FILES+=usr/share/man/man1/atf-version.1.gz
+OLD_FILES+=usr/share/man/man3/atf-c-api.3.gz
+OLD_FILES+=usr/share/man/man3/atf-c++-api.3.gz
+OLD_FILES+=usr/share/man/man3/atf-sh-api.3.gz
+OLD_FILES+=usr/share/man/man4/atf-test-case.4.gz
+OLD_FILES+=usr/share/man/man5/atf-formats.5.gz
+OLD_FILES+=usr/share/man/man7/atf.7.gz
+OLD_DIRS+=usr/share/xml/atf
+OLD_FILES+=usr/share/xml/atf/tests-results.dtd
+OLD_DIRS+=usr/share/xsl/atf
+OLD_FILES+=usr/share/xsl/atf/tests-results.xsl
+.endif
+
.if ${MK_ATM} == no
OLD_FILES+=rescue/atmconfig
OLD_FILES+=sbin/atmconfig
diff --git a/tools/build/options/WITHOUT_ATF b/tools/build/options/WITHOUT_ATF
new file mode 100644
index 0000000..3ac5212
--- /dev/null
+++ b/tools/build/options/WITHOUT_ATF
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to not build programs and libraries related to the ATF testing framework.
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 9609159..377c375 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -12,6 +12,7 @@
SUBDIR= alias \
apply \
asa \
+ ${_atf} \
awk \
banner \
basename \
@@ -205,6 +206,10 @@ SUBDIR= alias \
SUBDIR+= at
.endif
+.if ${MK_ATF} != "no"
+_atf= atf
+.endif
+
.if ${MK_ATM} != "no"
SUBDIR+= atm
.endif
diff --git a/usr.bin/atf/Makefile b/usr.bin/atf/Makefile
new file mode 100644
index 0000000..77d3299
--- /dev/null
+++ b/usr.bin/atf/Makefile
@@ -0,0 +1,34 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+SUBDIR= atf-config \
+ atf-report \
+ atf-run \
+ atf-sh \
+ atf-version
+
+.include <bsd.subdir.mk>
diff --git a/usr.bin/atf/Makefile.inc b/usr.bin/atf/Makefile.inc
new file mode 100644
index 0000000..0b2188b
--- /dev/null
+++ b/usr.bin/atf/Makefile.inc
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+ATF= ${.CURDIR}/../../../contrib/atf
+
+CFLAGS+= -DGDB=\"gdb\"
+
+BINDIR?= /usr/bin
+WARNS?= 3
diff --git a/usr.bin/atf/atf-config/Makefile b/usr.bin/atf/atf-config/Makefile
new file mode 100644
index 0000000..d84ed11
--- /dev/null
+++ b/usr.bin/atf/atf-config/Makefile
@@ -0,0 +1,42 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-config
+
+PROG_CXX= atf-config
+SRCS= atf-config.cpp
+MAN= atf-config.1
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atf/atf-report/Makefile b/usr.bin/atf/atf-report/Makefile
new file mode 100644
index 0000000..0b1e8d2
--- /dev/null
+++ b/usr.bin/atf/atf-report/Makefile
@@ -0,0 +1,42 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-report
+
+PROG_CXX= atf-report
+SRCS= atf-report.cpp reader.cpp
+MAN= atf-report.1
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atf/atf-run/Makefile b/usr.bin/atf/atf-run/Makefile
new file mode 100644
index 0000000..d33cae1
--- /dev/null
+++ b/usr.bin/atf/atf-run/Makefile
@@ -0,0 +1,44 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-run
+
+PROG_CXX= atf-run
+SRCS= atf-run.cpp atffile.cpp config.cpp fs.cpp io.cpp requirements.cpp \
+ signals.cpp test-program.cpp timer.cpp user.cpp
+MAN= atf-run.1
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+CFLAGS+= -I${.CURDIR}/../../lib/libatf-c
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atf/atf-sh/Makefile b/usr.bin/atf/atf-sh/Makefile
new file mode 100644
index 0000000..8112098
--- /dev/null
+++ b/usr.bin/atf/atf-sh/Makefile
@@ -0,0 +1,47 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-sh
+
+PROG_CXX= atf-sh
+SRCS= atf-sh.cpp
+MAN= atf-sh.1 atf-sh-api.3
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+FILESGROUPS= SUBR
+
+SUBRDIR= ${SHAREDIR}/atf
+SUBR= libatf-sh.subr
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/atf/atf-version/Makefile b/usr.bin/atf/atf-version/Makefile
new file mode 100644
index 0000000..0320380
--- /dev/null
+++ b/usr.bin/atf/atf-version/Makefile
@@ -0,0 +1,52 @@
+#-
+# Copyright (c) 2011 Google, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.PATH: ${ATF}/atf-version
+
+PROG_CXX= atf-version
+SRCS= atf-version.cpp revision.h
+MAN= atf-version.1
+
+CFLAGS+= -DHAVE_CONFIG_H
+CFLAGS+= -I${ATF}
+CFLAGS+= -I${.CURDIR}/../../lib/libatf-c
+CFLAGS+= -I${.CURDIR}
+CFLAGS+= -I.
+
+CLEANFILES+= revision.h
+revision.h:
+ @sh ${ATF}/atf-version/generate-revision.sh \
+ -o ${.TARGET} \
+ -r ${ATF} \
+ -v `awk '$$2 == "VERSION" { print $$3 }' ${ATF}/bconfig.h`
+
+DPADD+= ${LIBATF_C} ${LIBATF_CXX}
+LDADD+= -latf-c++ -latf-c
+
+.include <bsd.prog.mk>
OpenPOWER on IntegriCloud