summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2015-10-15 17:36:56 +0000
committergjb <gjb@FreeBSD.org>2015-10-15 17:36:56 +0000
commit609a691adaec0e17e6c3e66dd8f5c3a0f5b05882 (patch)
tree938919dc21bad97a2e96d808270dd31b2c871668 /share/mk
parent3484950cf7faac9943c1f04bb91592f2b0de1d22 (diff)
parente0a76fc624ff8f59328873dcf100f69d94d852f8 (diff)
downloadFreeBSD-src-609a691adaec0e17e6c3e66dd8f5c3a0f5b05882.zip
FreeBSD-src-609a691adaec0e17e6c3e66dd8f5c3a0f5b05882.tar.gz
MFH to r289370
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.README8
-rw-r--r--share/mk/bsd.confs.mk2
-rw-r--r--share/mk/bsd.incs.mk2
-rw-r--r--share/mk/bsd.own.mk1
-rw-r--r--share/mk/bsd.prog.mk4
-rw-r--r--share/mk/bsd.progs.mk28
-rw-r--r--share/mk/bsd.subdir.mk20
-rw-r--r--share/mk/bsd.sys.mk14
-rw-r--r--share/mk/bsd.test.mk5
-rw-r--r--share/mk/netbsd-tests.test.mk12
10 files changed, 62 insertions, 34 deletions
diff --git a/share/mk/bsd.README b/share/mk/bsd.README
index 018374f..cb6e41f 100644
--- a/share/mk/bsd.README
+++ b/share/mk/bsd.README
@@ -474,10 +474,16 @@ It has seven targets:
It sets/uses the following variables, among many others:
-TESTDIR Path to the installed tests. Must be a subdirectory of
+TESTSBASE Installation prefix for tests. Defaults to /usr/tests
+
+TESTSDIR Path to the installed tests. Must be a subdirectory of
TESTSBASE and the subpath should match the relative
location of the tests within the src tree.
+ The value of TESTSDIR defaults to
+ ${TESTSBASE}/${RELDIR:H} , e.g. /usr/tests/bin/ls when
+ included from bin/ls/tests .
+
KYUAFILE If 'auto' (the default), generate a Kyuafile out of the
test programs defined in the Makefile. If 'yes', then a
manually-crafted Kyuafile must be supplied with the
diff --git a/share/mk/bsd.confs.mk b/share/mk/bsd.confs.mk
index 4e219e8..0750a4e 100644
--- a/share/mk/bsd.confs.mk
+++ b/share/mk/bsd.confs.mk
@@ -84,4 +84,4 @@ STAGE_TARGETS+= stage_config
.endif
.endif
-.endif # ${MK_TOOLCHAIN} != "no"
+.endif # ${MK_INCLUDES} != "no"
diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk
index 5e0b795..097eb7f 100644
--- a/share/mk/bsd.incs.mk
+++ b/share/mk/bsd.incs.mk
@@ -106,4 +106,4 @@ STAGE_SYMLINKS.INCS= ${INCSLINKS}
.endif
.endif
-.endif # ${MK_TOOLCHAIN} != "no"
+.endif # ${MK_INCLUDES} != "no"
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 53fd073..2f20da8 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -213,7 +213,6 @@ NLSGRP?= ${SHAREGRP}
NLSMODE?= ${NOBINMODE}
INCLUDEDIR?= /usr/include
-CONFIGDIR?= /etc
#
# install(1) parameters.
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 52ea16b..2fe85d2 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -63,9 +63,9 @@ PROG_FULL=${PROG}.full
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
.if defined(BINDIR) && (\
${BINDIR} == "/bin" ||\
- ${BINDIR} == "/libexec" ||\
+ ${BINDIR:C%/libexec(/.*)?%/libexec%} == "/libexec" ||\
${BINDIR} == "/sbin" ||\
- ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin)(/.*)?%/usr/bin%} == "/usr/bin"\
+ ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin|tests)(/.*)?%/usr/bin%} == "/usr/bin"\
)
DEBUGFILEDIR= ${DEBUGDIR}${BINDIR}
.else
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
index ab52708..2da30c7 100644
--- a/share/mk/bsd.progs.mk
+++ b/share/mk/bsd.progs.mk
@@ -31,6 +31,9 @@ UPDATE_DEPENDFILE_PROG = ${PROGS:[1]}
# They may have asked us to build just one
.for t in ${PROGS}
.if make($t)
+.if ${PROGS_CXX:M${t}}
+PROG_CXX ?= $t
+.endif
PROG ?= $t
.endif
.endfor
@@ -61,7 +64,7 @@ UPDATE_DEPENDFILE ?= yes
UPDATE_DEPENDFILE ?= NO
# prog.mk will do the rest
-.else
+.else # !defined(PROG)
all: ${PROGS}
# We cannot capture dependencies for meta mode here
@@ -80,10 +83,29 @@ $v =
# handle being called [bsd.]progs.mk
.include <bsd.prog.mk>
-.if !empty(PROGS) && !defined(_RECURSING_PROGS)
+.if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
# tell progs.mk we might want to install things
PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install
+# Find common sources among the PROGS and depend on them before building
+# anything. This allows parallelization without them each fighting over
+# the same objects.
+_PROGS_COMMON_SRCS=
+_PROGS_ALL_SRCS=
+.for p in ${PROGS}
+.for s in ${SRCS.${p}}
+.if ${_PROGS_ALL_SRCS:M${s}} && !${_PROGS_COMMON_SRCS:M${s}}
+_PROGS_COMMON_SRCS+= ${s}
+.else
+_PROGS_ALL_SRCS+= ${s}
+.endif
+.endfor
+.endfor
+.if !empty(_PROGS_COMMON_SRCS)
+_PROGS_COMMON_OBJS= ${_PROGS_COMMON_SRCS:N*.h:R:S/$/.o/g}
+${PROGS}: ${_PROGS_COMMON_OBJS}
+.endif
+
.for p in ${PROGS}
.if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
# bsd.prog.mk may need to know this
@@ -111,4 +133,4 @@ $p.$t: .PHONY .MAKE
.for t in ${PROGS_TARGETS:O:u}
$t: ${PROGS:%=%.$t}
.endfor
-.endif
+.endif # !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk
index 94e9838..037a7fe 100644
--- a/share/mk/bsd.subdir.mk
+++ b/share/mk/bsd.subdir.mk
@@ -25,14 +25,19 @@
# This is a variant of install, which will
# put the stuff into the right "distribution".
#
-# afterinstall, all, all-man, beforeinstall, checkdpadd, clean,
-# cleandepend, cleandir, cleanilinks depend, install, lint,
-# maninstall, manlint, obj, objlink, realinstall, regress, tags
+# See ALL_SUBDIR_TARGETS for list of targets that will recurse.
+# Custom targets can be added to SUBDIR_TARGETS in src.conf.
#
.if !target(__<bsd.subdir.mk>__)
__<bsd.subdir.mk>__:
+ALL_SUBDIR_TARGETS= all all-man buildconfig checkdpadd clean cleandepend \
+ cleandir cleanilinks cleanobj depend distribute \
+ installconfig lint maninstall manlint obj objlink \
+ realinstall regress tags \
+ ${SUBDIR_TARGETS}
+
.include <bsd.init.mk>
.if !defined(NEED_SUBDIR)
@@ -85,9 +90,7 @@ ${SUBDIR:N.WAIT}: .PHONY .MAKE
# Work around parsing of .if nested in .for by putting .WAIT string into a var.
__wait= .WAIT
-.for __target in all all-man checkdpadd clean cleandepend cleandir \
- cleanilinks depend distribute lint maninstall manlint obj objlink \
- realinstall regress tags ${SUBDIR_TARGETS}
+.for __target in ${ALL_SUBDIR_TARGETS}
.ifdef SUBDIR_PARALLEL
__subdir_targets=
.for __dir in ${SUBDIR}
@@ -122,7 +125,10 @@ _sub.${__target}: _SUBDIR
.endif
.endfor
-.for __target in files includes config
+# This is to support 'make includes' calling 'make buildincludes' and
+# 'make installincludes' in the proper order, and to support these
+# targets as SUBDIR_TARGETS.
+.for __target in files includes
.for __stage in build install
${__stage}${__target}:
.if make(${__stage}${__target})
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 044b668..d5a4696 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -165,13 +165,13 @@ CXXFLAGS+= ${CXXFLAGS.${COMPILER_TYPE}}
# Tell bmake not to mistake standard targets for things to be searched for
# or expect to ever be up-to-date.
PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
- beforelinking build build-tools buildfiles buildincludes \
- checkdpadd clean cleandepend cleandir cleanobj configure \
- depend dependall distclean distribute exe \
- html includes install installfiles installincludes lint \
- obj objlink objs objwarn realall realdepend \
- realinstall regress subdir-all subdir-depend subdir-install \
- tags whereobj
+ beforelinking build build-tools buildconfig buildfiles \
+ buildincludes checkdpadd clean cleandepend cleandir cleanobj \
+ configure depend dependall distclean distribute exe \
+ files html includes install installconfig installfiles \
+ installincludes lint obj objlink objs objwarn realall \
+ realdepend realinstall regress subdir-all subdir-depend \
+ subdir-install tags whereobj
# we don't want ${PROG} to be PHONY
.PHONY: ${PHONY_NOTMAIN:N${PROG:U}}
diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk
index e76903b..6b394d8 100644
--- a/share/mk/bsd.test.mk
+++ b/share/mk/bsd.test.mk
@@ -10,9 +10,8 @@
__<bsd.test.mk>__:
-.ifndef TESTSDIR
-.error "Please define TESTSDIR when including bsd.test.mk"
-.endif
+# Tests install directory
+TESTSDIR?= ${TESTSBASE}/${RELDIR:H}
PACKAGE= tests
# List of subdirectories containing tests into which to recurse. This has the
diff --git a/share/mk/netbsd-tests.test.mk b/share/mk/netbsd-tests.test.mk
index 5c31d77..92a401b 100644
--- a/share/mk/netbsd-tests.test.mk
+++ b/share/mk/netbsd-tests.test.mk
@@ -3,16 +3,12 @@
.if !target(__netbsd_tests.test.mk__)
__netbsd_tests.test.mk__:
-.if !defined(OBJTOP)
-.error "Please define OBJTOP to the absolute path of the top of the object tree"
-.endif
+OBJTOP?= ${.OBJDIR:S/${RELDIR}//}
-.if !defined(SRCTOP)
-.error "Please define SRCTOP to the absolute path of the top of the source tree"
-.endif
+TESTSRC?= ${SRCTOP}/contrib/netbsd-tests/${RELDIR:H}
-.if !defined(TESTSRC)
-.error "Please define TESTSRC to the absolute path of the test sources, e.g. contrib/netbsd-tests/lib/libc/stdio"
+.if !exists(${TESTSRC}/)
+.error "Please define TESTSRC to the absolute path of the test sources, e.g. $${SRCTOP}/contrib/netbsd-tests/lib/libc/stdio"
.endif
.PATH: ${TESTSRC}
OpenPOWER on IntegriCloud