aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2017-08-02 08:35:51 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-08-02 08:35:51 +0000
commit4b330699f819a81d8e34d471225143ffeb321855 (patch)
tree3794bbf32b858fa79c3e362a4b95adc8a7863010
parentcd155b56033ab2693464bdade23e2ccd623e9936 (diff)
downloadsrc-4b330699f819a81d8e34d471225143ffeb321855.tar.gz
src-4b330699f819a81d8e34d471225143ffeb321855.zip
Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks
Notes
Notes: svn path=/head/; revision=321912
-rw-r--r--bin/cat/Makefile4
-rw-r--r--bin/date/Makefile4
-rw-r--r--bin/dd/Makefile4
-rw-r--r--bin/echo/Makefile4
-rw-r--r--bin/expr/Makefile4
-rw-r--r--bin/ln/Makefile4
-rw-r--r--bin/ls/Makefile4
-rw-r--r--bin/mv/Makefile4
-rw-r--r--bin/pax/Makefile4
-rw-r--r--bin/pkill/Makefile4
-rw-r--r--bin/sh/Makefile4
-rw-r--r--bin/sleep/Makefile4
-rw-r--r--bin/test/Makefile4
-rw-r--r--cddl/Makefile4
-rw-r--r--cddl/lib/Makefile5
-rw-r--r--cddl/sbin/Makefile6
-rw-r--r--cddl/usr.bin/Makefile5
-rw-r--r--cddl/usr.sbin/Makefile5
-rw-r--r--contrib/ofed/usr.bin/Makefile4
-rw-r--r--gnu/Makefile6
-rw-r--r--lib/atf/Makefile5
-rw-r--r--lib/atf/libatf-c++/Makefile4
-rw-r--r--lib/atf/libatf-c/Makefile4
-rw-r--r--lib/libarchive/Makefile4
-rw-r--r--lib/libc/Makefile4
-rw-r--r--lib/libcasper/services/cap_dns/Makefile4
-rw-r--r--lib/libcasper/services/cap_grp/Makefile4
-rw-r--r--lib/libcasper/services/cap_pwd/Makefile4
-rw-r--r--lib/libcasper/services/cap_sysctl/Makefile4
-rw-r--r--lib/libcrypt/Makefile4
-rw-r--r--lib/libmp/Makefile4
-rw-r--r--lib/libnv/Makefile4
-rw-r--r--lib/libpathconv/Makefile4
-rw-r--r--lib/libproc/Makefile4
-rw-r--r--lib/librt/Makefile4
-rw-r--r--lib/libthr/Makefile4
-rw-r--r--lib/libutil/Makefile4
-rw-r--r--lib/libxo/Makefile4
-rw-r--r--lib/msun/Makefile4
-rw-r--r--libexec/atf/atf-check/Makefile4
-rw-r--r--libexec/atf/atf-sh/Makefile4
-rw-r--r--libexec/rtld-elf/Makefile4
-rw-r--r--sbin/devd/Makefile4
-rw-r--r--sbin/dhclient/Makefile4
-rw-r--r--sbin/growfs/Makefile4
-rw-r--r--sbin/ifconfig/Makefile4
-rw-r--r--sbin/mdconfig/Makefile4
-rw-r--r--sbin/pfctl/Makefile4
-rw-r--r--secure/Makefile6
-rw-r--r--secure/lib/Makefile4
-rw-r--r--secure/libexec/Makefile4
-rw-r--r--secure/usr.bin/Makefile4
-rw-r--r--secure/usr.sbin/Makefile4
-rw-r--r--share/Makefile5
-rw-r--r--share/examples/Makefile4
-rw-r--r--share/zoneinfo/Makefile4
-rw-r--r--usr.bin/apply/Makefile4
-rw-r--r--usr.bin/basename/Makefile4
-rw-r--r--usr.bin/bsdcat/Makefile4
-rw-r--r--usr.bin/calendar/Makefile4
-rw-r--r--usr.bin/cmp/Makefile4
-rw-r--r--usr.bin/col/Makefile4
-rw-r--r--usr.bin/comm/Makefile4
-rw-r--r--usr.bin/compress/Makefile4
-rw-r--r--usr.bin/cpio/Makefile4
-rw-r--r--usr.bin/csplit/Makefile4
-rw-r--r--usr.bin/cut/Makefile4
-rw-r--r--usr.bin/diff/Makefile4
-rw-r--r--usr.bin/diff3/Makefile4
-rw-r--r--usr.bin/dirname/Makefile4
-rw-r--r--usr.bin/file2c/Makefile4
-rw-r--r--usr.bin/getconf/Makefile4
-rw-r--r--usr.bin/grep/Makefile4
-rw-r--r--usr.bin/gzip/Makefile4
-rw-r--r--usr.bin/hexdump/Makefile4
-rw-r--r--usr.bin/ident/Makefile4
-rw-r--r--usr.bin/indent/Makefile4
-rw-r--r--usr.bin/join/Makefile4
-rw-r--r--usr.bin/jot/Makefile4
-rw-r--r--usr.bin/lastcomm/Makefile4
-rw-r--r--usr.bin/limits/Makefile4
-rw-r--r--usr.bin/m4/Makefile4
-rw-r--r--usr.bin/mkimg/Makefile4
-rw-r--r--usr.bin/ncal/Makefile4
-rw-r--r--usr.bin/pr/Makefile4
-rw-r--r--usr.bin/printf/Makefile4
-rw-r--r--usr.bin/procstat/Makefile4
-rw-r--r--usr.bin/sdiff/Makefile4
-rw-r--r--usr.bin/sed/Makefile4
-rw-r--r--usr.bin/soelim/Makefile4
-rw-r--r--usr.bin/tail/Makefile4
-rw-r--r--usr.bin/tar/Makefile4
-rw-r--r--usr.bin/timeout/Makefile4
-rw-r--r--usr.bin/tr/Makefile4
-rw-r--r--usr.bin/truncate/Makefile4
-rw-r--r--usr.bin/uniq/Makefile4
-rw-r--r--usr.bin/units/Makefile4
-rw-r--r--usr.bin/uudecode/Makefile4
-rw-r--r--usr.bin/uuencode/Makefile4
-rw-r--r--usr.bin/xargs/Makefile4
-rw-r--r--usr.bin/xinstall/Makefile4
-rw-r--r--usr.bin/xo/Makefile4
-rw-r--r--usr.bin/yacc/Makefile4
-rw-r--r--usr.sbin/chown/Makefile4
-rw-r--r--usr.sbin/etcupdate/Makefile4
-rw-r--r--usr.sbin/extattr/Makefile4
-rw-r--r--usr.sbin/fstyp/Makefile4
-rw-r--r--usr.sbin/makefs/Makefile4
-rw-r--r--usr.sbin/newsyslog/Makefile4
-rw-r--r--usr.sbin/nmtree/Makefile4
-rw-r--r--usr.sbin/pw/Makefile4
-rw-r--r--usr.sbin/rpcbind/Makefile4
-rw-r--r--usr.sbin/sa/Makefile4
113 files changed, 117 insertions, 346 deletions
diff --git a/bin/cat/Makefile b/bin/cat/Makefile
index 39aaeeb4a50f..328692b30cd8 100644
--- a/bin/cat/Makefile
+++ b/bin/cat/Makefile
@@ -6,8 +6,6 @@
PACKAGE=runtime
PROG= cat
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/date/Makefile b/bin/date/Makefile
index fd7e401aeb58..5e17c5826155 100644
--- a/bin/date/Makefile
+++ b/bin/date/Makefile
@@ -7,8 +7,6 @@ PACKAGE=runtime
PROG= date
SRCS= date.c netdate.c vary.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/dd/Makefile b/bin/dd/Makefile
index df877c854f0f..d845951616ac 100644
--- a/bin/dd/Makefile
+++ b/bin/dd/Makefile
@@ -38,8 +38,6 @@ test: ${PROG} gen
@rm -f gen 1M_zeroes* obs_zeroes
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/echo/Makefile b/bin/echo/Makefile
index 4b5917d912eb..2f97ea6e97e1 100644
--- a/bin/echo/Makefile
+++ b/bin/echo/Makefile
@@ -6,8 +6,6 @@
PACKAGE=runtime
PROG= echo
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/expr/Makefile b/bin/expr/Makefile
index 471c1c099479..622f420c32e1 100644
--- a/bin/expr/Makefile
+++ b/bin/expr/Makefile
@@ -12,8 +12,6 @@ CFLAGS+= -fwrapv
NO_WMISSING_VARIABLE_DECLARATIONS=
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/ln/Makefile b/bin/ln/Makefile
index 48ef284b4f1b..36afc57d8612 100644
--- a/bin/ln/Makefile
+++ b/bin/ln/Makefile
@@ -10,8 +10,6 @@ MAN= ln.1 symlink.7
LINKS= ${BINDIR}/ln ${BINDIR}/link
MLINKS= ln.1 link.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/ls/Makefile b/bin/ls/Makefile
index db3fae7eb232..1653d21b0d3e 100644
--- a/bin/ls/Makefile
+++ b/bin/ls/Makefile
@@ -14,8 +14,6 @@ CFLAGS+= -DCOLORLS
LIBADD+= termcapw
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/mv/Makefile b/bin/mv/Makefile
index e82466be296c..f51e96c498ed 100644
--- a/bin/mv/Makefile
+++ b/bin/mv/Makefile
@@ -6,8 +6,6 @@
PACKAGE=runtime
PROG= mv
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/pax/Makefile b/bin/pax/Makefile
index 210137ba1abf..03ff95de3344 100644
--- a/bin/pax/Makefile
+++ b/bin/pax/Makefile
@@ -33,8 +33,6 @@ SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \
gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c \
tables.c tar.c tty_subs.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/pkill/Makefile b/bin/pkill/Makefile
index 302ac66e2b85..59ad1561f13f 100644
--- a/bin/pkill/Makefile
+++ b/bin/pkill/Makefile
@@ -19,8 +19,6 @@ MLINKS= pkill.1 pgrep.1
SYMLINKS= ../..${BINDIR}/pkill /usr/bin/pkill
SYMLINKS+= ../..${BINDIR}/pgrep /usr/bin/pgrep
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/sh/Makefile b/bin/sh/Makefile
index 65856de36491..db42b417d724 100644
--- a/bin/sh/Makefile
+++ b/bin/sh/Makefile
@@ -64,8 +64,6 @@ syntax.c syntax.h: mksyntax
token.h: mktokens
sh ${.CURDIR}/mktokens
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/sleep/Makefile b/bin/sleep/Makefile
index 9575adf62a71..20a609a44054 100644
--- a/bin/sleep/Makefile
+++ b/bin/sleep/Makefile
@@ -6,8 +6,6 @@
PACKAGE=runtime
PROG= sleep
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/bin/test/Makefile b/bin/test/Makefile
index 5cd91ebb288d..001b811c00c9 100644
--- a/bin/test/Makefile
+++ b/bin/test/Makefile
@@ -8,8 +8,6 @@ PROG= test
LINKS= ${BINDIR}/test ${BINDIR}/[
MLINKS= test.1 [.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/cddl/Makefile b/cddl/Makefile
index 26b502a12082..d01199b5d9af 100644
--- a/cddl/Makefile
+++ b/cddl/Makefile
@@ -5,9 +5,7 @@
SUBDIR= lib .WAIT \
sbin usr.bin usr.sbin
-.if ${MK_TESTS} != "no"
-SUBDIR+=tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
SUBDIR_PARALLEL=
diff --git a/cddl/lib/Makefile b/cddl/lib/Makefile
index 9371865ca428..69a0e381dfec 100644
--- a/cddl/lib/Makefile
+++ b/cddl/lib/Makefile
@@ -12,11 +12,8 @@ SUBDIR= ${_drti} \
${_libzfs_core} \
${_libzfs} \
${_libzpool} \
- ${_tests}
-.if ${MK_TESTS} != "no"
-_tests= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.if ${MK_ZFS} != "no"
_libzfs_core= libzfs_core
diff --git a/cddl/sbin/Makefile b/cddl/sbin/Makefile
index 19daabd02b57..99c4a91a3e69 100644
--- a/cddl/sbin/Makefile
+++ b/cddl/sbin/Makefile
@@ -2,11 +2,9 @@
.include <src.opts.mk>
-SUBDIR= ${_tests} ${_zfs} ${_zpool}
+SUBDIR= ${_zfs} ${_zpool}
-.if ${MK_TESTS} != "no"
-_tests= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.if ${MK_ZFS} != "no"
_zfs= zfs
diff --git a/cddl/usr.bin/Makefile b/cddl/usr.bin/Makefile
index 78f745df5755..573f99b55bd8 100644
--- a/cddl/usr.bin/Makefile
+++ b/cddl/usr.bin/Makefile
@@ -6,15 +6,12 @@ SUBDIR= \
ctfconvert \
ctfdump \
ctfmerge \
- ${_tests} \
${_zinject} \
${_zlook} \
${_zstreamdump} \
${_ztest}
-.if ${MK_TESTS} != "no"
-_tests= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.if ${MK_ZFS} != "no"
_zinject= zinject
diff --git a/cddl/usr.sbin/Makefile b/cddl/usr.sbin/Makefile
index 8fb489ad3259..a7ee242662a1 100644
--- a/cddl/usr.sbin/Makefile
+++ b/cddl/usr.sbin/Makefile
@@ -5,14 +5,11 @@
SUBDIR= ${_dtrace} \
${_lockstat} \
${_plockstat} \
- ${_tests} \
${_zdb} \
${_zfsd} \
${_zhack}
-.if ${MK_TESTS} != "no"
-_tests= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.if ${MK_ZFS} != "no"
.if ${MK_LIBTHR} != "no"
diff --git a/contrib/ofed/usr.bin/Makefile b/contrib/ofed/usr.bin/Makefile
index 2e1337391bc2..ce8d6806ab35 100644
--- a/contrib/ofed/usr.bin/Makefile
+++ b/contrib/ofed/usr.bin/Makefile
@@ -4,9 +4,7 @@ SUBDIR= ibaddr ibnetdiscover ibping ibportstate ibroute ibsendtrap ibstat \
ibsysstat ibtracert opensm perfquery saquery \
sminfo smpdump smpquery vendstat
-.if ${MK_TESTS} != "no"
-SUBDIR+= osmtest
-.endif
+SUBDIR.${MK_TESTS}+= tests
SUBDIR_PARALLEL=
diff --git a/gnu/Makefile b/gnu/Makefile
index bd84bc426981..7ecf7c8965a3 100644
--- a/gnu/Makefile
+++ b/gnu/Makefile
@@ -4,11 +4,9 @@
.include <src.opts.mk>
SUBDIR= lib .WAIT \
- ${_tests} usr.bin
+ usr.bin
-.if ${MK_TESTS} != "no"
-_tests= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
SUBDIR_PARALLEL=
diff --git a/lib/atf/Makefile b/lib/atf/Makefile
index 481bce97f13e..baadf535b424 100644
--- a/lib/atf/Makefile
+++ b/lib/atf/Makefile
@@ -29,10 +29,7 @@
SUBDIR= libatf-c \
libatf-c++ \
- ${_tests}
-.if ${MK_TESTS} != "no"
-_tests= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.subdir.mk>
diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile
index 7325e324a945..08fa39bac893 100644
--- a/lib/atf/libatf-c++/Makefile
+++ b/lib/atf/libatf-c++/Makefile
@@ -72,9 +72,7 @@ INCSDIR_atf-c++.hpp= ${INCLUDEDIR}
MAN= atf-c++.3
MLINKS+= atf-c++.3 atf-c-api++.3 # Backwards compatibility.
-.if ${MK_TESTS} != "no"
-SUBDIR= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include "../common.mk"
.include <bsd.lib.mk>
diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile
index 4b9ccd2e7fca..4bb48694e817 100644
--- a/lib/atf/libatf-c/Makefile
+++ b/lib/atf/libatf-c/Makefile
@@ -97,9 +97,7 @@ INCSDIR_atf-c.h= ${INCLUDEDIR}
MAN= atf-c.3
MLINKS+= atf-c.3 atf-c-api.3 # Backwards compatibility.
-.if ${MK_TESTS} != "no"
-SUBDIR= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include "../common.mk"
.include <bsd.lib.mk>
diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile
index 646ee28f6c94..228854eeb3de 100644
--- a/lib/libarchive/Makefile
+++ b/lib/libarchive/Makefile
@@ -413,8 +413,6 @@ MLINKS+= archive_write_set_options.3 archive_write_set_format_option.3
MLINKS+= archive_write_set_options.3 archive_write_set_option.3
MLINKS+= libarchive.3 archive.3
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 97739713cb07..2d4de5c0dfa6 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -173,9 +173,7 @@ libkern.${LIBC_ARCH}:: ${KMSRCS}
${CP} ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libcasper/services/cap_dns/Makefile b/lib/libcasper/services/cap_dns/Makefile
index 4a36da134b3a..1317b317f5d7 100644
--- a/lib/libcasper/services/cap_dns/Makefile
+++ b/lib/libcasper/services/cap_dns/Makefile
@@ -18,8 +18,6 @@ LIBADD= nv
CFLAGS+=-I${.CURDIR}
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libcasper/services/cap_grp/Makefile b/lib/libcasper/services/cap_grp/Makefile
index c2cc4b1a0b9f..2363fa06eb18 100644
--- a/lib/libcasper/services/cap_grp/Makefile
+++ b/lib/libcasper/services/cap_grp/Makefile
@@ -18,8 +18,6 @@ LIBADD= nv
CFLAGS+=-I${.CURDIR}
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libcasper/services/cap_pwd/Makefile b/lib/libcasper/services/cap_pwd/Makefile
index ab4be4bacd14..11c37bcd1bdd 100644
--- a/lib/libcasper/services/cap_pwd/Makefile
+++ b/lib/libcasper/services/cap_pwd/Makefile
@@ -18,8 +18,6 @@ LIBADD= nv
CFLAGS+=-I${.CURDIR}
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libcasper/services/cap_sysctl/Makefile b/lib/libcasper/services/cap_sysctl/Makefile
index 446ec5236e0b..32e1bef0f4f1 100644
--- a/lib/libcasper/services/cap_sysctl/Makefile
+++ b/lib/libcasper/services/cap_sysctl/Makefile
@@ -18,8 +18,6 @@ LIBADD= nv
CFLAGS+=-I${.CURDIR}
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile
index a31cdbea34c0..7842c49e7491 100644
--- a/lib/libcrypt/Makefile
+++ b/lib/libcrypt/Makefile
@@ -43,9 +43,7 @@ WARNS?= 2
PRECIOUSLIB=
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
.include <bsd.subdir.mk>
diff --git a/lib/libmp/Makefile b/lib/libmp/Makefile
index 16f96abaa030..496c6839da60 100644
--- a/lib/libmp/Makefile
+++ b/lib/libmp/Makefile
@@ -15,8 +15,6 @@ CFLAGS+= -I${SRCTOP}/crypto
VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def
SYMBOL_MAPS= ${.CURDIR}/Symbol.map
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile
index 8ef5d2871124..9e4e7f1e20ca 100644
--- a/lib/libnv/Makefile
+++ b/lib/libnv/Makefile
@@ -17,8 +17,6 @@ SRCS+= msgio.c
SRCS+= nvlist.c
SRCS+= nvpair.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libpathconv/Makefile b/lib/libpathconv/Makefile
index abdf127df0c8..10da9bb08d6d 100644
--- a/lib/libpathconv/Makefile
+++ b/lib/libpathconv/Makefile
@@ -13,8 +13,6 @@ SRCS= abs2rel.c rel2abs.c
#VERSION_DEF= ${SRCTOP/lib/libc/Versions.def
#SYMBOL_MAPS= ${.CURDIR}/Symbol.map
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
index 6749251f0006..e487cd207604 100644
--- a/lib/libproc/Makefile
+++ b/lib/libproc/Makefile
@@ -41,8 +41,6 @@ SHLIB_MAJOR= 4
MAN=
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/librt/Makefile b/lib/librt/Makefile
index 5417b9ef3bff..97306ae59cff 100644
--- a/lib/librt/Makefile
+++ b/lib/librt/Makefile
@@ -21,8 +21,6 @@ PRECIOUSLIB=
VERSION_DEF=${SRCTOP}/lib/libc/Versions.def
SYMBOL_MAPS=${.CURDIR}/Symbol.map
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile
index ffdb7b86b834..05c67fac087a 100644
--- a/lib/libthr/Makefile
+++ b/lib/libthr/Makefile
@@ -69,8 +69,6 @@ SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so
SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile
index 847cb6297b0b..176360c656f0 100644
--- a/lib/libutil/Makefile
+++ b/lib/libutil/Makefile
@@ -84,8 +84,6 @@ MLINKS+=pw_util.3 pw_copy.3 \
pw_util.3 pw_tempname.3 \
pw_util.3 pw_tmp.3
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/libxo/Makefile b/lib/libxo/Makefile
index 7af301fb9339..3bea6ebef71c 100644
--- a/lib/libxo/Makefile
+++ b/lib/libxo/Makefile
@@ -110,8 +110,6 @@ MLINKS= xo_attr.3 xo_attr_h.3 \
xo_syslog.3 xo_set_logmask.3 \
xo_syslog.3 xo_vsyslog.3
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/lib/msun/Makefile b/lib/msun/Makefile
index 99ab57ecf01a..ced343d0d01c 100644
--- a/lib/msun/Makefile
+++ b/lib/msun/Makefile
@@ -228,8 +228,6 @@ MLINKS+=trunc.3 truncf.3 trunc.3 truncl.3
.include <src.opts.mk>
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.lib.mk>
diff --git a/libexec/atf/atf-check/Makefile b/libexec/atf/atf-check/Makefile
index ca3c2efb6bfa..2533db4e7646 100644
--- a/libexec/atf/atf-check/Makefile
+++ b/libexec/atf/atf-check/Makefile
@@ -40,8 +40,6 @@ CFLAGS+= -DATF_SHELL='"/bin/sh"'
LIBADD= atf_cxx
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/libexec/atf/atf-sh/Makefile b/libexec/atf/atf-sh/Makefile
index a9ecc2ffcaa9..17728677c335 100644
--- a/libexec/atf/atf-sh/Makefile
+++ b/libexec/atf/atf-sh/Makefile
@@ -72,9 +72,7 @@ FILESGROUPS= SUBR
SUBRDIR= ${SHAREDIR}/atf
SUBR= libatf-sh.subr
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include "../../../lib/atf/common.mk"
.include <bsd.prog.mk>
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index 01ccace94104..fc535ce6f99a 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -85,9 +85,7 @@ beforeinstall:
.PATH: ${.CURDIR}/${RTLD_ARCH}
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
${PROG_FULL}: ${VERSION_MAP}
diff --git a/sbin/devd/Makefile b/sbin/devd/Makefile
index 4e5fa4710e03..3701e6e9457d 100644
--- a/sbin/devd/Makefile
+++ b/sbin/devd/Makefile
@@ -18,8 +18,6 @@ CFLAGS+=-I. -I${.CURDIR}
CLEANFILES= y.output
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/sbin/dhclient/Makefile b/sbin/dhclient/Makefile
index 2e9881f191cd..f4a9a331ca66 100644
--- a/sbin/dhclient/Makefile
+++ b/sbin/dhclient/Makefile
@@ -46,8 +46,6 @@ LIBADD= util
WARNS?= 2
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/sbin/growfs/Makefile b/sbin/growfs/Makefile
index bf3a8f2358e3..1adb0199e735 100644
--- a/sbin/growfs/Makefile
+++ b/sbin/growfs/Makefile
@@ -22,8 +22,6 @@ NO_WCAST_ALIGN= yes
LIBADD= util
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile
index 543392600395..567734781b35 100644
--- a/sbin/ifconfig/Makefile
+++ b/sbin/ifconfig/Makefile
@@ -67,8 +67,6 @@ MAN= ifconfig.8
CFLAGS+= -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wnested-externs
WARNS?= 2
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/sbin/mdconfig/Makefile b/sbin/mdconfig/Makefile
index 21db48a5ef1e..eeb2a93d2023 100644
--- a/sbin/mdconfig/Makefile
+++ b/sbin/mdconfig/Makefile
@@ -8,8 +8,6 @@ MAN= mdconfig.8
LIBADD= util geom
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile
index 2e9c17a05548..f182dde1790e 100644
--- a/sbin/pfctl/Makefile
+++ b/sbin/pfctl/Makefile
@@ -31,8 +31,6 @@ YFLAGS=
LIBADD= m md
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/secure/Makefile b/secure/Makefile
index c7845d4c8057..52830a50f126 100644
--- a/secure/Makefile
+++ b/secure/Makefile
@@ -3,12 +3,10 @@
.include <src.opts.mk>
SUBDIR= lib .WAIT \
- libexec ${_tests} usr.bin usr.sbin
+ libexec usr.bin usr.sbin
SUBDIR_PARALLEL=
-.if ${MK_TESTS} != "no"
-_tests= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
# These are the programs which depend on crypto, but not Kerberos.
SPROGS= lib/libfetch lib/libpam lib/libradius lib/libtelnet \
diff --git a/secure/lib/Makefile b/secure/lib/Makefile
index 4ca851766e62..9ceedcdc8149 100644
--- a/secure/lib/Makefile
+++ b/secure/lib/Makefile
@@ -10,8 +10,6 @@ SUBDIR+=libssh
.endif
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+=tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.subdir.mk>
diff --git a/secure/libexec/Makefile b/secure/libexec/Makefile
index 2e2eaf96da1d..3438b412d5da 100644
--- a/secure/libexec/Makefile
+++ b/secure/libexec/Makefile
@@ -7,9 +7,7 @@ SUBDIR=
SUBDIR+=sftp-server ssh-keysign ssh-pkcs11-helper
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+=tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
SUBDIR_PARALLEL=
diff --git a/secure/usr.bin/Makefile b/secure/usr.bin/Makefile
index cf3e7f528bd8..62cdeb3d640b 100644
--- a/secure/usr.bin/Makefile
+++ b/secure/usr.bin/Makefile
@@ -10,9 +10,7 @@ SUBDIR+=scp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan
.endif
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+=tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
SUBDIR_PARALLEL=
diff --git a/secure/usr.sbin/Makefile b/secure/usr.sbin/Makefile
index 9b2f910f9c49..f6b22d86da3d 100644
--- a/secure/usr.sbin/Makefile
+++ b/secure/usr.sbin/Makefile
@@ -7,9 +7,7 @@ SUBDIR=
SUBDIR+=sshd
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+=tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
SUBDIR_PARALLEL=
diff --git a/share/Makefile b/share/Makefile
index fae485f1b706..c4e12b05f7db 100644
--- a/share/Makefile
+++ b/share/Makefile
@@ -26,7 +26,6 @@ SUBDIR= ${_colldef} \
${_syscons} \
tabset \
termcap \
- ${_tests} \
${_timedef} \
${_vt} \
${_zoneinfo}
@@ -82,9 +81,7 @@ _doc= doc
_syscons= syscons
.endif
-.if ${MK_TESTS} != "no"
-_tests= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.if ${MK_VT} != "no"
_vt= vt
diff --git a/share/examples/Makefile b/share/examples/Makefile
index 73b97536d201..40c0ce549701 100644
--- a/share/examples/Makefile
+++ b/share/examples/Makefile
@@ -266,9 +266,7 @@ SUBDIR+=pf
.endif
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+=tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
SUBDIR_PARALLEL=
diff --git a/share/zoneinfo/Makefile b/share/zoneinfo/Makefile
index a13a43c62160..a1e1aa223cca 100644
--- a/share/zoneinfo/Makefile
+++ b/share/zoneinfo/Makefile
@@ -131,8 +131,6 @@ afterinstall:
echo "Run tzsetup(8) manually to update /etc/localtime."; \
fi
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/apply/Makefile b/usr.bin/apply/Makefile
index 223343455e6e..9234077aaf18 100644
--- a/usr.bin/apply/Makefile
+++ b/usr.bin/apply/Makefile
@@ -7,8 +7,6 @@ PROG= apply
LIBADD= sbuf
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/basename/Makefile b/usr.bin/basename/Makefile
index b392c3f378df..2fbb26488bf6 100644
--- a/usr.bin/basename/Makefile
+++ b/usr.bin/basename/Makefile
@@ -6,8 +6,6 @@
PROG= basename
MLINKS= basename.1 dirname.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/bsdcat/Makefile b/usr.bin/bsdcat/Makefile
index 077bf88d00ac..8ea5dee7398e 100644
--- a/usr.bin/bsdcat/Makefile
+++ b/usr.bin/bsdcat/Makefile
@@ -24,8 +24,6 @@ LIBADD= archive
CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/calendar/Makefile b/usr.bin/calendar/Makefile
index 38cf6db51848..53bd4675b948 100644
--- a/usr.bin/calendar/Makefile
+++ b/usr.bin/calendar/Makefile
@@ -33,8 +33,6 @@ beforeinstall:
${DESTDIR}${SHAREDIR}/calendar/${link}
.endfor
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/cmp/Makefile b/usr.bin/cmp/Makefile
index 5b9fdfc23a2a..0f515f4af5f5 100644
--- a/usr.bin/cmp/Makefile
+++ b/usr.bin/cmp/Makefile
@@ -6,8 +6,6 @@
PROG= cmp
SRCS= cmp.c link.c misc.c regular.c special.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/col/Makefile b/usr.bin/col/Makefile
index a16286611902..8773b5dc58ba 100644
--- a/usr.bin/col/Makefile
+++ b/usr.bin/col/Makefile
@@ -5,8 +5,6 @@
PROG= col
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/comm/Makefile b/usr.bin/comm/Makefile
index ca9134358188..2392035e6c39 100644
--- a/usr.bin/comm/Makefile
+++ b/usr.bin/comm/Makefile
@@ -5,8 +5,6 @@
PROG= comm
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/compress/Makefile b/usr.bin/compress/Makefile
index 7d498a3757ae..bfe46b5da868 100644
--- a/usr.bin/compress/Makefile
+++ b/usr.bin/compress/Makefile
@@ -11,8 +11,6 @@ MLINKS= compress.1 uncompress.1
# XXX zopen is not part of libc
# MAN=zopen.3
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/cpio/Makefile b/usr.bin/cpio/Makefile
index 2d5e5bd8f8b1..46cf06e871c1 100644
--- a/usr.bin/cpio/Makefile
+++ b/usr.bin/cpio/Makefile
@@ -32,8 +32,6 @@ CFLAGS+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DICONV_CONST=const
SYMLINKS=bsdcpio ${BINDIR}/cpio
MLINKS= bsdcpio.1 cpio.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/csplit/Makefile b/usr.bin/csplit/Makefile
index 52b2016b8139..af23872b969d 100644
--- a/usr.bin/csplit/Makefile
+++ b/usr.bin/csplit/Makefile
@@ -4,8 +4,6 @@
PROG= csplit
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/cut/Makefile b/usr.bin/cut/Makefile
index 21c1a1c6354f..9321756aae86 100644
--- a/usr.bin/cut/Makefile
+++ b/usr.bin/cut/Makefile
@@ -5,8 +5,6 @@
PROG= cut
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/diff/Makefile b/usr.bin/diff/Makefile
index 8242ec944d02..0293d167a6b7 100644
--- a/usr.bin/diff/Makefile
+++ b/usr.bin/diff/Makefile
@@ -5,8 +5,6 @@
PROG= diff
SRCS= diff.c diffdir.c diffreg.c xmalloc.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/diff3/Makefile b/usr.bin/diff3/Makefile
index a783e00a45ff..03cf52ad9876 100644
--- a/usr.bin/diff3/Makefile
+++ b/usr.bin/diff3/Makefile
@@ -4,8 +4,6 @@
PROG= diff3
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/dirname/Makefile b/usr.bin/dirname/Makefile
index be9193c63b50..3353371c8963 100644
--- a/usr.bin/dirname/Makefile
+++ b/usr.bin/dirname/Makefile
@@ -6,8 +6,6 @@
PROG= dirname
MAN=
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/file2c/Makefile b/usr.bin/file2c/Makefile
index 214d0336a015..0f0f8af595c5 100644
--- a/usr.bin/file2c/Makefile
+++ b/usr.bin/file2c/Makefile
@@ -4,8 +4,6 @@
PROG= file2c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/getconf/Makefile b/usr.bin/getconf/Makefile
index 1670465a0878..46e999c86258 100644
--- a/usr.bin/getconf/Makefile
+++ b/usr.bin/getconf/Makefile
@@ -37,8 +37,6 @@ conflicting.names: confstr.names limits.names sysconf.names
unique.names: conflicting.names
LC_ALL=C sort -u ${.ALLSRC} >${.TARGET}
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/grep/Makefile b/usr.bin/grep/Makefile
index 23dc8df828ed..c6d4c2f5cdf9 100644
--- a/usr.bin/grep/Makefile
+++ b/usr.bin/grep/Makefile
@@ -92,8 +92,6 @@ LIBADD+= gnuregex
CFLAGS+= -DWITHOUT_NLS
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/gzip/Makefile b/usr.bin/gzip/Makefile
index 1266277b16b1..2a69ac139fa5 100644
--- a/usr.bin/gzip/Makefile
+++ b/usr.bin/gzip/Makefile
@@ -27,8 +27,6 @@ LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip \
${BINDIR}/gzip ${BINDIR}/zcat \
${BINDIR}/zdiff ${BINDIR}/zcmp
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/hexdump/Makefile b/usr.bin/hexdump/Makefile
index d3c417f9ef75..fd8494c74ed5 100644
--- a/usr.bin/hexdump/Makefile
+++ b/usr.bin/hexdump/Makefile
@@ -10,8 +10,6 @@ MLINKS= hexdump.1 hd.1
LINKS= ${BINDIR}/hexdump ${BINDIR}/od
LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/ident/Makefile b/usr.bin/ident/Makefile
index 49798e8251fe..e8c58c4e93d9 100644
--- a/usr.bin/ident/Makefile
+++ b/usr.bin/ident/Makefile
@@ -6,8 +6,6 @@ PROG= ident
LIBADD= sbuf
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/indent/Makefile b/usr.bin/indent/Makefile
index 2eb1c32657c3..6ab3b2b3831a 100644
--- a/usr.bin/indent/Makefile
+++ b/usr.bin/indent/Makefile
@@ -8,8 +8,6 @@ SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c
NO_WMISSING_VARIABLE_DECLARATIONS=
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/join/Makefile b/usr.bin/join/Makefile
index c3f40e4be6b8..575f7abedef8 100644
--- a/usr.bin/join/Makefile
+++ b/usr.bin/join/Makefile
@@ -5,8 +5,6 @@
PROG= join
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/jot/Makefile b/usr.bin/jot/Makefile
index 206c89312f45..cc802676fb23 100644
--- a/usr.bin/jot/Makefile
+++ b/usr.bin/jot/Makefile
@@ -5,8 +5,6 @@
PROG= jot
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/lastcomm/Makefile b/usr.bin/lastcomm/Makefile
index 238551bc88dc..83a4f96a4c87 100644
--- a/usr.bin/lastcomm/Makefile
+++ b/usr.bin/lastcomm/Makefile
@@ -8,8 +8,6 @@ PACKAGE=acct
PROG= lastcomm
SRCS= lastcomm.c readrec.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/limits/Makefile b/usr.bin/limits/Makefile
index 9b5f8476fd6d..5a5af98f3023 100644
--- a/usr.bin/limits/Makefile
+++ b/usr.bin/limits/Makefile
@@ -5,8 +5,6 @@
PROG= limits
LIBADD= util
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile
index b5f4b304096f..ffd13d0fdba2 100644
--- a/usr.bin/m4/Makefile
+++ b/usr.bin/m4/Makefile
@@ -20,8 +20,6 @@ tokenizer.o: parser.h
CLEANFILES+= parser.c parser.h tokenizer.o
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/mkimg/Makefile b/usr.bin/mkimg/Makefile
index 8edfc9bb76be..68274a4b3763 100644
--- a/usr.bin/mkimg/Makefile
+++ b/usr.bin/mkimg/Makefile
@@ -35,8 +35,6 @@ LIBADD= util
WARNS?= 6
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/ncal/Makefile b/usr.bin/ncal/Makefile
index 23b5da2ce492..c42ed905b11a 100644
--- a/usr.bin/ncal/Makefile
+++ b/usr.bin/ncal/Makefile
@@ -9,8 +9,6 @@ LIBADD= calendar ncursesw
LINKS= ${BINDIR}/ncal ${BINDIR}/cal
MLINKS= ncal.1 cal.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/pr/Makefile b/usr.bin/pr/Makefile
index 779fa8583cc8..6796ea8a8157 100644
--- a/usr.bin/pr/Makefile
+++ b/usr.bin/pr/Makefile
@@ -6,8 +6,6 @@
PROG= pr
SRCS= pr.c egetopt.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/printf/Makefile b/usr.bin/printf/Makefile
index 759bcf75e982..b1b39308e969 100644
--- a/usr.bin/printf/Makefile
+++ b/usr.bin/printf/Makefile
@@ -5,8 +5,6 @@
PROG= printf
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/procstat/Makefile b/usr.bin/procstat/Makefile
index 10b9040372ea..ed07e634fcc1 100644
--- a/usr.bin/procstat/Makefile
+++ b/usr.bin/procstat/Makefile
@@ -22,8 +22,6 @@ SRCS= procstat.c \
LIBADD+= procstat xo util sbuf
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/sdiff/Makefile b/usr.bin/sdiff/Makefile
index f4772cc3da59..0fa5985c66fe 100644
--- a/usr.bin/sdiff/Makefile
+++ b/usr.bin/sdiff/Makefile
@@ -8,8 +8,6 @@ WARNS= 3
MAN1= sdiff.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/sed/Makefile b/usr.bin/sed/Makefile
index a741da3233e6..803de6db23c4 100644
--- a/usr.bin/sed/Makefile
+++ b/usr.bin/sed/Makefile
@@ -8,8 +8,6 @@ SRCS= compile.c main.c misc.c process.c
WARNS?= 2
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/soelim/Makefile b/usr.bin/soelim/Makefile
index 21eaaffd693f..eda319b1f967 100644
--- a/usr.bin/soelim/Makefile
+++ b/usr.bin/soelim/Makefile
@@ -4,8 +4,6 @@
PROG= soelim
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/tail/Makefile b/usr.bin/tail/Makefile
index 6366f6f15f72..8012419affb5 100644
--- a/usr.bin/tail/Makefile
+++ b/usr.bin/tail/Makefile
@@ -6,8 +6,6 @@
PROG= tail
SRCS= forward.c misc.c read.c reverse.c tail.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile
index c7d306eaad94..91e51a4b394e 100644
--- a/usr.bin/tar/Makefile
+++ b/usr.bin/tar/Makefile
@@ -33,8 +33,6 @@ CFLAGS+= -I${_LIBARCHIVEDIR}/libarchive_fe
SYMLINKS= bsdtar ${BINDIR}/tar
MLINKS= bsdtar.1 tar.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/timeout/Makefile b/usr.bin/timeout/Makefile
index c1957aeadeeb..72c855813982 100644
--- a/usr.bin/timeout/Makefile
+++ b/usr.bin/timeout/Makefile
@@ -4,8 +4,6 @@
PROG= timeout
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/tr/Makefile b/usr.bin/tr/Makefile
index 393b446614fd..0cd24502e991 100644
--- a/usr.bin/tr/Makefile
+++ b/usr.bin/tr/Makefile
@@ -6,8 +6,6 @@
PROG= tr
SRCS= cmap.c cset.c str.c tr.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/truncate/Makefile b/usr.bin/truncate/Makefile
index a6de5c6c9ba0..2f607d440830 100644
--- a/usr.bin/truncate/Makefile
+++ b/usr.bin/truncate/Makefile
@@ -5,8 +5,6 @@
PROG= truncate
LIBADD= util
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/uniq/Makefile b/usr.bin/uniq/Makefile
index c6ca3691d1e0..ab811d458022 100644
--- a/usr.bin/uniq/Makefile
+++ b/usr.bin/uniq/Makefile
@@ -5,8 +5,6 @@
PROG= uniq
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/units/Makefile b/usr.bin/units/Makefile
index 278d3727c905..78d843e7794f 100644
--- a/usr.bin/units/Makefile
+++ b/usr.bin/units/Makefile
@@ -8,8 +8,6 @@ FILESDIR= ${SHAREDIR}/misc
LIBADD= edit
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/uudecode/Makefile b/usr.bin/uudecode/Makefile
index 7063d6f719a4..83fbd64fee87 100644
--- a/usr.bin/uudecode/Makefile
+++ b/usr.bin/uudecode/Makefile
@@ -7,8 +7,6 @@ PROG= uudecode
LINKS= ${BINDIR}/uudecode ${BINDIR}/b64decode
MAN=
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/uuencode/Makefile b/usr.bin/uuencode/Makefile
index eb2152f8bd8f..fac6ef83f8b0 100644
--- a/usr.bin/uuencode/Makefile
+++ b/usr.bin/uuencode/Makefile
@@ -11,8 +11,6 @@ MLINKS= uuencode.1 uudecode.1 \
uuencode.1 b64encode.1 \
b64encode.1 b64decode.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/xargs/Makefile b/usr.bin/xargs/Makefile
index 034a0a6de353..caf6d9dd9df6 100644
--- a/usr.bin/xargs/Makefile
+++ b/usr.bin/xargs/Makefile
@@ -6,8 +6,6 @@
PROG= xargs
SRCS= xargs.c strnsubst.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/xinstall/Makefile b/usr.bin/xinstall/Makefile
index 2e167a75f2da..3fffb2f7d97b 100644
--- a/usr.bin/xinstall/Makefile
+++ b/usr.bin/xinstall/Makefile
@@ -14,8 +14,6 @@ CFLAGS+= -I${SRCTOP}/lib/libnetbsd
LIBADD= md
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/xo/Makefile b/usr.bin/xo/Makefile
index 476ccae8c4d0..e4a765120e97 100644
--- a/usr.bin/xo/Makefile
+++ b/usr.bin/xo/Makefile
@@ -18,8 +18,6 @@ CFLAGS+=-I${SRCTOP}/lib/libxo
LIBADD= xo util
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.bin/yacc/Makefile b/usr.bin/yacc/Makefile
index 61b0e86fcc48..455c4b93b230 100644
--- a/usr.bin/yacc/Makefile
+++ b/usr.bin/yacc/Makefile
@@ -21,8 +21,6 @@ CFLAGS+= -DYYPATCH=${YYPATCH}
LINKS= ${BINDIR}/yacc ${BINDIR}/byacc
MLINKS= yacc.1 byacc.1
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.sbin/chown/Makefile b/usr.sbin/chown/Makefile
index 7bcb67724832..8c15ade02e53 100644
--- a/usr.sbin/chown/Makefile
+++ b/usr.sbin/chown/Makefile
@@ -7,8 +7,6 @@ PROG= chown
LINKS= ${BINDIR}/chown /usr/bin/chgrp
MAN= chgrp.1 chown.8
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.sbin/etcupdate/Makefile b/usr.sbin/etcupdate/Makefile
index 155151de02f8..bfdf1953b265 100644
--- a/usr.sbin/etcupdate/Makefile
+++ b/usr.sbin/etcupdate/Makefile
@@ -5,8 +5,6 @@
SCRIPTS=etcupdate.sh
MAN= etcupdate.8
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.sbin/extattr/Makefile b/usr.sbin/extattr/Makefile
index 9feaa59883b6..3d72c219024d 100644
--- a/usr.sbin/extattr/Makefile
+++ b/usr.sbin/extattr/Makefile
@@ -15,8 +15,6 @@ MLINKS+= rmextattr.8 lsextattr.8
.include <src.opts.mk>
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile
index a86cb536b620..f852ff7ccb53 100644
--- a/usr.sbin/fstyp/Makefile
+++ b/usr.sbin/fstyp/Makefile
@@ -15,8 +15,8 @@ WARNS?= 2
.include <bsd.endian.mk>
-.if ${MK_TESTS} != "no" && ${TARGET_ENDIANNESS} == 1234
-SUBDIR+= tests
+.if ${TARGET_ENDIANNESS} == 1234
+SUBDIR.${MK_TESTS}+= tests
.endif
.if ${MK_ZFS} != "no"
diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile
index ac59e3c58a3d..79a2e767c742 100644
--- a/usr.sbin/makefs/Makefile
+++ b/usr.sbin/makefs/Makefile
@@ -35,8 +35,6 @@ SRCS+= ffs_tables.c
CFLAGS+= -I${SRCTOP}/lib/libnetbsd
LIBADD= netbsd util sbuf
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.sbin/newsyslog/Makefile b/usr.sbin/newsyslog/Makefile
index 1c63e73e0a87..77f40c23123b 100644
--- a/usr.sbin/newsyslog/Makefile
+++ b/usr.sbin/newsyslog/Makefile
@@ -6,8 +6,6 @@ PROG= newsyslog
MAN= newsyslog.8 newsyslog.conf.5
SRCS= newsyslog.c ptimes.c
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.sbin/nmtree/Makefile b/usr.sbin/nmtree/Makefile
index 09c0ecdedd99..1f88ba6f5662 100644
--- a/usr.sbin/nmtree/Makefile
+++ b/usr.sbin/nmtree/Makefile
@@ -19,8 +19,6 @@ LIBADD= netbsd md util
LINKS= ${BINDIR}/mtree ${BINDIR}/nmtree
MLINKS= mtree.8 nmtree.8
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.sbin/pw/Makefile b/usr.sbin/pw/Makefile
index f26c9de540e9..bdb4384d1cc5 100644
--- a/usr.sbin/pw/Makefile
+++ b/usr.sbin/pw/Makefile
@@ -12,8 +12,6 @@ LIBADD= crypt util sbuf
.include <src.opts.mk>
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>
diff --git a/usr.sbin/rpcbind/Makefile b/usr.sbin/rpcbind/Makefile
index 57907d3be871..1e9e5f705479 100644
--- a/usr.sbin/rpcbind/Makefile
+++ b/usr.sbin/rpcbind/Makefile
@@ -23,9 +23,7 @@ CFLAGS+= -DLIBWRAP
LIBADD+= wrap
.endif
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
WARNS?= 1
diff --git a/usr.sbin/sa/Makefile b/usr.sbin/sa/Makefile
index 0d118ce01c83..a7ffccf03c44 100644
--- a/usr.sbin/sa/Makefile
+++ b/usr.sbin/sa/Makefile
@@ -10,8 +10,6 @@ SRCS= main.c db.c pdb.c usrdb.c readrec.c
PACKAGE=acct
-.if ${MK_TESTS} != "no"
-SUBDIR+= tests
-.endif
+SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>