aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2014-11-29 05:28:40 +0000
committerEnji Cooper <ngie@FreeBSD.org>2014-11-29 05:28:40 +0000
commit840e70929b3bc0bfdbccfd8d8626d6e2f29ddbcf (patch)
treed5550a058a3cf6fc614f2c0e381821937079caa0 /sbin
parent67a25fa845f512cc9f0594a0e1af26e73099280b (diff)
parent4bf5485791b743cece52e2defa8c8efdf389b57a (diff)
downloadsrc-840e70929b3bc0bfdbccfd8d8626d6e2f29ddbcf.tar.gz
src-840e70929b3bc0bfdbccfd8d8626d6e2f29ddbcf.zip
MFHead @ r275232
Notes
Notes: svn path=/projects/building-blocks/; revision=275233
Diffstat (limited to 'sbin')
-rw-r--r--sbin/atm/atmconfig/Makefile6
-rw-r--r--sbin/badsect/Makefile3
-rw-r--r--sbin/bsdlabel/Makefile3
-rw-r--r--sbin/camcontrol/Makefile3
-rw-r--r--sbin/casperd/Makefile3
-rw-r--r--sbin/ccdconfig/Makefile3
-rw-r--r--sbin/ddb/Makefile3
-rw-r--r--sbin/devd/Makefile3
-rw-r--r--sbin/dhclient/Makefile3
-rw-r--r--sbin/dmesg/Makefile3
-rw-r--r--sbin/dumpfs/Makefile3
-rw-r--r--sbin/fdisk/Makefile3
-rw-r--r--sbin/fdisk_pc98/Makefile3
-rw-r--r--sbin/ffsinfo/Makefile3
-rw-r--r--sbin/fsck_ffs/Makefile3
-rw-r--r--sbin/fsck_ffs/dir.c1
-rw-r--r--sbin/fsdb/Makefile3
-rw-r--r--sbin/gbde/Makefile3
-rw-r--r--sbin/geom/Makefile3
-rw-r--r--sbin/geom/class/eli/Makefile3
-rw-r--r--sbin/geom/class/journal/Makefile3
-rw-r--r--sbin/geom/class/mirror/Makefile3
-rw-r--r--sbin/geom/class/part/Makefile3
-rw-r--r--sbin/geom/class/raid/Makefile3
-rw-r--r--sbin/geom/class/raid3/Makefile3
-rw-r--r--sbin/geom/core/Makefile3
-rw-r--r--sbin/ggate/ggatec/Makefile3
-rw-r--r--sbin/ggate/ggated/Makefile3
-rw-r--r--sbin/ggate/ggatel/Makefile3
-rw-r--r--sbin/growfs/Makefile5
-rw-r--r--sbin/gvinum/Makefile3
-rw-r--r--sbin/hastctl/Makefile6
-rw-r--r--sbin/hastd/Makefile6
-rw-r--r--sbin/ifconfig/Makefile9
-rw-r--r--sbin/init/Makefile3
-rw-r--r--sbin/ipf/Makefile.inc4
-rw-r--r--sbin/ipf/ipf/Makefile3
-rw-r--r--sbin/ipf/ipfstat/Makefile3
-rw-r--r--sbin/ipf/ipsend/Makefile3
-rw-r--r--sbin/ipfw/Makefile3
-rw-r--r--sbin/iscontrol/Makefile3
-rw-r--r--sbin/md5/Makefile3
-rw-r--r--sbin/mdconfig/Makefile3
-rw-r--r--sbin/mdconfig/tests/Makefile9
-rw-r--r--sbin/mdconfig/tests/legacy_test.sh47
-rw-r--r--sbin/mdconfig/tests/mdconfig.test231
-rwxr-xr-xsbin/mdconfig/tests/mdconfig_test.sh281
-rw-r--r--sbin/mdconfig/tests/run.pl329
-rw-r--r--sbin/mount/Makefile3
-rw-r--r--sbin/mount_cd9660/Makefile3
-rw-r--r--sbin/mount_msdosfs/Makefile3
-rw-r--r--sbin/mount_udf/Makefile3
-rw-r--r--sbin/nandfs/Makefile3
-rw-r--r--sbin/natd/Makefile3
-rw-r--r--sbin/newfs/Makefile3
-rw-r--r--sbin/newfs_nandfs/Makefile3
-rw-r--r--sbin/pfctl/Makefile3
-rw-r--r--sbin/pflogd/Makefile3
-rw-r--r--sbin/ping/Makefile9
-rw-r--r--sbin/ping6/Makefile3
-rw-r--r--sbin/quotacheck/Makefile3
-rw-r--r--sbin/rcorder/Makefile3
-rw-r--r--sbin/routed/Makefile3
-rw-r--r--sbin/routed/rtquery/Makefile3
-rw-r--r--sbin/savecore/Makefile3
-rw-r--r--sbin/setkey/Makefile6
-rw-r--r--sbin/sunlabel/Makefile3
-rw-r--r--sbin/swapon/Makefile3
-rw-r--r--sbin/tunefs/Makefile3
69 files changed, 357 insertions, 757 deletions
diff --git a/sbin/atm/atmconfig/Makefile b/sbin/atm/atmconfig/Makefile
index f3dce2663f9a..1e48f0454d32 100644
--- a/sbin/atm/atmconfig/Makefile
+++ b/sbin/atm/atmconfig/Makefile
@@ -17,11 +17,9 @@ CFLAGS+= -I${.OBJDIR}
.if !defined(RESCUE) && ${MK_BSNMP} != "no"
CFLAGS+= -DWITH_BSNMP
SRCS+= oid.h atmconfig_device.c
-DPADD+= ${LIBBSNMP}
-LDADD+= -lbsnmp
+LIBADD+= bsnmp
. if ${MK_DYNAMICROOT} == "no" && ${MK_OPENSSL} != "no"
-DPADD+= ${LIBCRYPTO}
-LDADD+= -lcrypto
+LIBADD+= crypto
. endif
.endif
diff --git a/sbin/badsect/Makefile b/sbin/badsect/Makefile
index b6cb545e09f5..c11f8cba506a 100644
--- a/sbin/badsect/Makefile
+++ b/sbin/badsect/Makefile
@@ -2,8 +2,7 @@
# $FreeBSD$
PROG= badsect
-DPADD= ${LIBUFS}
-LDADD= -lufs
+LIBADD= ufs
MAN= badsect.8
WARNS?= 2
diff --git a/sbin/bsdlabel/Makefile b/sbin/bsdlabel/Makefile
index e51e928afb24..42f0f1c3861a 100644
--- a/sbin/bsdlabel/Makefile
+++ b/sbin/bsdlabel/Makefile
@@ -12,7 +12,6 @@ LINKS= ${BINDIR}/bsdlabel ${BINDIR}/disklabel
MLINKS= bsdlabel.8 disklabel.8
.endif
-DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
-LDADD= -lgeom -lbsdxml -lsbuf
+LIBADD= geom
.include <bsd.prog.mk>
diff --git a/sbin/camcontrol/Makefile b/sbin/camcontrol/Makefile
index 4f11f195db5b..f23ef521a8b7 100644
--- a/sbin/camcontrol/Makefile
+++ b/sbin/camcontrol/Makefile
@@ -11,8 +11,7 @@ CFLAGS+= -DMINIMALISTIC
.if ${MACHINE_CPUARCH} == "arm"
WARNS?= 3
.endif
-DPADD= ${LIBCAM} ${LIBSBUF} ${LIBUTIL}
-LDADD= -lcam -lsbuf -lutil
+LIBADD= cam sbuf util
MAN= camcontrol.8
.include <bsd.prog.mk>
diff --git a/sbin/casperd/Makefile b/sbin/casperd/Makefile
index f5a8e05860a8..93f145ceeb38 100644
--- a/sbin/casperd/Makefile
+++ b/sbin/casperd/Makefile
@@ -4,8 +4,7 @@ PROG= casperd
SRCS= casperd.c zygote.c
-DPADD= ${LIBCASPER} ${LIBCAPSICUM} ${LIBNV} ${LIBPJDLOG} ${LIBUTIL}
-LDADD= -lcasper -lcapsicum -lnv -lpjdlog -lutil
+LIBADD= casper nv pjdlog util
MAN= casperd.8
diff --git a/sbin/ccdconfig/Makefile b/sbin/ccdconfig/Makefile
index 0feca5426dec..3b64dafb5c83 100644
--- a/sbin/ccdconfig/Makefile
+++ b/sbin/ccdconfig/Makefile
@@ -3,7 +3,6 @@
PROG= ccdconfig
MAN= ccdconfig.8
-DPADD= ${LIBGEOM}
-LDADD= -lgeom
+LIBADD= geom
.include <bsd.prog.mk>
diff --git a/sbin/ddb/Makefile b/sbin/ddb/Makefile
index c556be12f016..72abbed337ae 100644
--- a/sbin/ddb/Makefile
+++ b/sbin/ddb/Makefile
@@ -5,7 +5,6 @@ SRCS= ddb.c ddb_capture.c ddb_script.c
MAN= ddb.8
WARNS?= 3
-DPADD= ${LIBKVM}
-LDADD= -lkvm
+LIBADD= kvm
.include <bsd.prog.mk>
diff --git a/sbin/devd/Makefile b/sbin/devd/Makefile
index 518e5e2c21d5..fc0021656beb 100644
--- a/sbin/devd/Makefile
+++ b/sbin/devd/Makefile
@@ -10,8 +10,7 @@ WARNS?= 3
NO_SHARED?=YES
-DPADD= ${LIBL} ${LIBUTIL}
-LDADD= -ll -lutil
+LIBADD= l util
YFLAGS+=-v
CFLAGS+=-I. -I${.CURDIR}
diff --git a/sbin/dhclient/Makefile b/sbin/dhclient/Makefile
index 09f19db0747e..868df6d6ba65 100644
--- a/sbin/dhclient/Makefile
+++ b/sbin/dhclient/Makefile
@@ -41,8 +41,7 @@ PROG= dhclient
SCRIPTS=dhclient-script
MAN= dhclient.8 dhclient.conf.5 dhclient.leases.5 dhcp-options.5 \
dhclient-script.8
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
WARNS?= 2
diff --git a/sbin/dmesg/Makefile b/sbin/dmesg/Makefile
index 266551be5765..64a0155917be 100644
--- a/sbin/dmesg/Makefile
+++ b/sbin/dmesg/Makefile
@@ -4,7 +4,6 @@
PROG= dmesg
MAN= dmesg.8
-LDADD= -lkvm
-DPADD= ${LIBKVM}
+LIBADD= kvm
.include <bsd.prog.mk>
diff --git a/sbin/dumpfs/Makefile b/sbin/dumpfs/Makefile
index fe464e03f7be..87eb89b1782e 100644
--- a/sbin/dumpfs/Makefile
+++ b/sbin/dumpfs/Makefile
@@ -3,8 +3,7 @@
PROG= dumpfs
WARNS?= 2
-DPADD= ${LIBUFS}
-LDADD= -lufs
+LIBADD= ufs
MAN= dumpfs.8
.include <bsd.prog.mk>
diff --git a/sbin/fdisk/Makefile b/sbin/fdisk/Makefile
index 795377917e1c..a49c69954d0f 100644
--- a/sbin/fdisk/Makefile
+++ b/sbin/fdisk/Makefile
@@ -7,8 +7,7 @@ MAN= fdisk.8
.PATH: ${.CURDIR}/../../sys/geom
-DPADD+= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
-LDADD+= -lgeom -lbsdxml -lsbuf
+LIBADD= geom
.include <bsd.prog.mk>
diff --git a/sbin/fdisk_pc98/Makefile b/sbin/fdisk_pc98/Makefile
index 6961d31d58a8..9915267e6d7c 100644
--- a/sbin/fdisk_pc98/Makefile
+++ b/sbin/fdisk_pc98/Makefile
@@ -7,7 +7,6 @@ MAN= fdisk.8
.PATH: ${.CURDIR}/../../sys/geom
-DPADD+= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
-LDADD+= -lgeom -lbsdxml -lsbuf
+LIBADD= geom
.include <bsd.prog.mk>
diff --git a/sbin/ffsinfo/Makefile b/sbin/ffsinfo/Makefile
index cb4e8f945979..7fd033d3475a 100644
--- a/sbin/ffsinfo/Makefile
+++ b/sbin/ffsinfo/Makefile
@@ -13,7 +13,6 @@ MAN= ffsinfo.8
WARNS?= 1
CFLAGS+=-DFS_DEBUG -I${GROWFS}
-DPADD= ${LIBUFS}
-LDADD= -lufs
+LIBADD= ufs
.include <bsd.prog.mk>
diff --git a/sbin/fsck_ffs/Makefile b/sbin/fsck_ffs/Makefile
index 028a4867c85d..02754697dfa5 100644
--- a/sbin/fsck_ffs/Makefile
+++ b/sbin/fsck_ffs/Makefile
@@ -9,8 +9,7 @@ MLINKS= fsck_ffs.8 fsck_ufs.8 fsck_ffs.8 fsck_4.2bsd.8
SRCS= dir.c ea.c fsutil.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c \
pass4.c pass5.c setup.c suj.c utilities.c gjournal.c getmntopts.c \
globs.c
-DPADD= ${LIBUFS}
-LDADD= -lufs
+LIBADD= ufs
WARNS?= 2
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../mount
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c
index 7640f704b76a..9203000f4fce 100644
--- a/sbin/fsck_ffs/dir.c
+++ b/sbin/fsck_ffs/dir.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/time.h>
+#include <sys/types.h>
#include <sys/sysctl.h>
#include <ufs/ufs/dinode.h>
diff --git a/sbin/fsdb/Makefile b/sbin/fsdb/Makefile
index 21ac09f9c66d..e0a9cc3cb382 100644
--- a/sbin/fsdb/Makefile
+++ b/sbin/fsdb/Makefile
@@ -9,8 +9,7 @@ SRCS= fsdb.c fsdbutil.c \
pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c globs.c
CFLAGS+= -I${.CURDIR}/../fsck_ffs
WARNS?= 2
-LDADD= -ledit -ltermcapw
-DPADD= ${LIBEDIT} ${LIBTERMCAPW}
+LIBADD= edit
.PATH: ${.CURDIR}/../fsck_ffs ${.CURDIR}/../../sys/ufs/ffs
.include <bsd.prog.mk>
diff --git a/sbin/gbde/Makefile b/sbin/gbde/Makefile
index 019ee18f8af3..c33136b05e14 100644
--- a/sbin/gbde/Makefile
+++ b/sbin/gbde/Makefile
@@ -20,8 +20,7 @@ CFLAGS+= -I${.CURDIR}/../../sys
CLEANFILES+= template.c
MAN= gbde.8
-DPADD= ${LIBMD} ${LIBUTIL} ${LIBGEOM}
-LDADD= -lmd -lutil -lgeom
+LIBADD= md util geom
template.c: template.txt
file2c 'const char template[] = {' ',0};' \
diff --git a/sbin/geom/Makefile b/sbin/geom/Makefile
index ced58425c657..19a56360ccce 100644
--- a/sbin/geom/Makefile
+++ b/sbin/geom/Makefile
@@ -14,8 +14,7 @@ MAN=
WARNS?= 2
CFLAGS+=-I${.CURDIR} -I${.CURDIR}/core -DSTATIC_GEOM_CLASSES
-DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
-LDADD= -lgeom -lsbuf -lbsdxml -lutil
+LIBADD= geom util
.include <bsd.prog.mk>
diff --git a/sbin/geom/class/eli/Makefile b/sbin/geom/class/eli/Makefile
index 119566876d71..f8e453dc616c 100644
--- a/sbin/geom/class/eli/Makefile
+++ b/sbin/geom/class/eli/Makefile
@@ -8,8 +8,7 @@ SRCS+= g_eli_key.c
SRCS+= pkcs5v2.c
SRCS+= sha2.c
-DPADD= ${LIBMD} ${LIBCRYPTO}
-LDADD= -lmd -lcrypto
+LIBADD= md crypto
WARNS?= 3
diff --git a/sbin/geom/class/journal/Makefile b/sbin/geom/class/journal/Makefile
index 2db8d3002734..0e1a38ea6dc4 100644
--- a/sbin/geom/class/journal/Makefile
+++ b/sbin/geom/class/journal/Makefile
@@ -5,8 +5,7 @@
GEOM_CLASS= journal
SRCS+= geom_journal_ufs.c
-DPADD= ${LIBMD} ${LIBUFS}
-LDADD= -lmd -lufs
+LIBADD= ufs md
CFLAGS+=-I${.CURDIR}/../../../../sys
diff --git a/sbin/geom/class/mirror/Makefile b/sbin/geom/class/mirror/Makefile
index e38d617b6da5..ce7ee6466326 100644
--- a/sbin/geom/class/mirror/Makefile
+++ b/sbin/geom/class/mirror/Makefile
@@ -4,7 +4,6 @@
GEOM_CLASS= mirror
-DPADD= ${LIBMD}
-LDADD= -lmd
+LIBADD= md
.include <bsd.lib.mk>
diff --git a/sbin/geom/class/part/Makefile b/sbin/geom/class/part/Makefile
index 341cd42b8c97..4b67de4ef415 100644
--- a/sbin/geom/class/part/Makefile
+++ b/sbin/geom/class/part/Makefile
@@ -4,7 +4,6 @@
GEOM_CLASS= part
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
.include <bsd.lib.mk>
diff --git a/sbin/geom/class/raid/Makefile b/sbin/geom/class/raid/Makefile
index 743f690f0fd9..07d71403d48f 100644
--- a/sbin/geom/class/raid/Makefile
+++ b/sbin/geom/class/raid/Makefile
@@ -4,7 +4,6 @@
GEOM_CLASS= raid
-DPADD= ${LIBMD}
-LDADD= -lmd
+LIBADD= md
.include <bsd.lib.mk>
diff --git a/sbin/geom/class/raid3/Makefile b/sbin/geom/class/raid3/Makefile
index d2405d4b4f5d..74e12455a432 100644
--- a/sbin/geom/class/raid3/Makefile
+++ b/sbin/geom/class/raid3/Makefile
@@ -4,7 +4,6 @@
GEOM_CLASS= raid3
-DPADD= ${LIBMD}
-LDADD= -lmd
+LIBADD= md
.include <bsd.lib.mk>
diff --git a/sbin/geom/core/Makefile b/sbin/geom/core/Makefile
index 64edc793a95e..0636d037a358 100644
--- a/sbin/geom/core/Makefile
+++ b/sbin/geom/core/Makefile
@@ -11,7 +11,6 @@ NO_SHARED=NO
CFLAGS+= -DGEOM_CLASS_DIR=\"${GEOM_CLASS_DIR}\"
CFLAGS+= -I${.CURDIR}/../../../sys -I${.CURDIR} -I${.CURDIR}/..
-DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
-LDADD= -lgeom -lsbuf -lbsdxml -lutil
+LIBADD= geom util
.include <bsd.prog.mk>
diff --git a/sbin/ggate/ggatec/Makefile b/sbin/ggate/ggatec/Makefile
index 4d8917f3164c..e228feaf471a 100644
--- a/sbin/ggate/ggatec/Makefile
+++ b/sbin/ggate/ggatec/Makefile
@@ -10,7 +10,6 @@ CFLAGS+= -DMAX_SEND_SIZE=32768
CFLAGS+= -DLIBGEOM
CFLAGS+= -I${.CURDIR}/../shared
-DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL} ${LIBPTHREAD}
-LDADD= -lgeom -lsbuf -lbsdxml -lutil -lpthread
+LIBADD= geom util pthread
.include <bsd.prog.mk>
diff --git a/sbin/ggate/ggated/Makefile b/sbin/ggate/ggated/Makefile
index 4e7708ebffa3..af5c9bdf796a 100644
--- a/sbin/ggate/ggated/Makefile
+++ b/sbin/ggate/ggated/Makefile
@@ -6,8 +6,7 @@ PROG= ggated
MAN= ggated.8
SRCS= ggated.c ggate.c
-DPADD= ${LIBPTHREAD}
-LDADD= -lpthread
+LIBADD= pthread
CFLAGS+= -I${.CURDIR}/../shared
diff --git a/sbin/ggate/ggatel/Makefile b/sbin/ggate/ggatel/Makefile
index 604a75480313..be88bd496c36 100644
--- a/sbin/ggate/ggatel/Makefile
+++ b/sbin/ggate/ggatel/Makefile
@@ -9,7 +9,6 @@ SRCS= ggatel.c ggate.c
CFLAGS+= -DLIBGEOM
CFLAGS+= -I${.CURDIR}/../shared
-DPADD= ${LIBGEOM} ${LIBSBUF} ${LIBBSDXML} ${LIBUTIL}
-LDADD= -lgeom -lsbuf -lbsdxml -lutil
+LIBADD= geom util
.include <bsd.prog.mk>
diff --git a/sbin/growfs/Makefile b/sbin/growfs/Makefile
index 025771fa0370..1f7422e6d4a9 100644
--- a/sbin/growfs/Makefile
+++ b/sbin/growfs/Makefile
@@ -19,11 +19,10 @@ CFLAGS+=-I${.CURDIR}/../mount
SRCS+= debug.c
.endif
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
.if ${MK_TESTS} != "no"
SUBDIR+= tests
.endif
-.include <bsd.prog.mk>
+.include <bsd.prog.mk>
diff --git a/sbin/gvinum/Makefile b/sbin/gvinum/Makefile
index 1b5f948ce893..0e56920d9cee 100644
--- a/sbin/gvinum/Makefile
+++ b/sbin/gvinum/Makefile
@@ -7,8 +7,7 @@ MAN= gvinum.8
WARNS?= 2
CFLAGS+= -I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit
-DPADD= ${LIBEDIT} ${LIBTERMCAPW} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM}
-LDADD= -ledit -ltermcapw -ldevstat -lkvm -lgeom
+LIBADD= edit geom
.PATH: ${.CURDIR}/../../sys/geom/vinum
diff --git a/sbin/hastctl/Makefile b/sbin/hastctl/Makefile
index 89b972e56705..41d443d32783 100644
--- a/sbin/hastctl/Makefile
+++ b/sbin/hastctl/Makefile
@@ -32,11 +32,9 @@ CFLAGS+=-DINET6
CFLAGS+=-DYY_NO_UNPUT
CFLAGS+=-DYY_NO_INPUT
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
.if ${MK_OPENSSL} != "no"
-DPADD+= ${LIBCRYPTO}
-LDADD+= -lcrypto
+LIBADD+= crypto
CFLAGS+=-DHAVE_CRYPTO
.endif
diff --git a/sbin/hastd/Makefile b/sbin/hastd/Makefile
index 3604b5bab41d..e3fed8d0b522 100644
--- a/sbin/hastd/Makefile
+++ b/sbin/hastd/Makefile
@@ -30,11 +30,9 @@ CFLAGS+=-DINET
CFLAGS+=-DINET6
.endif
-DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBPTHREAD} ${LIBUTIL}
-LDADD= -lgeom -lbsdxml -lsbuf -lpthread -lutil
+LIBADD= geom pthread util
.if ${MK_OPENSSL} != "no"
-DPADD+= ${LIBCRYPTO}
-LDADD+= -lcrypto
+LIBADD+= crypto
CFLAGS+=-DHAVE_CRYPTO
.endif
diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile
index 8aba6b466255..885f8a9922bd 100644
--- a/sbin/ifconfig/Makefile
+++ b/sbin/ifconfig/Makefile
@@ -35,12 +35,10 @@ SRCS+= ifgre.c # GRE keys etc
SRCS+= ifgif.c # GIF reversed header workaround
SRCS+= sfp.c # SFP/SFP+ information
-DPADD+= ${LIBM}
-LDADD+= -lm
+LIBADD+= m
SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support
-DPADD+= ${LIBBSDXML} ${LIBSBUF}
-LDADD+= -lbsdxml -lsbuf
+LIBADD+= bsdxml sbuf
SRCS+= carp.c # SIOC[GS]VH support
SRCS+= ifgroup.c # ...
@@ -59,8 +57,7 @@ CFLAGS+= -DINET
.endif
.if ${MK_JAIL} != "no" && !defined(RELEASE_CRUNCH) && !defined(RESCUE)
CFLAGS+= -DJAIL
-DPADD+= ${LIBJAIL}
-LDADD+= -ljail
+LIBADD+= jail
.endif
MAN= ifconfig.8
diff --git a/sbin/init/Makefile b/sbin/init/Makefile
index 7497a4b54fd7..6e9c0fc99c67 100644
--- a/sbin/init/Makefile
+++ b/sbin/init/Makefile
@@ -6,8 +6,7 @@ MAN= init.8
PRECIOUSPROG=
INSTALLFLAGS=-b -B.bak
CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT
-DPADD= ${LIBUTIL} ${LIBCRYPT}
-LDADD= -lutil -lcrypt
+LIBADD= util crypt
NO_SHARED?= YES
diff --git a/sbin/ipf/Makefile.inc b/sbin/ipf/Makefile.inc
index 2d7d7b1c71bf..79bdb8e378db 100644
--- a/sbin/ipf/Makefile.inc
+++ b/sbin/ipf/Makefile.inc
@@ -18,9 +18,7 @@ CFLAGS+= -DUSE_INET6
CFLAGS+= -DNOINET6
.endif
-LIBIPF= ${.OBJDIR}/../libipf/libipf.a
-DPADD+= ${LIBIPF} ${LIBKVM}
-LDADD+= ${LIBIPF} -lkvm
+LIBADD+= ipf
CLEANFILES+= y.tab.c y.tab.h
diff --git a/sbin/ipf/ipf/Makefile b/sbin/ipf/ipf/Makefile
index c3938c63af61..3ffd2b272489 100644
--- a/sbin/ipf/ipf/Makefile
+++ b/sbin/ipf/ipf/Makefile
@@ -35,8 +35,7 @@ ipf_l.h: lexer.h
LIBIPF_SRCS!= cd ${.CURDIR}/../libipf && ${MAKE} -V SRCS
SRCS+= ${LIBIPF_SRCS}
.else
-DPADD+= ${LIBPCAP}
-LDADD+= -lpcap
+LIBADD+= pcap
.endif
.include <bsd.prog.mk>
diff --git a/sbin/ipf/ipfstat/Makefile b/sbin/ipf/ipfstat/Makefile
index a33c5df38d8f..14823cf5110c 100644
--- a/sbin/ipf/ipfstat/Makefile
+++ b/sbin/ipf/ipfstat/Makefile
@@ -5,7 +5,6 @@ NOGCCERROR= # defined
PROG= ipfstat
SRCS= ipfstat.c
MAN= ipfstat.8
-DPADD+= ${LIBCURSES}
-LDADD+= -lcurses
+LIBADD+= ncursesw
.include <bsd.prog.mk>
diff --git a/sbin/ipf/ipsend/Makefile b/sbin/ipf/ipsend/Makefile
index 4ae4c3441bbb..176cb106baff 100644
--- a/sbin/ipf/ipsend/Makefile
+++ b/sbin/ipf/ipsend/Makefile
@@ -8,8 +8,7 @@ PROG= ipsend
SRCS= ipsend.c ip.c ipsopt.c iplang_y.c iplang_l.l sbpf.c \
sock.c 44arp.c
MAN= ipsend.1 ipsend.5
-DPADD+= ${LIBL}
-LDADD+= -ll
+LIBADD+= l
CFLAGS+= -I${NETBSDSRCDIR}/dist/ipf/ipsend
CFLAGS+= -I${NETBSDSRCDIR}/dist/ipf/iplang
diff --git a/sbin/ipfw/Makefile b/sbin/ipfw/Makefile
index 9eb4511fb3c9..efd99fcdf316 100644
--- a/sbin/ipfw/Makefile
+++ b/sbin/ipfw/Makefile
@@ -11,8 +11,7 @@ SRCS+= altq.c
CFLAGS+=-DPF
.endif
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
MAN= ipfw.8
.include <bsd.prog.mk>
diff --git a/sbin/iscontrol/Makefile b/sbin/iscontrol/Makefile
index 9bdc29bc5b70..a79233fdcfa5 100644
--- a/sbin/iscontrol/Makefile
+++ b/sbin/iscontrol/Makefile
@@ -2,8 +2,7 @@
SRCS= iscontrol.c pdu.c fsm.c config.c login.c auth_subr.c misc.c
PROG= iscontrol
-DPADD= ${LIBCAM} ${LIBMD}
-LDADD= -lcam -lmd
+LIBADD= cam md
S= ${.CURDIR}/../../sys
WARNS?= 3
diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile
index eabf129f6b43..a16d46004315 100644
--- a/sbin/md5/Makefile
+++ b/sbin/md5/Makefile
@@ -16,7 +16,6 @@ MLINKS= md5.1 rmd160.1 \
NO_WMISSING_VARIABLE_DECLARATIONS=
WFORMAT?= 1
-DPADD= ${LIBMD}
-LDADD= -lmd
+LIBADD= md
.include <bsd.prog.mk>
diff --git a/sbin/mdconfig/Makefile b/sbin/mdconfig/Makefile
index 69a688cdc389..6be9129144e7 100644
--- a/sbin/mdconfig/Makefile
+++ b/sbin/mdconfig/Makefile
@@ -5,8 +5,7 @@
PROG= mdconfig
MAN= mdconfig.8
-DPADD= ${LIBUTIL} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
-LDADD= -lutil -lgeom -lbsdxml -lsbuf
+LIBADD= util geom
.if ${MK_TESTS} != "no"
SUBDIR+= tests
diff --git a/sbin/mdconfig/tests/Makefile b/sbin/mdconfig/tests/Makefile
index 17284bb6ee22..08a9e47e90dc 100644
--- a/sbin/mdconfig/tests/Makefile
+++ b/sbin/mdconfig/tests/Makefile
@@ -2,12 +2,9 @@
TESTSDIR= ${TESTSBASE}/sbin/mdconfig
-TAP_TESTS_SH= legacy_test
-TAP_TESTS_SH_SED_legacy_test= 's,__PERL__,${TAP_PERL_INTERPRETER},g'
-TEST_METADATA.legacy_test+= required_programs="${TAP_PERL_INTERPRETER}"
+ATF_TESTS_SH= mdconfig_test
-FILESDIR= ${TESTSDIR}
-FILES= mdconfig.test
-FILES+= run.pl
+
+TEST_METADATA.mdconfig_test+= required_user="root"
.include <bsd.test.mk>
diff --git a/sbin/mdconfig/tests/legacy_test.sh b/sbin/mdconfig/tests/legacy_test.sh
deleted file mode 100644
index 728224dbd975..000000000000
--- a/sbin/mdconfig/tests/legacy_test.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Edward Tomasz Napierała <trasz@FreeBSD.org>
-# 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$
-#
-
-# This is a wrapper script to run mdconfig.test.
-
-echo "1..1"
-
-if [ `whoami` != "root" ]; then
- echo "ok 1 # skip You need to be root to run this test."
- exit 0
-fi
-
-TESTDIR=$(dirname $(realpath $0))
-
-__PERL__ -w -U $TESTDIR/run.pl $TESTDIR/mdconfig.test > /dev/null
-
-if [ $? -eq 0 ]; then
- echo "ok 1"
-else
- echo "not ok 1"
-fi
diff --git a/sbin/mdconfig/tests/mdconfig.test b/sbin/mdconfig/tests/mdconfig.test
deleted file mode 100644
index 65d3670b57c3..000000000000
--- a/sbin/mdconfig/tests/mdconfig.test
+++ /dev/null
@@ -1,231 +0,0 @@
-# Copyright (c) 2012 Edward Tomasz Napierała <trasz@FreeBSD.org>
-# 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$
-#
-
-# This is a test for mdconfig(8) functionality. Run it as root:
-#
-# /usr/src/tools/regression/mdconfig/run /usr/src/tools/regression/mdconfig/mdconfig.test
-#
-# WARNING: Creates files in unsafe way.
-
-$ whoami
-> root
-$ umask 022
-$ truncate -s 1gb xxx
-
-$ mdconfig -l
-
-$ mdconfig -af xxx
-> md0
-
-# This awk thing is to strip the file path.
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 vnode 1024M
-
-$ diskinfo -v /dev/md0 | expand
-> /dev/md0
-> 512 # sectorsize
-> 1073741824 # mediasize in bytes (1.0G)
-> 2097152 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 0
-
-# Check different valid syntax variations: implicit -a.
-
-$ mdconfig xxx
-> md0
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 vnode 1024M
-
-$ diskinfo -v /dev/md0 | expand
-> /dev/md0
-> 512 # sectorsize
-> 1073741824 # mediasize in bytes (1.0G)
-> 2097152 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 0
-
-# Explicit -t vnode.
-
-$ mdconfig -a -t vnode -f xxx
-> md0
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 vnode 1024M
-
-$ diskinfo -v /dev/md0 | expand
-> /dev/md0
-> 512 # sectorsize
-> 1073741824 # mediasize in bytes (1.0G)
-> 2097152 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 0
-
-# Size for vnodes - smaller than the actual file.
-
-$ mdconfig -a -t vnode -f xxx -s 128m
-> md0
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 vnode 128M
-
-$ diskinfo -v /dev/md0 | expand
-> /dev/md0
-> 512 # sectorsize
-> 134217728 # mediasize in bytes (128M)
-> 262144 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 0
-
-# Size for vnodes - larger than the actual file.
-
-$ mdconfig -a -t vnode -f xxx -s 128g
-> md0
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 vnode 128G
-
-$ diskinfo -v /dev/md0 | expand
-> /dev/md0
-> 512 # sectorsize
-> 137438953472 # mediasize in bytes (128G)
-> 268435456 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 0
-
-# Sector size for vnodes.
-
-$ mdconfig -a -t vnode -f xxx -S 2048
-> md0
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 vnode 1024M
-
-$ diskinfo -v /dev/md0 | expand
-> /dev/md0
-> 2048 # sectorsize
-> 1073741824 # mediasize in bytes (1.0G)
-> 524288 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 0
-
-# Malloc type.
-
-$ mdconfig -a -t malloc -s 1g
-> md0
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 malloc 1024M
-
-$ diskinfo -v /dev/md0 | expand
-> /dev/md0
-> 512 # sectorsize
-> 1073741824 # mediasize in bytes (1.0G)
-> 2097152 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 0
-
-# Swap type.
-
-$ mdconfig -a -t swap -s 1g
-> md0
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 swap 1024M
-
-$ diskinfo -v /dev/md0 | expand
-> /dev/md0
-> 512 # sectorsize
-> 1073741824 # mediasize in bytes (1.0G)
-> 2097152 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 0
-
-# Attaching with a specific unit number.
-
-$ mdconfig -as 1g -u 42
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md42 swap 1024M
-
-$ diskinfo -v /dev/md42 | expand
-> /dev/md42
-> 512 # sectorsize
-> 1073741824 # mediasize in bytes (1.0G)
-> 2097152 # mediasize in sectors
-> 0 # stripesize
-> 0 # stripeoffset
->
-
-$ mdconfig -du 42
-
-# Querying.
-
-$ mdconfig -as 1g
-> md0
-$ mdconfig -as 2g -u 42
-
-$ mdconfig -lv | awk '{ print $1, $2, $3 }'
-> md0 swap 1024M
-> md42 swap 2048M
-
-$ mdconfig -lvu 0 | awk '{ print $1, $2, $3 }'
-> md0 swap 1024M
-
-$ mdconfig -lvu 42 | awk '{ print $1, $2, $3 }'
-> md42 swap 2048M
-
-$ mdconfig -lvu 24 | awk '{ print $1, $2, $3 }'
-
-$ mdconfig -du 42
-$ mdconfig -du 0
-
-$ rm xxx
diff --git a/sbin/mdconfig/tests/mdconfig_test.sh b/sbin/mdconfig/tests/mdconfig_test.sh
new file mode 100755
index 000000000000..d12e565db4aa
--- /dev/null
+++ b/sbin/mdconfig/tests/mdconfig_test.sh
@@ -0,0 +1,281 @@
+# Copyright (c) 2012 Edward Tomasz Napierała <trasz@FreeBSD.org>
+# 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$
+#
+
+check_diskinfo()
+{
+ local md=$1
+ local mediasize_in_bytes=$2
+ local mediasize_in_sectors=$3
+ local sectorsize=${4:-512}
+ local stripesize=${5:-0}
+ local stripeoffset=${6:-0}
+
+ atf_check -s exit:0 \
+ -o match:"/dev/$md *$sectorsize *$mediasize_in_bytes *$mediasize_in_sectors *$stripesize *$stripeoffset" \
+ -x "diskinfo /dev/$md | expand"
+}
+
+cleanup_common()
+{
+ if [ -f mdconfig.out ]; then
+ mdconfig -d -u $(sed -e 's/md//' mdconfig.out)
+ fi
+}
+
+atf_test_case attach_vnode_non_explicit_type cleanup
+attach_vnode_non_explicit_type_head()
+{
+ atf_set "descr" "Tests out -a / -f without -t"
+}
+attach_vnode_non_explicit_type_body()
+{
+ local md
+ local size_in_mb=1024
+
+ atf_check -s exit:0 -x "truncate -s ${size_in_mb}m xxx"
+ atf_check -s exit:0 -o save:mdconfig.out -x 'mdconfig -af xxx'
+ md=$(cat mdconfig.out)
+ atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
+ check_diskinfo "$md" "1073741824" "2097152"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_vnode_non_explicit_type_cleanup()
+{
+ cleanup_common
+}
+
+atf_test_case attach_vnode_implicit_a_f cleanup
+attach_vnode_implicit_a_f_head()
+{
+ atf_set "descr" "Tests out implied -a / -f without -t"
+}
+attach_vnode_implicit_a_f_body()
+{
+ local md
+ local size_in_mb=1024
+
+ atf_check -s exit:0 -x "truncate -s ${size_in_mb}m xxx"
+ atf_check -s exit:0 -o save:mdconfig.out -x 'mdconfig xxx'
+ md=$(cat mdconfig.out)
+ atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
+ check_diskinfo "$md" "1073741824" "2097152"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_vnode_implicit_a_f_cleanup()
+{
+ cleanup_common
+}
+
+atf_test_case attach_vnode_explicit_type cleanup
+attach_vnode_explicit_type_head()
+{
+ atf_set "descr" "Tests out implied -a / -f with -t vnode"
+}
+attach_vnode_explicit_type_body()
+{
+ local md
+ local size_in_mb=1024
+
+ atf_check -s exit:0 -x "truncate -s ${size_in_mb}m xxx"
+ atf_check -s exit:0 -o save:mdconfig.out -x 'mdconfig -af xxx -t vnode'
+ md=$(cat mdconfig.out)
+ atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
+ check_diskinfo "$md" "1073741824" "2097152"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_vnode_explicit_type_cleanup()
+{
+ [ -f mdconfig.out ] && mdconfig -d -u $(sed -e 's/md//' mdconfig.out)
+ rm -f mdconfig.out xxx
+}
+
+atf_test_case attach_vnode_smaller_than_file cleanup
+attach_vnode_smaller_than_file_head()
+{
+ atf_set "descr" "Tests mdconfig -s with size less than the file size"
+}
+attach_vnode_smaller_than_file_body()
+{
+ local md
+ local size_in_mb=128
+
+ atf_check -s exit:0 -x "truncate -s 1024m xxx"
+ atf_check -s exit:0 -o save:mdconfig.out \
+ -x "mdconfig -af xxx -s ${size_in_mb}m"
+ md=$(cat mdconfig.out)
+ atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
+ check_diskinfo "$md" "134217728" "262144"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_vnode_smaller_than_file_cleanup()
+{
+ cleanup_common
+}
+
+atf_test_case attach_vnode_larger_than_file cleanup
+attach_vnode_larger_than_file_head()
+{
+ atf_set "descr" "Tests mdconfig -s with size greater than the file size"
+}
+attach_vnode_larger_than_file_body()
+{
+ local md
+ local size_in_gb=128
+
+ atf_check -s exit:0 -x "truncate -s 1024m xxx"
+ atf_check -s exit:0 -o save:mdconfig.out \
+ -x "mdconfig -af xxx -s ${size_in_gb}g"
+ md=$(cat mdconfig.out)
+ atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
+ check_diskinfo "$md" "137438953472" "268435456"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md vnode ${size_in_gb}G$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_vnode_larger_than_file_cleanup()
+{
+ cleanup_common
+}
+
+atf_test_case attach_vnode_sector_size cleanup
+attach_vnode_sector_size_head()
+{
+ atf_set "descr" "Tests mdconfig -s with size greater than the file size"
+}
+attach_vnode_sector_size_body()
+{
+ local md
+ local size_in_mb=1024
+
+ atf_check -s exit:0 -x "truncate -s ${size_in_mb}m xxx"
+ atf_check -s exit:0 -o save:mdconfig.out \
+ -x "mdconfig -af xxx -S 2048"
+ md=$(cat mdconfig.out)
+ atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
+ check_diskinfo "$md" "1073741824" "524288" "2048"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md vnode ${size_in_mb}M$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_vnode_sector_size_cleanup()
+{
+ cleanup_common
+}
+
+atf_test_case attach_malloc cleanup
+attach_malloc_head()
+{
+ atf_set "descr" "Tests mdconfig with -t malloc"
+}
+attach_malloc_body()
+{
+ local md
+ local size_in_mb=1024
+
+ atf_check -s exit:0 -o save:mdconfig.out \
+ -x 'mdconfig -a -t malloc -s 1g'
+ md=$(cat mdconfig.out)
+ atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
+ check_diskinfo "$md" "1073741824" "2097152"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md malloc ${size_in_mb}M$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_malloc_cleanup()
+{
+ cleanup_common
+}
+
+atf_test_case attach_swap cleanup
+attach_swap_head()
+{
+ atf_set "descr" "Tests mdconfig with -t swap"
+}
+attach_swap_body()
+{
+ local md
+ local size_in_mb=1024
+
+ atf_check -s exit:0 -o save:mdconfig.out \
+ -x 'mdconfig -a -t swap -s 1g'
+ md=$(cat mdconfig.out)
+ atf_check -s exit:0 -o match:'^md[0-9]+$' -x "echo $md"
+ check_diskinfo "$md" "1073741824" "2097152"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md swap ${size_in_mb}M$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_swap_cleanup()
+{
+ cleanup_common
+}
+
+atf_test_case attach_with_specific_unit_number cleanup
+attach_with_specific_unit_number_head()
+{
+ atf_set "descr" "Tests mdconfig with a unit specified by -u"
+}
+attach_with_specific_unit_number_body()
+{
+ local md_unit=99
+ local size_in_mb=10
+
+ local md="md${md_unit}"
+
+ echo "$md" > mdconfig.out
+
+ atf_check -s exit:0 -o empty \
+ -x "mdconfig -a -t malloc -s ${size_in_mb}m -u $md_unit"
+ check_diskinfo "$md" "10485760" "20480"
+ # This awk strips the file path.
+ atf_check -s exit:0 -o match:"^$md malloc "$size_in_mb"M$" \
+ -x "mdconfig -lv | awk '\$1 == \"$md\" { print \$1, \$2, \$3 }'"
+}
+attach_with_specific_unit_number_cleanup()
+{
+ cleanup_common
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case attach_vnode_non_explicit_type
+ atf_add_test_case attach_vnode_explicit_type
+ atf_add_test_case attach_vnode_smaller_than_file
+ atf_add_test_case attach_vnode_larger_than_file
+ atf_add_test_case attach_vnode_sector_size
+ atf_add_test_case attach_malloc
+ atf_add_test_case attach_swap
+ atf_add_test_case attach_with_specific_unit_number
+}
diff --git a/sbin/mdconfig/tests/run.pl b/sbin/mdconfig/tests/run.pl
deleted file mode 100644
index 383f47e62397..000000000000
--- a/sbin/mdconfig/tests/run.pl
+++ /dev/null
@@ -1,329 +0,0 @@
-#!/usr/bin/perl -w -U
-
-# Copyright (c) 2007, 2008 Andreas Gruenbacher.
-# 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,
-# without modification, immediately at the beginning of the file.
-# 2. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# Alternatively, this software may be distributed under the terms of the
-# GNU Public License ("GPL").
-#
-# 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$
-#
-
-#
-# Possible improvements:
-#
-# - distinguish stdout and stderr output
-# - add environment variable like assignments
-# - run up to a specific line
-# - resume at a specific line
-#
-
-use strict;
-use FileHandle;
-use Getopt::Std;
-use POSIX qw(isatty setuid getcwd);
-use vars qw($opt_l $opt_v);
-
-no warnings qw(taint);
-
-$opt_l = ~0; # a really huge number
-getopts('l:v');
-
-my ($OK, $FAILED) = ("ok", "failed");
-if (isatty(fileno(STDOUT))) {
- $OK = "\033[32m" . $OK . "\033[m";
- $FAILED = "\033[31m\033[1m" . $FAILED . "\033[m";
-}
-
-sub exec_test($$);
-sub process_test($$$$);
-
-my ($prog, $in, $out) = ([], [], []);
-my $prog_line = 0;
-my ($tests, $failed) = (0,0);
-my $lineno;
-my $width = ($ENV{COLUMNS} || 80) >> 1;
-
-for (;;) {
- my $line = <>; $lineno++;
- if (defined $line) {
- # Substitute %VAR and %{VAR} with environment variables.
- $line =~ s[%(\w+)][$ENV{$1}]eg;
- $line =~ s[%{(\w+)}][$ENV{$1}]eg;
- }
- if (defined $line) {
- if ($line =~ s/^\s*< ?//) {
- push @$in, $line;
- } elsif ($line =~ s/^\s*> ?//) {
- push @$out, $line;
- } else {
- process_test($prog, $prog_line, $in, $out);
- last if $prog_line >= $opt_l;
-
- $prog = [];
- $prog_line = 0;
- }
- if ($line =~ s/^\s*\$ ?//) {
- $prog = [ map { s/\\(.)/$1/g; $_ } split /(?<!\\)\s+/, $line ];
- $prog_line = $lineno;
- $in = [];
- $out = [];
- }
- } else {
- process_test($prog, $prog_line, $in, $out);
- last;
- }
-}
-
-my $status = sprintf("%d commands (%d passed, %d failed)",
- $tests, $tests-$failed, $failed);
-if (isatty(fileno(STDOUT))) {
- if ($failed) {
- $status = "\033[31m\033[1m" . $status . "\033[m";
- } else {
- $status = "\033[32m" . $status . "\033[m";
- }
-}
-print $status, "\n";
-exit $failed ? 1 : 0;
-
-
-sub process_test($$$$) {
- my ($prog, $prog_line, $in, $out) = @_;
-
- return unless @$prog;
-
- my $p = [ @$prog ];
- print "[$prog_line] \$ ", join(' ',
- map { s/\s/\\$&/g; $_ } @$p), " -- ";
- my $result = exec_test($prog, $in);
- my @good = ();
- my $nmax = (@$out > @$result) ? @$out : @$result;
- for (my $n=0; $n < $nmax; $n++) {
- my $use_re;
- if (defined $out->[$n] && $out->[$n] =~ /^~ /) {
- $use_re = 1;
- $out->[$n] =~ s/^~ //g;
- }
-
- if (!defined($out->[$n]) || !defined($result->[$n]) ||
- (!$use_re && $result->[$n] ne $out->[$n]) ||
- ( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
- push @good, ($use_re ? '!~' : '!=');
- }
- else {
- push @good, ($use_re ? '=~' : '==');
- }
- }
- my $good = !(grep /!/, @good);
- $tests++;
- $failed++ unless $good;
- print $good ? $OK : $FAILED, "\n";
- if (!$good || $opt_v) {
- for (my $n=0; $n < $nmax; $n++) {
- my $l = defined($out->[$n]) ? $out->[$n] : "~";
- chomp $l;
- my $r = defined($result->[$n]) ? $result->[$n] : "~";
- chomp $r;
- print sprintf("%-" . ($width-3) . "s %s %s\n",
- $r, $good[$n], $l);
- }
- }
-}
-
-
-sub su($) {
- my ($user) = @_;
-
- $user ||= "root";
-
- my ($login, $pass, $uid, $gid) = getpwnam($user)
- or return [ "su: user $user does not exist\n" ];
- my @groups = ();
- my $fh = new FileHandle("/etc/group")
- or return [ "opening /etc/group: $!\n" ];
- while (<$fh>) {
- chomp;
- my ($group, $passwd, $gid, $users) = split /:/;
- foreach my $u (split /,/, $users) {
- push @groups, $gid
- if ($user eq $u);
- }
- }
- $fh->close;
-
- my $groups = join(" ", ($gid, $gid, @groups));
- #print STDERR "[[$groups]]\n";
- $! = 0; # reset errno
- $> = 0;
- $( = $gid;
- $) = $groups;
- if ($!) {
- return [ "su: $!\n" ];
- }
- if ($uid != 0) {
- $> = $uid;
- #$< = $uid;
- if ($!) {
- return [ "su: $prog->[1]: $!\n" ];
- }
- }
- #print STDERR "[($>,$<)($(,$))]";
- return [];
-}
-
-
-sub sg($) {
- my ($group) = @_;
-
- my $gid = getgrnam($group)
- or return [ "sg: group $group does not exist\n" ];
- my %groups = map { $_ eq $gid ? () : ($_ => 1) } (split /\s/, $));
-
- #print STDERR "<<", join("/", keys %groups), ">>\n";
- my $groups = join(" ", ($gid, $gid, keys %groups));
- #print STDERR "[[$groups]]\n";
- $! = 0; # reset errno
- if ($> != 0) {
- my $uid = $>;
- $> = 0;
- $( = $gid;
- $) = $groups;
- $> = $uid;
- } else {
- $( = $gid;
- $) = $groups;
- }
- if ($!) {
- return [ "sg: $!\n" ];
- }
- print STDERR "[($>,$<)($(,$))]";
- return [];
-}
-
-
-sub exec_test($$) {
- my ($prog, $in) = @_;
- local (*IN, *IN_DUP, *IN2, *OUT_DUP, *OUT, *OUT2);
- my $needs_shell = (join('', @$prog) =~ /[][|<>"'`\$\*\?]/);
-
- if ($prog->[0] eq "umask") {
- umask oct $prog->[1];
- return [];
- } elsif ($prog->[0] eq "cd") {
- if (!chdir $prog->[1]) {
- return [ "chdir: $prog->[1]: $!\n" ];
- }
- $ENV{PWD} = getcwd;
- return [];
- } elsif ($prog->[0] eq "su") {
- return su($prog->[1]);
- } elsif ($prog->[0] eq "sg") {
- return sg($prog->[1]);
- } elsif ($prog->[0] eq "export") {
- my ($name, $value) = split /=/, $prog->[1];
- # FIXME: need to evaluate $value, so that things like this will work:
- # export dir=$PWD/dir
- $ENV{$name} = $value;
- return [];
- } elsif ($prog->[0] eq "unset") {
- delete $ENV{$prog->[1]};
- return [];
- }
-
- pipe *IN2, *OUT
- or die "Can't create pipe for reading: $!";
- open *IN_DUP, "<&STDIN"
- or *IN_DUP = undef;
- open *STDIN, "<&IN2"
- or die "Can't duplicate pipe for reading: $!";
- close *IN2;
-
- open *OUT_DUP, ">&STDOUT"
- or die "Can't duplicate STDOUT: $!";
- pipe *IN, *OUT2
- or die "Can't create pipe for writing: $!";
- open *STDOUT, ">&OUT2"
- or die "Can't duplicate pipe for writing: $!";
- close *OUT2;
-
- *STDOUT->autoflush();
- *OUT->autoflush();
-
- $SIG{CHLD} = 'IGNORE';
-
- if (fork()) {
- # Server
- if (*IN_DUP) {
- open *STDIN, "<&IN_DUP"
- or die "Can't duplicate STDIN: $!";
- close *IN_DUP
- or die "Can't close STDIN duplicate: $!";
- }
- open *STDOUT, ">&OUT_DUP"
- or die "Can't duplicate STDOUT: $!";
- close *OUT_DUP
- or die "Can't close STDOUT duplicate: $!";
-
- foreach my $line (@$in) {
- #print "> $line";
- print OUT $line;
- }
- close *OUT
- or die "Can't close pipe for writing: $!";
-
- my $result = [];
- while (<IN>) {
- #print "< $_";
- if ($needs_shell) {
- s#^/bin/sh: line \d+: ##;
- }
- push @$result, $_;
- }
- return $result;
- } else {
- # Client
- $< = $>;
- close IN
- or die "Can't close read end for input pipe: $!";
- close OUT
- or die "Can't close write end for output pipe: $!";
- close OUT_DUP
- or die "Can't close STDOUT duplicate: $!";
- local *ERR_DUP;
- open ERR_DUP, ">&STDERR"
- or die "Can't duplicate STDERR: $!";
- open STDERR, ">&STDOUT"
- or die "Can't join STDOUT and STDERR: $!";
-
- if ($needs_shell) {
- exec ('/bin/sh', '-c', join(" ", @$prog));
- } else {
- exec @$prog;
- }
- print STDERR $prog->[0], ": $!\n";
- exit;
- }
-}
-
diff --git a/sbin/mount/Makefile b/sbin/mount/Makefile
index c4d98f0fc56a..f95085a6cae7 100644
--- a/sbin/mount/Makefile
+++ b/sbin/mount/Makefile
@@ -6,7 +6,6 @@ SRCS= mount.c mount_fs.c getmntopts.c vfslist.c
MAN= mount.8 mount.conf.8
# We do NOT install the getmntopts.3 man page.
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
.include <bsd.prog.mk>
diff --git a/sbin/mount_cd9660/Makefile b/sbin/mount_cd9660/Makefile
index b889174ffa05..c70892c3309e 100644
--- a/sbin/mount_cd9660/Makefile
+++ b/sbin/mount_cd9660/Makefile
@@ -4,8 +4,7 @@
PROG= mount_cd9660
SRCS= mount_cd9660.c getmntopts.c
MAN= mount_cd9660.8
-DPADD= ${LIBKICONV}
-LDADD= -lkiconv
+LIBADD= kiconv
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT}
diff --git a/sbin/mount_msdosfs/Makefile b/sbin/mount_msdosfs/Makefile
index c3e416af21fc..ede86b4d8674 100644
--- a/sbin/mount_msdosfs/Makefile
+++ b/sbin/mount_msdosfs/Makefile
@@ -5,8 +5,7 @@
PROG= mount_msdosfs
SRCS= mount_msdosfs.c getmntopts.c
MAN= mount_msdosfs.8
-DPADD= ${LIBKICONV}
-LDADD= -lkiconv
+LIBADD= kiconv
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT}
diff --git a/sbin/mount_udf/Makefile b/sbin/mount_udf/Makefile
index 06ad9a768e4c..12d5d5822424 100644
--- a/sbin/mount_udf/Makefile
+++ b/sbin/mount_udf/Makefile
@@ -3,8 +3,7 @@
PROG= mount_udf
SRCS= mount_udf.c getmntopts.c
MAN= mount_udf.8
-DPADD= ${LIBKICONV}
-LDADD= -lkiconv
+LIBADD= kiconv
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys
diff --git a/sbin/nandfs/Makefile b/sbin/nandfs/Makefile
index 8474b09c522d..5757f8c16886 100644
--- a/sbin/nandfs/Makefile
+++ b/sbin/nandfs/Makefile
@@ -4,7 +4,6 @@ PROG= nandfs
SRCS= nandfs.c lssnap.c mksnap.c rmsnap.c
MAN= nandfs.8
-DPADD= ${LIBNANDFS}
-LDADD= -lnandfs
+LIBADD= nandfs
.include <bsd.prog.mk>
diff --git a/sbin/natd/Makefile b/sbin/natd/Makefile
index 7d8b3e49eae1..44e5b6f3b0f6 100644
--- a/sbin/natd/Makefile
+++ b/sbin/natd/Makefile
@@ -3,8 +3,7 @@
PROG = natd
SRCS = natd.c icmp.c
WARNS?= 3
-LDADD = -lalias
-DPADD = ${LIBALIAS}
+LIBADD = alias
MAN = natd.8
.include <bsd.prog.mk>
diff --git a/sbin/newfs/Makefile b/sbin/newfs/Makefile
index d45143ba7a83..83801fd38947 100644
--- a/sbin/newfs/Makefile
+++ b/sbin/newfs/Makefile
@@ -4,8 +4,7 @@
.PATH: ${.CURDIR}/../../sys/geom
PROG= newfs
-DPADD= ${LIBUFS} ${LIBUTIL}
-LDADD= -lufs -lutil
+LIBADD= ufs util
SRCS= newfs.c mkfs.c geom_bsd_enc.c
WARNS?= 3
diff --git a/sbin/newfs_nandfs/Makefile b/sbin/newfs_nandfs/Makefile
index 1d990eddf52c..7a39fbb088e6 100644
--- a/sbin/newfs_nandfs/Makefile
+++ b/sbin/newfs_nandfs/Makefile
@@ -3,7 +3,6 @@
PROG= newfs_nandfs
MAN= newfs_nandfs.8
-LDADD+= -lgeom
-DPADD+= ${LIBGEOM}
+LIBADD= geom
.include <bsd.prog.mk>
diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile
index 937f403569dd..de3b7ec5012c 100644
--- a/sbin/pfctl/Makefile
+++ b/sbin/pfctl/Makefile
@@ -28,7 +28,6 @@ CFLAGS+= -DWITH_INET
YFLAGS=
-LDADD+= -lm -lmd
-DPADD+= ${LIBM} ${LIBMD}
+LIBADD= m md
.include <bsd.prog.mk>
diff --git a/sbin/pflogd/Makefile b/sbin/pflogd/Makefile
index fcff8eb45135..49a311e11bb7 100644
--- a/sbin/pflogd/Makefile
+++ b/sbin/pflogd/Makefile
@@ -8,8 +8,7 @@ MAN= pflogd.8
CFLAGS+=-include ${.CURDIR}/../../lib/libpcap/config.h
-LDADD= -lpcap
-DPADD= ${LIBPCAP}
+LIBADD= pcap
WARNS?= 2
diff --git a/sbin/ping/Makefile b/sbin/ping/Makefile
index 57f82a8f72b7..533f8b845d7a 100644
--- a/sbin/ping/Makefile
+++ b/sbin/ping/Makefile
@@ -8,19 +8,16 @@ MAN= ping.8
BINOWN= root
BINMODE=4555
WARNS?= 3
-DPADD= ${LIBM}
-LDADD= -lm
+LIBADD= m
.if ${MK_CASPER} != "no" && !defined(RESCUE)
-DPADD+= ${LIBCAPSICUM} ${LIBNV}
-LDADD+= -lcapsicum -lnv
+LIBADD+= capsicum
CFLAGS+=-DHAVE_LIBCAPSICUM
.endif
.if !defined(RELEASE_CRUNCH)
CFLAGS+=-DIPSEC
-DPADD+= ${LIBIPSEC}
-LDADD+= -lipsec
+LIBADD+= ipsec
.endif
.include <bsd.prog.mk>
diff --git a/sbin/ping6/Makefile b/sbin/ping6/Makefile
index e40dc6eb9393..35a76e47f853 100644
--- a/sbin/ping6/Makefile
+++ b/sbin/ping6/Makefile
@@ -10,7 +10,6 @@ WARNS?= 3
BINOWN= root
BINMODE=4555
-LDADD= -lipsec -lm -lmd
-DPADD= ${LIBIPSEC} ${LIBM} ${LIBMD}
+LIBADD= ipsec m md
.include <bsd.prog.mk>
diff --git a/sbin/quotacheck/Makefile b/sbin/quotacheck/Makefile
index 51a88b7681c7..7be3e3510503 100644
--- a/sbin/quotacheck/Makefile
+++ b/sbin/quotacheck/Makefile
@@ -5,8 +5,7 @@ PROG= quotacheck
SRCS= quotacheck.c preen.c fsutil.c utilities.c
WARNS?= 2
MAN= quotacheck.8
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
.PATH: ${.CURDIR}/../fsck ${.CURDIR}/../fsck_ffs
diff --git a/sbin/rcorder/Makefile b/sbin/rcorder/Makefile
index b71aa4b83d37..50e797f4cc43 100644
--- a/sbin/rcorder/Makefile
+++ b/sbin/rcorder/Makefile
@@ -5,8 +5,7 @@ PROG= rcorder
SRCS= ealloc.c hash.c rcorder.c
MAN= rcorder.8
-LDADD= -lutil
-DPADD= ${LIBUTIL}
+LIBADD= util
# XXX hack for make's hash.[ch]
CFLAGS+= -DORDER -I.
diff --git a/sbin/routed/Makefile b/sbin/routed/Makefile
index 8f2a8193318e..2308722c7191 100644
--- a/sbin/routed/Makefile
+++ b/sbin/routed/Makefile
@@ -5,8 +5,7 @@ PROG= routed
MAN= routed.8
SRCS= if.c input.c main.c output.c parms.c radix.c rdisc.c table.c trace.c
WARNS?= 3
-DPADD= ${LIBMD}
-LDADD= -lmd
+LIBADD= md
SUBDIR= rtquery
diff --git a/sbin/routed/rtquery/Makefile b/sbin/routed/rtquery/Makefile
index e5d0f5a65203..4df7dc29ace3 100644
--- a/sbin/routed/rtquery/Makefile
+++ b/sbin/routed/rtquery/Makefile
@@ -4,8 +4,7 @@
PROG= rtquery
MAN= rtquery.8
-LDADD= -lmd
-DPADD= ${LIBMD}
+LIBADD= md
WARNS?= 3
NO_WARRAY_BOUNDS=
diff --git a/sbin/savecore/Makefile b/sbin/savecore/Makefile
index f25745826029..e07a81532f87 100644
--- a/sbin/savecore/Makefile
+++ b/sbin/savecore/Makefile
@@ -1,8 +1,7 @@
# $FreeBSD$
PROG= savecore
-DPADD= ${LIBZ}
-LDADD= -lz
+LIBADD= z
MAN= savecore.8
.include <bsd.prog.mk>
diff --git a/sbin/setkey/Makefile b/sbin/setkey/Makefile
index bd04f07c1eb4..e974af5f0b15 100644
--- a/sbin/setkey/Makefile
+++ b/sbin/setkey/Makefile
@@ -37,8 +37,7 @@ WARNS?= 1
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libipsec
YFLAGS= -d
-DPADD= ${LIBL} ${LIBY}
-LDADD= -ll -ly
+LIBADD= l y
CLEANFILES= y.tab.c y.tab.h key_test.o keytest
@@ -55,8 +54,7 @@ CFLAGS+= -DIPSEC_DEBUG -DYY_NO_UNPUT
CFLAGS+= -DINET6
.endif
CFLAGS+= -I.
-DPADD+= ${LIBIPSEC}
-LDADD+= -lipsec
+LIBADD+= ipsec
CLEANFILES+= scriptdump y.tab.h
#SCRIPTS= scriptdump
diff --git a/sbin/sunlabel/Makefile b/sbin/sunlabel/Makefile
index ed64bee5809c..21ccfd751a68 100644
--- a/sbin/sunlabel/Makefile
+++ b/sbin/sunlabel/Makefile
@@ -11,8 +11,7 @@ LINKS= ${BINDIR}/sunlabel ${BINDIR}/disklabel
MLINKS= sunlabel.8 disklabel.8
.endif
-DPADD= ${LIBGEOM}
-LDADD= -lgeom
+LIBADD= geom
.include <bsd.prog.mk>
diff --git a/sbin/swapon/Makefile b/sbin/swapon/Makefile
index 6f8e8df2e5a6..e9074be9c433 100644
--- a/sbin/swapon/Makefile
+++ b/sbin/swapon/Makefile
@@ -8,7 +8,6 @@ LINKS+= ${BINDIR}/swapon ${BINDIR}/swapctl
MLINKS= swapon.8 swapoff.8
MLINKS+=swapon.8 swapctl.8
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+LIBADD= util
.include <bsd.prog.mk>
diff --git a/sbin/tunefs/Makefile b/sbin/tunefs/Makefile
index d5313c445526..07fe3b1ccaa1 100644
--- a/sbin/tunefs/Makefile
+++ b/sbin/tunefs/Makefile
@@ -2,8 +2,7 @@
# $FreeBSD$
PROG= tunefs
-DPADD= ${LIBUFS}
-LDADD= -lufs
+LIBADD= ufs
MAN= tunefs.8
WARNS= 3