summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-11-13 07:39:05 +0000
committerneel <neel@FreeBSD.org>2012-11-13 07:39:05 +0000
commit1a164db277254c1198a5923050a4e403737937c3 (patch)
tree96b9ec5962272d9c843abffb6d4db9b66e04efd3 /share
parentf146c1921cfde17a6716187a95a05c21f5e46b94 (diff)
parenta841c9341b2afeabcf32a11c8bd91bbe3346177a (diff)
downloadFreeBSD-src-1a164db277254c1198a5923050a4e403737937c3.zip
FreeBSD-src-1a164db277254c1198a5923050a4e403737937c3.tar.gz
IFC @ r242940
Diffstat (limited to 'share')
-rw-r--r--share/man/man4/icmp6.44
-rw-r--r--share/man/man4/ipsec.42
-rw-r--r--share/mk/Makefile56
-rw-r--r--share/mk/atf.test.mk148
-rw-r--r--share/mk/bsd.progs.mk396
-rw-r--r--share/mk/bsd.subdir.mk5
-rw-r--r--share/mk/bsd.test.mk79
7 files changed, 345 insertions, 345 deletions
diff --git a/share/man/man4/icmp6.4 b/share/man/man4/icmp6.4
index 1c6026f..b052fc9 100644
--- a/share/man/man4/icmp6.4
+++ b/share/man/man4/icmp6.4
@@ -30,7 +30,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 20, 2004
+.Dd November 7, 2012
.Dt ICMP6 4
.Os
.Sh NAME
@@ -234,7 +234,7 @@ calls may be used to obtain and install the filter on ICMPv6 sockets at
option level
.Dv IPPROTO_ICMPV6
and name
-.Dv ICMPV6_FILTER
+.Dv ICMP6_FILTER
with a pointer to the
.Vt icmp6_filter
structure as the option value.
diff --git a/share/man/man4/ipsec.4 b/share/man/man4/ipsec.4
index d5f8b8f..c6a3f24 100644
--- a/share/man/man4/ipsec.4
+++ b/share/man/man4/ipsec.4
@@ -33,7 +33,7 @@
.Dt IPSEC 4
.Os
.Sh NAME
-.Nm IPsec
+.Nm ipsec
.Nd Internet Protocol Security protocol
.Sh SYNOPSIS
.Cd "options IPSEC"
diff --git a/share/mk/Makefile b/share/mk/Makefile
index 5bab862..fef17ec 100644
--- a/share/mk/Makefile
+++ b/share/mk/Makefile
@@ -1,20 +1,50 @@
# $FreeBSD$
# @(#)Makefile 8.1 (Berkeley) 6/8/93
-FILES= bsd.README
-FILES+= bsd.arch.inc.mk
-FILES+= bsd.compat.mk bsd.compiler.mk bsd.cpu.mk
-FILES+= bsd.dep.mk bsd.doc.mk bsd.dtrace.mk
-FILES+= bsd.endian.mk
-FILES+= bsd.files.mk bsd.crunchgen.mk bsd.incs.mk bsd.info.mk bsd.init.mk
-FILES+= bsd.kmod.mk
-FILES+= bsd.lib.mk bsd.libnames.mk bsd.links.mk bsd.man.mk bsd.nls.mk
-FILES+= bsd.obj.mk bsd.own.mk
-FILES+= bsd.port.mk bsd.port.options.mk bsd.port.post.mk
-FILES+= bsd.port.pre.mk bsd.port.subdir.mk bsd.prog.mk
-FILES+= bsd.snmpmod.mk bsd.subdir.mk bsd.sys.mk bsd.symver.mk
-FILES+= sys.mk version_gen.awk
+.include <bsd.own.mk>
+
+FILES= \
+ bsd.README \
+ bsd.arch.inc.mk \
+ bsd.compat.mk \
+ bsd.compiler.mk \
+ bsd.cpu.mk \
+ bsd.crunchgen.mk \
+ bsd.dep.mk \
+ bsd.doc.mk \
+ bsd.dtrace.mk \
+ bsd.endian.mk \
+ bsd.files.mk \
+ bsd.incs.mk \
+ bsd.info.mk \
+ bsd.init.mk \
+ bsd.kmod.mk \
+ bsd.lib.mk \
+ bsd.libnames.mk \
+ bsd.links.mk \
+ bsd.man.mk \
+ bsd.nls.mk \
+ bsd.obj.mk \
+ bsd.own.mk \
+ bsd.port.mk \
+ bsd.port.options.mk \
+ bsd.port.post.mk \
+ bsd.port.pre.mk \
+ bsd.port.subdir.mk \
+ bsd.prog.mk \
+ bsd.snmpmod.mk \
+ bsd.subdir.mk \
+ bsd.symver.mk \
+ bsd.sys.mk \
+ bsd.test.mk \
+ sys.mk \
+ version_gen.awk
+
NO_OBJ=
FILESDIR= ${BINDIR}/mk
+.if ${MK_ATF} != "no"
+FILES+= atf.test.mk
+.endif
+
.include <bsd.prog.mk>
diff --git a/share/mk/atf.test.mk b/share/mk/atf.test.mk
new file mode 100644
index 0000000..7e19087
--- /dev/null
+++ b/share/mk/atf.test.mk
@@ -0,0 +1,148 @@
+# $NetBSD$
+# $FreeBSD$
+#
+
+.include <bsd.init.mk>
+
+ATF_TESTS:=
+
+.if make(*test)
+TESTSDIR?= .
+.endif
+
+.if defined(ATF_TESTS_SUBDIRS)
+# Only visit subdirs when building, etc because ATF does this it on its own.
+.if !make(atf-test)
+SUBDIR+= ${ATF_TESTS_SUBDIRS}
+.endif
+ATF_TESTS+= ${ATF_TESTS_SUBDIRS}
+
+.include <bsd.subdir.mk>
+.endif
+
+.if defined(TESTS_C)
+ATF_TESTS+= ${TESTS_C}
+.for _T in ${TESTS_C}
+SRCS.${_T}?= ${_T}.c
+DPADD.${_T}+= ${LIBATF_C}
+LDADD.${_T}+= -latf-c
+.endfor
+.endif
+
+.if defined(TESTS_CXX)
+ATF_TESTS+= ${TESTS_CXX}
+.for _T in ${TESTS_CXX}
+SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc}
+DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
+LDADD.${_T}+= -latf-c++ -latf-c
+.endfor
+.endif
+
+.if defined(TESTS_SH)
+ATF_TESTS+= ${TESTS_SH}
+.for _T in ${TESTS_SH}
+CLEANFILES+= ${_T} ${_T}.tmp
+TESTS_SH_SRC_${_T}?= ${_T}.sh
+${_T}: ${TESTS_SH_SRC_${_T}}
+ echo '#! /usr/bin/atf-sh' > ${.TARGET}.tmp
+ cat ${.ALLSRC} >> ${.TARGET}.tmp
+ chmod +x ${.TARGET}.tmp
+ mv ${.TARGET}.tmp ${.TARGET}
+.endfor
+.endif
+
+ATFFILE?= auto
+
+.if ${ATFFILE:tl} != "no"
+FILES+= Atffile
+FILESDIR_Atffile= ${TESTSDIR}
+
+.if ${ATFFILE:tl} == "auto"
+CLEANFILES+= Atffile Atffile.tmp
+
+Atffile: Makefile
+ @{ echo 'Content-Type: application/X-atf-atffile; version="1"'; \
+ echo; \
+ echo '# Automatically generated by atf-test.mk.'; \
+ echo; \
+ echo 'prop: test-suite = "'`uname -o`'"'; \
+ echo; \
+ for tp in ${ATF_TESTS}; do \
+ echo "tp: $${tp}"; \
+ done; } >Atffile.tmp
+ @mv Atffile.tmp Atffile
+.endif
+.endif
+
+# Generate support variables for atf-test.
+#
+# atf-test can only work for native builds, i.e. a build host of a particular
+# OS building a release for the same OS version and architecture. The target
+# runs ATF, which is on the build host, and the tests execute code built for
+# the target host.
+#
+# Due to the dependencies of the binaries built by the source tree and how they
+# are used by tests, it is highly possible for a execution of "make test" to
+# report bogus results unless the new binaries are put in place.
+
+# XXX (gcooper): Executing ATF from outside the source tree is improper; it
+# should be built as part of the OS toolchain build for the host OS and
+# executed from there.
+ATF_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin
+TESTS_ENV+= PATH=${ATF_PATH:ts:}:${PATH}
+
+ATF_BUILD_CC?= ${DESTDIR}/usr/bin/cc
+ATF_BUILD_CPP?= ${DESTDIR}/usr/bin/cpp
+ATF_BUILD_CXX?= ${DESTDIR}/usr/bin/c++
+ATF_CONFDIR?= ${DESTDIR}/etc
+ATF_INCLUDEDIR?= ${DESTDIR}/usr/include
+ATF_LIBDIR?= ${DESTDIR}/usr/lib
+ATF_LIBEXECDIR?= ${DESTDIR}/usr/libexec
+ATF_PKGDATADIR?= ${DESTDIR}/usr/share/atf
+ATF_SHELL?= ${DESTDIR}/bin/sh
+LD_LIBRARY_PATH?= ${TESTS_LD_LIBRARY_PATH:tW:S/ /:/g}
+
+ATF_ENV_VARS= \
+ ATF_BUILD_CC \
+ ATF_BUILD_CPP \
+ ATF_BUILD_CXX \
+ ATF_CONFDIR \
+ ATF_INCLUDEDIR \
+ ATF_LIBDIR \
+ ATF_LIBEXECDIR \
+ ATF_PKGDATADIR \
+ ATF_SHELL \
+
+.for v in ${ATF_ENV_VARS}
+.if !empty($v)
+TESTS_ENV+= $v=${$v}
+.endif
+.endfor
+
+_TESTS_FIFO= ${.OBJDIR}/atf-run.fifo
+_TESTS_LOG= ${.OBJDIR}/atf-run.log
+CLEANFILES+= ${_TESTS_FIFO} ${_TESTS_LOG}
+
+ATF_BIN?= ${DESTDIR}/usr/bin
+ATF_REPORT?= ${ATF_BIN}/atf-report
+ATF_RUN?= ${ATF_BIN}/atf-run
+
+.PHONY: realtest
+realtest:
+.if defined(TESTSDIR)
+ @set -e; \
+ cd ${DESTDIR}${TESTSDIR}; \
+ rm -f ${_TESTS_FIFO}; \
+ mkfifo ${_TESTS_FIFO}; \
+ tee ${_TESTS_LOG} < ${_TESTS_FIFO} | ${TESTS_ENV} ${ATF_REPORT} & \
+ set +e; \
+ ${TESTS_ENV} ${ATF_RUN} >> ${_TESTS_FIFO}; \
+ result=$${?}; \
+ wait; \
+ rm -f ${_TESTS_FIFO}; \
+ echo; \
+ echo "*** The verbatim output of atf-run has been saved to ${_TESTS_LOG}"; \
+ exit $${result}
+.endif
+
+.include <bsd.test.mk>
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
index 531c2ef..b6236fe 100644
--- a/share/mk/bsd.progs.mk
+++ b/share/mk/bsd.progs.mk
@@ -1,350 +1,88 @@
-# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
# $FreeBSD$
-
-.include <bsd.init.mk>
-
-.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm
-
-.if ${MK_MAN} == "no"
-NO_MAN=
+# $Id: progs.mk,v 1.11 2012/11/06 17:18:54 sjg Exp $
+#
+# @(#) Copyright (c) 2006, Simon J. Gerraty
+#
+# This file is provided in the hope that it will
+# be of use. There is absolutely NO WARRANTY.
+# Permission to copy, redistribute or otherwise
+# use this file is hereby granted provided that
+# the above copyright notice and this notice are
+# left intact.
+#
+# Please send copies of changes and bug-fixes to:
+# sjg@crufty.net
+#
+
+.MAIN: all
+
+.if defined(PROGS)
+
+# In meta mode, we can capture dependenices for _one_ of the progs.
+# if makefile doesn't nominate one, we use the first.
+.ifndef UPDATE_DEPENDFILE_PROG
+UPDATE_DEPENDFILE_PROG = ${PROGS:[1]}
+.export UPDATE_DEPENDFILE_PROG
.endif
-# Legacy knobs
-.if defined(PROG) || defined(PROG_CXX)
-. if defined(PROG)
-PROGS= ${PROG}
-. endif
-. if defined(PROG_CXX)
-PROGS= ${PROG_CXX}
-PROGS_CXX= ${PROG_CXX}
-. endif
-# Loop once to keep pattern and avoid namespace pollution
-. for _P in ${PROGS}
-. if defined(INTERNALPROG)
-INTERNALPROG.${_P}=
-. endif
-. if !defined(NO_MAN)
-. if defined(MAN)
-MAN.${_P}= ${MAN}
-. else
-. for sect in 1 1aout 2 3 4 5 6 7 8 9
-. if defined(MAN${sect})
-MAN.${_P}= ${MAN${sect}}
-. endif
-. endfor
-. endif
-. endif # defined(NO_MAN)
-. if defined(NLSNAME) && !empty(NLSNAME)
-NLSNAME.${P}:= ${NLSNAME}
-. endif
-. if defined(OBJS)
-OBJS.${_P}:= ${OBJS}
-. endif
-. if defined(PRECIOUSPROG)
-PRECIOUSPROG.${_P}=
-. endif
-. if defined(PROGNAME)
-PROGNAME.${_P}= ${PROGNAME}
-. endif
-. if defined(SRCS)
-SRCS.${_P}:= ${SRCS}
-. endif
-. endfor
-.else # !defined(PROG) && !defined(PROG_CXX)
-. if defined(PROGS_CXX) && !empty(PROGS_CXX)
-PROGS+= ${PROGS_CXX}
-. endif
-.endif # defined(PROG) || defined(PROG_CXX)
-
-.if defined(PROGS_CXX) && !empty(PROGS_CXX)
-. for _P in ${PROGS_CXX}
-PROG_CXX.${_P}=
-. endfor
+.ifndef PROG
+# They may have asked us to build just one
+.for t in ${PROGS}
+.if make($t)
+PROG ?= $t
+.endif
+.endfor
.endif
-# Avoid recursive variables
-.undef NLSNAME
+.if defined(PROG)
+# just one of many
+PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS
+.for v in ${PROG_VARS:O:u}
+$v += ${${v}_${PROG}:U${${v}.${PROG}}}
+.endfor
-.if defined(COPTS)
-CFLAGS+=${COPTS}
+# for meta mode, there can be only one!
+.if ${PROG} == ${UPDATE_DEPENDFILE_PROG:Uno}
+UPDATE_DEPENDFILE ?= yes
.endif
-
-.if defined(DEBUG_FLAGS)
-. if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
-CTFFLAGS+= -g
-. endif
-CFLAGS+=${DEBUG_FLAGS}
-CXXFLAGS+=${DEBUG_FLAGS}
+UPDATE_DEPENDFILE ?= NO
+
+# ensure that we don't clobber each other's dependencies
+DEPENDFILE?= .depend.${PROG}
+# prog.mk will do the rest
+.else
+all: ${PROGS}
+
+# We cannot capture dependencies for meta mode here
+UPDATE_DEPENDFILE = NO
+# nor can we safely run in parallel.
+.NOTPARALLEL:
.endif
-
-STRIP?= -s
-
-.if ${MK_ASSERT_DEBUG} == "no"
-CFLAGS+= -DNDEBUG
-NO_WERROR=
.endif
-.for _P in ${PROGS}
-
-BINDIR.${_P}?= ${BINDIR}
-BINGRP.${_P}?= ${BINGRP}
-BINMODE.${_P}?= ${BINMODE}
-BINOWN.${_P}?= ${BINOWN}
-
-CFLAGS.${_P}+= ${CFLAGS}
-CXXFLAGS.${_P}+= ${CXXFLAGS}
-DPADD.${_P}+= ${DPADD}
-LDADD.${_P}+= ${LDADD}
-LDFLAGS.${_P}+= ${LDFLAGS}
-
-INSTALLFLAGS.${_P}?= ${INSTALLFLAGS}
-
-. if defined(PRECIOUSPROG.${_P})
-. if !defined(NO_FSCHG) && !defined(NO_FSCHG.${_P})
-INSTALLFLAGS.${_P}+= -fschg
-. endif
-INSTALLFLAGS.${_P}+= -S
-. endif
-
-NO_SHARED.${_P}?= ${NO_SHARED}
+# handle being called [bsd.]progs.mk
+.include <${.PARSEFILE:S,progs,prog,}>
-. if !defined(NLSDIR.${_P})
-NLSDIR.${_P}:= ${NLSDIR}
-. endif
-. undef NLSDIR
+.ifndef PROG
+PROGS_TARGETS += clean
-. if !empty(NO_SHARED.${_P}) && ${NO_SHARED.${_P}:tl} != "no"
-LDFLAGS.${_P}+= -static
-. endif
-
-. if defined(SRCS.${_P})
-
-_SRCS:= ${SRCS.${_P}}
-OBJS.${_P}+= ${_SRCS:N*.h:R:S/$/.o/g}
-
-. if target(beforelinking)
-${_P}: ${OBJS.${_P}} beforelinking
-. else
-${_P}: ${OBJS.${_P}}
-. endif
-. if defined(PROG_CXX.${_P})
- ${CXX} ${CXXFLAGS.${_P}} ${LDFLAGS.${_P}} -o ${.TARGET} ${OBJS.${_P}} \
- ${LDADD.${_P}}
-. else
- ${CC} ${CFLAGS.${_P}} ${LDFLAGS.${_P}} -o ${.TARGET} ${OBJS.${_P}} \
- ${LDADD.${_P}}
-. endif
-. if ${MK_CTF} != "no"
- ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS.${_P}}
-. endif
-
-. else # !defined(SRCS.${_P})
-
-. if !target(${_P})
-. if defined(PROG_CXX.${_P})
-SRCS.${_P}?= ${_P}.cc
-. else
-SRCS.${_P}?= ${_P}.c
-. endif
-
-# Always make an intermediate object file because:
-# - it saves time rebuilding when only the library has changed
-# - the name of the object gets put into the executable symbol table instead of
-# the name of a variable temporary object.
-# - it's useful to keep objects around for crunching.
-OBJS.${_P}:= ${_P}.o
-
-. if target(beforelinking)
-${_P}: ${OBJS.${_P}} beforelinking
-. else
-${_P}: ${OBJS.${_P}}
-. endif # target(beforelinking)
-. if defined(PROG_CXX.${_P})
- ${CXX} ${CXXFLAGS.${_P}} ${LDFLAGS.${_P}} -o ${.TARGET} ${OBJS.${_P}} \
- ${LDADD.${_P}}
-. else
- ${CC} ${CFLAGS.${_P}} ${LDFLAGS.${_P}} -o ${.TARGET} ${OBJS.${_P}} \
- ${LDADD.${_P}}
-. endif
-. if ${MK_CTF} != "no"
- ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS.${_P}}
-. endif
-
-. endif # !target(${_P})
-
-. endif # defined(SRCS.${_P})
-
-CLEANFILES+= ${OBJS.${_P}}
-
-.endfor # for _P in ${PROGS}
-
-all: objwarn ${PROGS} ${SCRIPTS}
-
-.if !defined(NO_MAN)
-. for _P in ${PROGS}
-MAN.${_P}?= ${_P}.1
-MAN:= ${MAN.${_P}}
-. include <bsd.man.mk>
-. endfor
-. if target(_manpages) # bsd.man.mk was included
-all: _manpages
-. endif
+.for p in ${PROGS}
+.if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
+# bsd.prog.mk may need to know this
+x.$p= PROG_CXX=$p
.endif
-CLEANFILES+= ${PROGS}
-
-.include <bsd.libnames.mk>
+$p ${p}_p: .PHONY .MAKE
+ (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p})
-_EXTRADEPEND:
-.for _P in ${PROGS}
-. if !empty(LDFLAGS.${P}:M-nostdlib)
-. if !empty(DPADD.${_P})
- echo ${_P}: ${DPADD.${_P}} >> ${DEPENDFILE}
-. endif
-. else
- echo ${_P}: ${LIBC} ${DPADD.${_P}} >> ${DEPENDFILE}
-. if defined(PROG_CXX.${_P})
-. if !empty(CXXFLAGS.${P}:M-stdlib=libc++)
- echo ${_P}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
-. else
- echo ${_P}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
-. endif
-. endif
-. endif
+.for t in ${PROGS_TARGETS:O:u}
+$p.$t: .PHONY .MAKE
+ (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} ${@:E})
.endfor
-
-.if !target(install)
-
-. if !target(realinstall)
-
-. for _P in ${PROGS}
-
-. if !defined(INTERNALPROG.${_P})
-
-.ORDER: beforeinstall _proginstall.${_P}
-_proginstall.${_P}:
-. if defined(PROGNAME.${_P})
- ${INSTALL} ${STRIP} -o ${BINOWN.${_P}} -g ${BINGRP.${_P}} \
- -m ${BINMODE.${_P}} ${INSTALLFLAGS.${_P}} ${_P} \
- ${DESTDIR}${BINDIR.${_P}}/${PROGNAME.${_P}}
-. else
- ${INSTALL} ${STRIP} -o ${BINOWN.${_P}} -g ${BINGRP.${_P}} \
- -m ${BINMODE.${_P}} ${INSTALLFLAGS.${_P}} ${_P} \
- ${DESTDIR}${BINDIR.${_P}}
-. endif
-
-realinstall: _proginstall.${_P}
-
-. endif # !defined(INTERNALPROG.${_P})
-
-. endfor # for _P in ${PROGS}
-
-. endif # !target(realinstall)
-
-. if defined(SCRIPTS) && !empty(SCRIPTS)
-SCRIPTSDIR?= ${BINDIR}
-SCRIPTSOWN?= ${BINOWN}
-SCRIPTSGRP?= ${BINGRP}
-SCRIPTSMODE?= ${BINMODE}
-
-. for S in ${SCRIPTS}
-
-realinstall: scriptsinstall
-.ORDER: beforeinstall scriptsinstall
-
-. if defined(SCRIPTSNAME)
-SCRIPTSNAME_${S}?= ${SCRIPTSNAME}
-. else
-SCRIPTSNAME_${S}?= ${S:T:R}
-. endif
-
-SCRIPTSDIR_${S}?= ${SCRIPTSDIR}
-SCRIPTSOWN_${S}?= ${SCRIPTSOWN}
-SCRIPTSGRP_${S}?= ${SCRIPTSGRP}
-SCRIPTSMODE_${S}?= ${SCRIPTSMODE}
-
-scriptsinstall: ${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}
-
-${DESTDIR}${SCRIPTSDIR_${S}}/${SCRIPTSNAME_${S}}: ${S}
- ${INSTALL} -o ${SCRIPTSOWN_${S}} \
- -g ${SCRIPTSGRP_${S}} \
- -m ${SCRIPTSMODE_${S}} \
- ${.ALLSRC} \
- ${.TARGET}
-
-. endfor # for S in ${SCRIPTS}
-
-. endif # defined(SCRIPTS) && !empty(SCRIPTS)
-
-.endif # !target(install)
-
-.if !defined(NO_MAN)
-. if target(_manpages) # bsd.man.mk was included
-realinstall: _maninstall
-. endif
-.endif
-
-# Wrap bsd.nls.mk because I can't force that Makefile snippet to work only with
-# ${PROGS}.
-.for _P in ${PROGS}
-NLSNAME.${_P}?= ${_P}
-NLS:= ${NLS.${_P}}
-NLSDIR:= ${NLSDIR.${_P}}
-NLSNAME:= ${NLSNAME.${_P}}
-.include <bsd.nls.mk>
.endfor
-.include <bsd.files.mk>
-.include <bsd.incs.mk>
-.include <bsd.links.mk>
-
-.if !target(lint)
-. for _P in ${PROGS}
-. if !target(lint.${_P})
-. if defined(PROG_CXX.${_P})
-lint.${_P}:
-. else
-_CFLAGS:= ${CFLAGS.${_P}}
-_SRCS:= ${SRCS.${_P}}
-lint.${_P}: ${_SRCS:M*.c}
- ${LINT} ${LINTFLAGS} ${_CFLAGS:M-[DIU]*} ${.ALLSRC}
-. endif
-. endif
-lint: lint.${_P}
-
-. endfor
-.endif # !target(lint)
-
-.for _P in ${PROGS}
-CFLAGS:= ${CFLAGS.${_P}}
-CXXFLAGS:= ${CXXFLAGS.${_P}}
-# XXX: Pollutes DPADD.${_P} and LDADD.${_P} above
-#DPADD:= ${DPADD.${_P}}
-#LDADD:= ${LDADD.${_P}}
-SRCS:= ${SRCS.${_P}}
-. include <bsd.dep.mk>
-# bsd.dep.mk mangles SRCS
-SRCS.${_P}:= ${SRCS}
-. undef DPADD LDADD
+.for t in ${PROGS_TARGETS:O:u}
+$t: ${PROGS:%=%.$t}
.endfor
-# XXX: emulate the old bsd.prog.mk by allowing Makefiles that didn't set
-# ${PROG*} to function with this Makefile snippet.
-.if empty(PROGS)
-. include <bsd.dep.mk>
-.endif
-
-.if !exists(${.OBJDIR}/${DEPENDFILE})
-. for _P in ${PROGS}
-_SRCS:= ${SRCS.${_P}}
-${OBJS.${_P}}: ${_SRCS:M*.h}
-. endfor
-.endif
-
-.include <bsd.obj.mk>
-
-.include <bsd.sys.mk>
-
-.if defined(PORTNAME)
-.include <bsd.pkg.mk>
.endif
diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk
index a66ab9b..3d5fb61 100644
--- a/share/mk/bsd.subdir.mk
+++ b/share/mk/bsd.subdir.mk
@@ -29,6 +29,9 @@
# maninstall, manlint, obj, objlink, realinstall, regress, tags
#
+.if !target(__<bsd.subdir.mk>__)
+__<bsd.subdir.mk>__:
+
.include <bsd.init.mk>
DISTRIBUTION?= base
@@ -92,3 +95,5 @@ afterinstall:
install: beforeinstall realinstall afterinstall
.ORDER: beforeinstall realinstall afterinstall
.endif
+
+.endif
diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk
new file mode 100644
index 0000000..a75298f
--- /dev/null
+++ b/share/mk/bsd.test.mk
@@ -0,0 +1,79 @@
+# $NetBSD: bsd.test.mk,v 1.21 2012/08/25 22:21:16 jmmv Exp $
+# $FreeBSD$
+
+.include <bsd.init.mk>
+
+.if defined(TESTS_C)
+PROGS+= ${TESTS_C}
+.for _T in ${TESTS_C}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+.endfor
+.endif
+
+.if defined(TESTS_CXX)
+PROGS_CXX+= ${TESTS_CXX}
+PROGS+= ${TESTS_CXX}
+.for _T in ${TESTS_CXX}
+BINDIR.${_T}= ${TESTSDIR}
+MAN.${_T}?= # empty
+.endfor
+.endif
+
+.if defined(TESTS_SH)
+SCRIPTS+= ${TESTS_SH}
+.for _T in ${TESTS_SH}
+SCRIPTSDIR_${_T}= ${TESTSDIR}
+.endfor
+.endif
+
+TESTSBASE?= ${DESTDIR}/usr/tests
+
+# it is rare for test cases to have man pages
+.if !defined(MAN)
+WITHOUT_MAN=yes
+.export WITHOUT_MAN
+.endif
+
+# tell progs.mk we might want to install things
+PROG_VARS+= BINDIR
+PROGS_TARGETS+= install
+
+.if !empty(PROGS) || !empty(PROGS_CXX) || !empty(SCRIPTS)
+.include <bsd.progs.mk>
+.endif
+
+beforetest: .PHONY
+.if defined(TESTSDIR)
+.if ${TESTSDIR} == ${TESTSBASE}
+# Forbid running from ${TESTSBASE}. It can cause false positives/negatives and
+# it does not cover all the tests (e.g. it misses testing software in external).
+ @echo "*** Sorry, you cannot use make test from src/tests. Install the"
+ @echo "*** tests into their final location and run them from ${TESTSBASE}"
+ @false
+.else
+ @echo "*** Using this test does not preclude you from running the tests"
+ @echo "*** installed in ${TESTSBASE}. This test run may raise false"
+ @echo "*** positives and/or false negatives."
+.endif
+.else
+ @echo "*** No TESTSDIR defined; nothing to do."
+ @false
+.endif
+ @echo
+
+.if !target(realtest)
+realtest: .PHONY
+ @echo "$@ not defined; skipping"
+.endif
+
+test: .PHONY
+.ORDER: beforetest realtest
+test: beforetest realtest
+
+.if target(aftertest)
+.ORDER: realtest aftertest
+test: aftertest
+.endif
+
+.include <bsd.obj.mk>
OpenPOWER on IntegriCloud