History log of /freebsd-11-stable/share/mk/bsd.subdir.mk
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 359250 23-Mar-2020 brooks

MFC r359046:

Support SUBDIR.${MK_FOO}.${MK_BAR} expresssions.

This allows simplification of Makefiles where some SUBDIR entries depend
on two things (e.g. something that depends on C++ and some other knob).

Discussed with: imp, jhb
Obtained from: CheriBSD
Sponsored by: DARPA


# 319187 30-May-2017 ngie

MFC r307741:
r307741 (by emaste):

Allow all subdirectories to be optional via SUBDIR.${MK_*}

Tested by: br
Pointy hat to: emaste


# 311195 03-Jan-2017 bdrewery

MFC r308600:

DIRDEPS_BUILD: Consolidate some logic for skipping of reading
Makefile.depend.


# 311192 03-Jan-2017 bdrewery

MFC r305147:

Add a 'make print-dir' that simply traverses all directories and prints them.


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 301941 15-Jun-2016 bdrewery

Mark targets with _SUBDIR as .PHONY.

This is mostly fixing META_MODE with realinstall wanting a .meta
file when it does not need one. These targets really should
always run though since they have _SUBDIR on them.

Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division


# 301166 01-Jun-2016 gjb

Revert r301137 and r301163, and implement a correct fix
for the CONFS issue with dma.conf and ppp.conf.

Thank you very much to Bryan Drewery for looking into the
problem and providing this fix.

Pointyhat: gjb
Sponsored by: The FreeBSD Foundation


# 298882 01-May-2016 pfg

share: minor spelling fixes.

Mostly comments but these tend to be user-visible.

MFC after: 2 weeks


# 296703 11-Mar-2016 bdrewery

Don't even define or append subdir targets with NO_SUBDIR.

No functional change.

This prevents adding empty targets to the main called target which is
confusing for debugging.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 296124 26-Feb-2016 bdrewery

Import bsd.clang-analyze.mk based on NetBSD's version.

This allows 'make analyze' or 'make OBJ.clang-analyzer' to run the
Clang static analyzer and present results on stdout.

Obtained from: NetBSD (CVS Rev. 1.3)
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5449


# 296067 25-Feb-2016 bdrewery

Slightly lessen the amount of job target output for SUBDIR_PARALLEL.

Sponsored by: EMC / Isilon Storage Division


# 296013 24-Feb-2016 bdrewery

Add more STANDALONE_SUBDIR_TARGETS.

Sponsored by: EMC / Isilon Storage Division


# 295993 24-Feb-2016 bdrewery

Show full DIRPRFX in subdir parallel target name.

For example when building, from buildworld, lib/atf/libatf-c++/tests/detail:
--- all_subdir_atf ---
is now:
--- all_subdir_lib/atf/libatf-c++/tests/detail ---

Sponsored by: EMC / Isilon Storage Division


# 295646 16-Feb-2016 bdrewery

Add an .ORDER for all/install.

Sponsored by: EMC / Isilon Storage Division


# 295380 07-Feb-2016 ngie

Simplify running the FreeBSD test suite

Replace `make regress` (legacy test make target) and `make test` (incomplete
test make target added with the FreeBSD test suite) with make check as it's
consistent with other open source projects.

`make check` defaults to running tests from `.OBJDIR`, but can be overridden
with the `CHECKDIR` variable.

Add `make checkworld` target to simplify running the FreeBSD test suite from
`TESTSBASE` (i.e. the top-level tests directory), similar to buildworld.

Document `make check` and `make checkworld` in build(7).

Other minor changes:

- Rename intermediate file (`Kyuafile.auto`) to `Kyuafile` to simplify
`make check`.
- Remove terse warnings attached to `beforetest`/`aftertest`.
- Add kyua binary check to check target in suite.test.mk; error out if it's
not found

The MFC is [partly] contingent on other build related changes being MFCed.

Differential Revision: https://reviews.freebsd.org/D4406
MFC after: 2 months
X-MFC to: stable/10
Relnotes: yes
Reviewed by: bdrewery, Evan Cramer <eccramer@gmail.com>
Sponsored by: EMC / Isilon Storage Division


# 294354 19-Jan-2016 bdrewery

bsd.subdir.mk: Allow easier modification of [STANDALONE_]SUBDIR_TARGETS.

This reworks r289254 and removes ALL_SUBDIR_TARGETS.

Because there is an include guard in this file there is no need for
LOCAL_ or ?= on SUBDIR_TARGETS or STANDALONE_SUBDIR_TARGETS. These can
just be set via src.conf. By the time bsd.subdir.mk is included it will
just append the values to the existing value and work fine. This allows
a consistent way to append to these variables without introducing a
LOCAL_ var for STANDALONE_SUBDIR_TARGETS or renaming the historical
SUBDIR_TARGETS.

Sponsored by: EMC / Isilon Storage Division


# 294353 19-Jan-2016 bdrewery

installconfig is PARALLEL_SUBDIR safe.

Sponsored by: EMC / Isilon Storage Division


# 291751 04-Dec-2015 bdrewery

Fix 'install*' and many other missing targets with DIRDEPS_BUILD.

My changes in r291635 broke 'make install*' for DIRDEPS_BUILD but also
revealed that some other targets were not guaranteed to be created if
there was a SUBDIR defined. One example is 'installfiles' was never
defined if SUBDIR was not empty.

Sponsored by: EMC / Isilon Storage Division


# 291750 04-Dec-2015 bdrewery

The .if redirection on .WAIT is no longer needed with bmake.

Sponsored by: EMC / Isilon Storage Division


# 291749 04-Dec-2015 bdrewery

Fix 'afterinstall' order not being respected after my changes in r291635.

The problem was that 'afterinstall' was not coming after SUBDIRs were
installed which was the expectation at least in sys/modules for kldxref.

Reported by: np
Pointyhat to: bdrewery
Sponsored by: EMC / Isilon Storage Division


# 291748 04-Dec-2015 bdrewery

Rearrange some common logic.


# 291635 02-Dec-2015 bdrewery

bsd.subdir.mk: Only recurse on called targets, rather than dependencies.

This is to fix 'make all' causing it to recurse on both 'all' and 'buildconfig'
due to 'buildconfig' being in ALL_SUBDIR_TARGETS and being a dependency of
'all'.

This now adds all of the '*includes', '*files' targets as subdir targets,
allowing them to recurse.

This also removes the need for some 'realinstall' hacks in bsd.subdir.mk since
it no longer recurses; only 'install' will recurse and call the proper
'beforeinstall', 'realinstall', and 'afterinstall' in each sub-directory.

This fixes 'make includes' and 'make files' to not be a rerolled ${MAKE}
sub-shell but to rather just recurse on 'inclues' and 'files'. This avoids
various issues such as the one fixed in r289462. As such revert Makefile.inc1
back to using 'includes' which avoids an extra tree walk and parallelizes
the includes phases better.

Makefile.inc1 includes a guard so that 'make all' will not use SUBDIR_PARALLEL,
added in r289438. This is so users do not get a probably broken build if they
run 'make all' from the top-level. Before the change in this commit, the
workaround for 'make everything' was 'par-all' which would depend on 'all' and
cause a proper parallel recursion. Now that will not work so a new
_PARALLEL_SUBUDIR_OK is used to allow it.

This is still part of an effort to combine bsd.(files|incs|confs).mk and move
some of its logic out of bsd.subdir.mk, as attempted in r289282 and reverted in
r289331. This commit fixes the problems found there which was mostly double
recursing during 'includes' which would recurse on itself and 'buildincludes'
and 'installincludes', all in parallel. The logic is still in bsd.subdir.mk
for now.

I've been cautious about this commit but have experienced no breakage on the
tree except for the 'par-all' case which was already a hack. If something foo
is depending on something bar that should recurse, it is very likely that the
foo target is being recursed on already meaning that bar will still effectively
recurse once sub-directories call foo.

Discussed on: arch@
MFC after: never
Sponsored by: EMC / Isilon Storage Division


# 291634 02-Dec-2015 bdrewery

Revert r291633. Some files were missed.


# 291633 01-Dec-2015 bdrewery

bsd.subdir.mk: Only recurse on called targets, rather than dependencies.

This is to fix 'make all' causing it to recurse on both 'all' and 'buildconfig'
due to 'buildconfig' being in ALL_SUBDIR_TARGETS and being a dependency of
'all'.

This now adds all of the '*includes', '*files' targets as subdir targets,
allowing them to recurse.

This also removes the need for some 'realinstall' hacks in bsd.subdir.mk since
it no longer recurses; only 'install' will recurse and call the proper
'beforeinstall', 'realinstall', and 'afterinstall' in each sub-directory.

This fixes 'make includes' and 'make files' to not be a rerolled ${MAKE}
sub-shell but to rather just recurse on 'inclues' and 'files'. This avoids
various issues such as the one fixed in r289462. As such revert Makefile.inc1
back to using 'includes' which avoids an extra tree walk and parallelizes
the includes phases better.

Makefile.inc1 includes a guard so that 'make all' will not use SUBDIR_PARALLEL,
added in r289438. This is so users do not get a probably broken build if they
run 'make all' from the top-level. Before the change in this commit, the
workaround for 'make everything' was 'par-all' which would depend on 'all' and
cause a proper parallel recursion. Now that will not work so a new
_PARALLEL_SUBUDIR_OK is used to allow it.

This is still part of an effort to combine bsd.(files|incs|confs).mk and move
some of its logic out of bsd.subdir.mk, as attempted in r289282 and reverted in
r289331. This commit fixes the problems found there which was mostly double
recursing during 'includes' which would recurse on itself and 'buildincludes'
and 'installincludes', all in parallel. The logic is still in bsd.subdir.mk
for now.

I've been cautious about this commit but have experienced no breakage on the
tree except for the 'par-all' case which was already a hack. If something foo
is depending on something bar that should recurse, it is very likely that the
foo target is being recursed on already meaning that bar will still effectively
recurse once sub-directories call foo.

Discussed on: arch@
MFC after: never
Sponsored by: EMC / Isilon Storage Division


# 290816 14-Nov-2015 sjg

Rename META_MODE option to DIRDEPS_BUILD

This allows META_FILES option to be renamed META_MODE.
Also add META_COOKIE_TOUCH for use in targets that can benefit
from a cookie when in meta mode.

Differential Revision: https://reviews.freebsd.org/D4153
Reviewed by: bdrewery


# 290126 28-Oct-2015 bdrewery

Fix regression from using .USEBEFORE in _SUBDIR in r289705.

Using .USEBEFORE had the unintended side-effect of changing the directory for
the real target ran in the current directory. For example this meant that
the 'make clean' would run in one of the SUBDIR.

Sponsored by: EMC / Isilon Storage Division
Pointyhat to: bdrewery


# 289856 23-Oct-2015 bdrewery

Rework r289778 to always parallelize known targets, without ordering.

- Rather than allow 'make clean*' to ignore dependencies, make a static
list of targets in STANDALONE_SUBDIR_TARGETS that are known to be safe.
This allows a user to override them if needed and avoids adding this feature
to user-defined targets that are in ${SUBDIR_TARGETS}. [1]
- This now also allows to force SUBDIR_PARALLEL when calling these
targets, since no dependencies are needed.

Reported by: ian [1]
Sponsored by: EMC / Isilon Storage Division
MFC after: 3 weeks
X-MFC-With: r289778


# 289778 22-Oct-2015 bdrewery

For SUBDIR_PARALLEL, when doing 'make clean*' or 'make obj' there is no need to
respect SUBDIR_DEPEND_* or .WAIT.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 289705 21-Oct-2015 bdrewery

Remove indirection of _sub target for using _SUBDIR.

This reverts r266473 as the need for it, working around .MAKE and '+'
issues, is no longer needed after r289460. This avoids extra log
output in -j builds of '-- _sub.TARGET --' that are redundant with the
'-- TARGET --' and '-- TARGET_subdir_DIR --' entries already showing.

r266473 also made a subtle change in the ordering of _SUBDIR handling. Before
the change, SUBDIRS were recursed into after building the TARGET due to the
.USE of _SUBDIR *appending* the commands onto the TARGET. After the change
though the indirection caused TARGET to depend on _sub.TARGET which had the
_SUBDIR handling in it. This TARGET would run after recursing. However, the
SUBDIR_PARALLEL handling from r263778 has this ordering as well. Since
this has so far not been a problem, for now make this behavior for
non-SUBDIR_PARALLEL use of _SUBDIR explicit by using .USEBEFORE.
Further research may change this back to .USE as well as the
SUBDIR_PARALLEL handling and bsd.progs.mk recursing.

Sponsored by: EMC / Isilon Storage Division


# 289606 19-Oct-2015 bdrewery

Replace all of the duplicated logic for recursing into a subdir with one
implementation. It is duplicated at run-time but is more easily
maintainable now.

Sponsored by: EMC / Isilon Storage Division


# 289605 19-Oct-2015 bdrewery

Add missing .PHONY for parallel subdir target.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 289334 14-Oct-2015 bdrewery

Recurse on 'buildconfig' and 'installconfig'. Remove the 'config' pseudo target.

The 'config' target isn't really needed right now so just remove it to avoid
any clashes with config(8) building. It's also likely misspelled and should
be 'configs' if we decide to add it back. This was just a convenience
target recently added.

Sponsored by: EMC / Isilon Storage Division


# 289333 14-Oct-2015 bdrewery

Re-indent the ALL_SUBDIR_TARGETS list


# 289331 14-Oct-2015 bdrewery

Revert r289282 for now as the interaction with a directory containing
bsd.files.mk and bsd.subdir.mk is recursing too many times.


# 289282 14-Oct-2015 bdrewery

Replace the out-of-place includes/files/config handling in bsd.subdir.mk with
more typical ALL_SUBDIR_TARGETS entries and target hooks in bsd.incs.mk,
bsd.files.mk and bsd.confs.mk.

This allows the targets to be NOPs if unneeded and still work with the
shortcut 'make includes' to build and then install in a parallel-safe manner.

Sort and re-indent the ALL_SUBDIR_TARGETS with the new entries.

Sponsored by: EMC / Isilon Storage Division


# 289277 13-Oct-2015 bdrewery

Add a note about the mysterious files/includes/config block.

This originated from r96668.


# 289254 13-Oct-2015 bdrewery

bsd.subdir.mk: Move all of the targets into ALL_SUBDIR_TARGETS.

Also improve documentation.

The SUBDIR_TARGETS variable should really be named LOCAL_SUBDIR_TARGETS, but
renaming it may be a surprise for downstream vendors who use this variable.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 289253 13-Oct-2015 bdrewery

bsd.subdir.mk: Handle cleanobj.

Before this, the target was unknown. Now it will recurse on subdirs and run
the target in the current directory. It is required to recurse as there
may be subdirs that have objs in their directory or in the object directory,
so it is not enough to just delete the objdir of the subdir parent.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 289085 09-Oct-2015 bapt

Add a new bsd.confs.mk similar to bsd.files.mk or bsd.incs.mk

It defines a CONFS variable for all files supposed to be installed as a
configuration file and handle as such


# 288241 25-Sep-2015 bdrewery

Remove 'set -e' that are no longer needed as it is already default.

When bmake was initially imported at r241298 shell commands were no longer
ran with 'set -e' as they were before. This was fixed in r254980 so they
again always use 'set -e'.

Sponsored by: EMC / Isilon Storage Division


# 287186 27-Aug-2015 imp

Automatically append SUBDIR.yes to the SUBDIR variable, and
remove duplicates. We cannot sort SUBDIR because many Makefiles
have .WAIT in the list which is strongly ordering. Rather than
try to second guess when to sort and when to not sort depending
on .WAIT being in the list, just remove duplicates.


# 284345 13-Jun-2015 sjg

Add META_MODE support.

Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision: D2796
Reviewed by: brooks imp


# 267511 15-Jun-2014 ian

Create a mechanism for providing fine-grained build order dependencies
during SUBDIR_PARALLEL builds. This augments the coarse .WAIT mechanism,
which is still useful if you've got a situation such as "almost everything
depends on A and B".

Because the parallel subdir mechanism uses non-obvious mangling of
target names, which should probably remain a private detail of the
implementation, it's not easy to do things like "libfoo: libbar", so
instead the new mechanism lets you set a variable that lists dependencies:

SUBDIR_DEPEND_libfoo= libgroodah libpouet

Note that while I'm using libraries as an example here, it really has
nothing to do with the generated library files. This is really saying
"build in directory libfoo after building in the libgroodah and libpouet
directories."

This updates lib/Makefile with dependency information based on the old
almost-accurate comment block and by combing through lib/* makefiles
looking for LDADD dependencies to other libraries within lib/*.

Reviewed by: Jia-Shiun Li <jiashiun@gmail.com>


# 267331 10-Jun-2014 jmmv

Put the test suite in its own tests.txz distribution file.

Force all the contents of /usr/tests to go into a separate distribution
file so that users of binary releases can easily choose to not install it.

To make this possible, we need two fixes:
- bsd.subdir.mk needs to properly honor NO_SUBDIR in all cases so that we
do not recurse into 'tests' subdirectories when we needn't. Otherwise,
we end up with some Kyuafiles in base.txz.
- etc/Makefile needs to skip installing tests in its 'distribute' target
so that a Kyuafile doesn't leak into base.txz.

Approved by: gjb


# 266473 20-May-2014 sjg

Use an intermediate target to associate with _SUBDIR which is marked .MAKE
this allows make -n to do tree walks as expected without
doing anything else (as intended).
Use prefix _sub. to help avoid conflict with any real target.

Reviewed by: imp


# 266456 19-May-2014 sjg

Revert previous change - doesn't cover all cases.


# 266450 19-May-2014 sjg

_SUBDIR is marked .MAKE - since it runs a sub-make.
Targets thus marked are supposed to run even with -n.
As such they should not do anything except run the sub-make.

Use an intermediate target _* to associate with _SUBDIR and which
depends on installincludes etc so that we get the correct behavior with -n.

Reviewed by: marcel


# 264822 23-Apr-2014 ian

Allow .WAIT to appear in SUBDIR= lists, to provide some control over
parallel build order. All subdirs before a .WAIT will be built before
any subdirs after it.

Reviewed by: imp@


# 263778 26-Mar-2014 dim

Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to process
all the SUBDIR entries in parallel, instead of serially. Apply this
option to a selected number of Makefiles, which can greatly speed up the
build on multi-core machines, when using make -j.

This can be extended to more Makefiles later on, whenever they are
verified to work correctly with parallel building.

I tested this on a 24-core machine, with make -j48 buildworld (N = 6):

before stddev after stddev
======= ====== ======= ======
real time 1741.1 16.5 959.8 2.7
user time 12468.7 16.4 14393.0 16.8
sys time 1825.0 54.8 2110.6 22.8

(user+sys)/real 8.2 17.1

E.g. the build was approximately 45% faster in real time. On machines
with less cores, or with lower -j settings, the speedup will not be as
impressive. But at least you can now almost max out a machine with
buildworld!

Submitted by: jilles
MFC after: 2 weeks


# 251749 14-Jun-2013 sjg

Flag recursive make targets with .MAKE (has no effect on fmake)
make -n will still exectute such targets
make -N will not.

Reviewed by: obrien


# 242711 07-Nov-2012 sjg

Enable ATF testing.

Submitted by: Garrett Cooper
Approved by: marcel (mentor)


# 241298 06-Oct-2012 marcel

Add support for bmake. This includes:
1. Don't do upgrade_checks when using bmake. As long as we have WITH_BMAKE,
there's a bootstrap complication in ths respect. Avoid it. Make the
necessary changes to have upgrade_checks work wth bmake anyway.
2. Remove the use of -E. It's not needed in our build because we use ?= for
the respective variables, which means that we'll take the environment
value (if any) anyway.
3. Properly declare phony targets as phony as bmake is a lot smarter (and
thus agressive) about build avoidance.
4. Make sure CLEANFILES is complete and use it on .NOPATH. bmake is a lot
smarter about build avoidance and should not find files we generate in
the source tree. We should not have files in the repository we want to
generate, but this is an easier way to cross this hurdle.
5. Have behavior under bmake the same as it is under make with respect to
halting when sub-commands fail. Add "set -e" to compound commands so
that bmake is informed when sub-commands fail.
6. Make sure crunchgen uses the same make as the rest of the build. This
is important when the make utility isn't called make (but bmake for
example).
7. While here, add support for using MAKEOBJDIR to set the object tree
location. It's the second alternative bmake looks for when determining
the actual object directory (= .OBJDIR).

Submitted by: Simon Gerraty <sjg@juniper.net>
Submitted by: John Van Horne <jvanhorne@juniper.net>


# 200178 06-Dec-2009 ed

Make `make cleanilinks' work in /sys/modules.

cleanilinks wasn't listed in <bsd.subdir.mk>. Instead of adding it to
/sys/modules/Makefile, we'd better just add it to <bsd.subdir.mk>
directly, so we don't need to change files like /sys/modules/sound/Makefile
as well. This means you can finally clean up all those dangling symlinks
created by individual module compilation at once.


# 174409 07-Dec-2007 ru

Make "manlint" recursive.

Prodded by: obrien


# 146817 31-May-2005 ru

For ${SUBDIR} targets, change the type of dependency operator from `::'
to `:', so that it stays compatible with a stale dependency recorded in
.depend when the type of "foo" changes from file to directory or back.
Compensate for the loss of the "If no sources are specified, the target
is always re-created" feature by marking these targets with the .PHONY
attribute. While here, fix a bug in the target's script (nobody uses
these targets apparently).


# 141912 14-Feb-2005 ru

Add a SUBDIR_TARGETS variable which can be set to a list of
additional targets that will cause descending into subdirs.
Example:

cd /sys/modules; make load SUBDIR_TARGETS=load

(But don't try it with your pet.)

Submitted by: Alexey Klimov
PR: 47601


# 139761 06-Jan-2005 krion

Remove trailing spaces.


# 134904 07-Sep-2004 imp

[[ Forced commit due to fumble with the file used to commit with.
cvsgNMRSs vs cvsg4JFe3 :-( ]]

When recursing, print the target name as well as the subdirectory.
This changes the output a little, but appears to break no scripts.
These changes should make the debugging of build problems easier, as
well as explain why it appears things build 4 times (they don't,
really, since there's obj, depend, all and install).

I've been running these changes, or variations on them, for about 2
years.

Reviewed by: arch@ (des, markm, koshy, marcel, scottl)


# 134903 07-Sep-2004 imp

Although 'Unanimous Consent' appears to be a well defined and used in
the US Senate, Canadian Parliament and Australian Senate, it was
causing some confusion. After some consultation with Mark Murray,
change this to 'without objection' since often times a plain-speaking
term is preferable to a regionally used term.

Also, clarify that this procedure is to be used when for more mundane
matters that need a sanity check, but don't need the whole, ponderous
voting proceedure that more difficult issues require. Core members
that read email in any given 48 hour period are trusted enough to know
the difference and to provide the sanity check as necessary.

Reviewed by: markm


# 133369 09-Aug-2004 harti

Use the '+' flag to make make recurse into sub-directories even when
given -n. For POLA reasons this behaviour is switched on only when
at least two -n flags are given to make. One -n flag keeps the old behaviour
of showing the shell command that would recurse into the sub-directories.

Discussed with: ru


# 99875 12-Jul-2002 ru

Moved the `distribute' target from bsd.obj.mk to bsd.subdir.mk,
to make it call `install' in the bsd.subdir.mk-driven makefiles
too. (share/examples/Makefile,v 1.29 changed the bsd.prog.mk
to bsd.subdir.mk and many stuff was lost during "make release".
I then merged this change in rev. 1.28.2.2 to work around the
namespace pollution (FILES) in this makefile.)

There was an added complexity here. Both the `distribute' and
`install' targets are recursive (they propagate to SUBDIRs).
So `distribute' first calls `install' in the ${.CURDIR}, then
calls `distribute' in each SUBDIR, etc. The problem is that
`install' (being also recursive) causes the stuff from SUBDIR
to be installed twice, first time thru `install' in ${.CURDIR}
triggered by `distribute', second time by `distribute' run in
the SUBDIR. This problem is not new, but it became apparent
only after I moved the `distribute' target from bsd.obj.mk to
bsd.subdir.mk. My first attempt testing the fix failed due to
this, because the whole world was distributed twice, causing
all the imaginable mess (kerberos5 stuff was installed into both
"base" and "krb5" dists, there was /sbin/init.bak, etc.)
I say the problem is not new because bsd.prog.mk and bsd.lib.mk
makefiles with SUBDIR (even without this fix) had this problem
for years. Try e.g. running ``make distribute DISTDIR=/foo''
from usr.bin/bzip2 or from lib/libcom_err (without the fix) and
watch the output.

So the solution was to make `install' behave non-recursive when
executed by `distribute'. My first attempt in passing SUBDIR=
to the `install' in the `distribute' body failed because of the
way how src/Makefile and src/Makefile.inc1 communicate with each
other. SUBDIR='s assignment precedence on the "make install
SUBDIR=" command line is lowered after src/Makefile wrapper calls
"make ... -f ${.CURDIR}/Makefile.inc1 install" because SUBDIR=
is moved into environment, and Makefile.inc1's assignments now
take higher precedence. This may be fixed someday when we merge
Makefile with Makefile.inc1. For now, this is implemented as a
NO_SUBDIR knob.

Spotted by: Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
Prodded by: des
MFC after: 3 days


# 99215 01-Jul-2002 ru

Get rid of the bogus dependencies between beforeinstall, realinstall,
and afterinstall targets. Make sure they are run in sequence in the
-j case.

This fixes the recent breakage with beforeinstall being run _after_
realinstall.

Reported by: knu


# 97769 03-Jun-2002 ru

Reimplement FILES support using bsd.files.mk with the
same set of features as in recently added bsd.incs.mk
(FILESGROUPS, accessibility from both bsd.prog.mk and
bsd.lib.mk, de-pessimized typical installation path,
etc.) New standard targets: buildfiles, installfiles,
and files (buildfiles + installfiles).


# 96668 15-May-2002 ru

Rename `includes' to `buildincludes'.
Rename `incsinstall' to `installincludes'.
Make `includes' a -j safe shortcut for `buildincludes' + `installincludes'.
`buildincludes' and `installincludes' are SUBDIR friendly, if run directly.


# 96462 12-May-2002 ru

Added new bsd.incs.mk which handles installing of header files
via INCS. Implemented INCSLINKS (equivalent to SYMLINKS) to
handle symlinking include files. Allow for multiple groups of
include files to be installed, with the powerful INCSGROUPS knob.
Documentation to follow.

Added standard `includes' and `incsinstall' targets, use them
in Makefile.inc1. Headers from the following makefiles were
not installed before (during `includes' in Makefile.inc1):

kerberos5/lib/libtelnet/Makefile
lib/libbz2/Makefile
lib/libdevinfo/Makefile
lib/libform/Makefile
lib/libisc/Makefile
lib/libmenu/Makefile
lib/libmilter/Makefile
lib/libpanel/Makefile

Replaced all `beforeinstall' targets for installing includes
with the INCS stuff.

Renamed INCDIR to INCSDIR, for consistency with FILES and SCRIPTS,
and for compatibility with NetBSD. Similarly for INCOWN, INCGRP,
and INCMODE.

Consistently use INCLUDEDIR instead of /usr/include.

gnu/lib/libstdc++/Makefile and gnu/lib/libsupc++/Makefile changes
were only lightly tested due to the missing contrib/libstdc++-v3.
I fully tested the pre-WIP_GCC31 version of this patch with the
contrib/libstdc++.295 stuff.

These changes have been tested on i386 with the -DNO_WERROR "make
world" and "make release".


# 96164 07-May-2002 ru

Added internal, non-recursive (SUBDIR) versions of the `all-man'
and `maninstall' targets. This fixes the issue where each subdir
was descended into twice during "make all", and also resurrects
the standardization of `maninstall'.

Urged by: bde


# 95509 26-Apr-2002 ru

Milestone #1 in cross-arch make releases.

Do not install games and profiled libraries to the ${CHROOTDIR}
with the initial installworld.

Eliminate the need in the second installworld. For that, make sure
_everything_ is built in the "world" environment, using the right
tool chain.

Added SUBDIR_OVERRIDE helper stuff to Makefile.inc1. Split the
buildworld process into stages, and skip some stages when
SUBDIR_OVERRIDE is set (used to build crypto, krb4, and krb5
dists).

Added NO_MAKEDB_RUN knob to Makefile.inc1 to avoid running
makewhatis(1) at the end of installworld (used when making crypto,
krb4, and krb5 dists).

In release/scripts/doFS.sh, ensure that the correct boot blocks are
used.

Moved the creation of the "crypto" dist from release.5 to
release.2.

In release.3 and doMFSKERN, build kernels in the "world"
environment. KERNELS now means "additional" kernels, GENERIC is
always built.

Ensure we build crunched binaries in the "world" environment.
Obfuscate release/Makefile some more (WMAKEENV) to achieve this.

Inline createBOOTMFS target.

Use already built GENERIC kernel modules to augment mfsfd's
/stand/modules. GC doMODULES as such.

Assorted fixes:

Get rid of the "afterdistribute" target by moving the single use
of it from sys/Makefile to etc/Makefile's "distribute".

Makefile.inc1: apparently "etc" no longer needs to be last for
"distribute" to succeed.

gnu/usr.bin/perl/library/Makefile.inc: do not override the
"install" and "distribute" targets, do it the "canonical" way.

release/scripts/{man,cat}pages-make.sh: make sure Perl manpages and
catpages appear in the right dists. Note that because Perl does
not respect the MANBUILDCAT (and NOMAN), this results in a loss of
/usr/share/perl/man/cat* empty directories. This will be fixed
soon.

Turn MAKE_KERBEROS4 into a plain boolean variable (if it is set it
means "make KerberosIV"), as documented in the make.conf(5)
manpage. Most of the userland makefiles did not test it for "YES"
anyway.

XXX Should specialized kerberized libpam versions be included into
the krb4 and krb5 dists? (libpam.a would be incorrect anyway if
both krb4 and krb5 dists were choosen.)

Make sure "games" dist is made before "catpages", otherwise games
catpages settle in the wrong dist.

Fast build machine provided by: Igor Kucherenko <kivvy@sunbay.com>


# 95356 24-Apr-2002 ru

The install.debug and reinstall.debug targets are needed solely
to build kernel and kernel modules so stop supporting them in
bsd.subdir.mk and reimplement them in kern.post.mk and kmod.mk
as special versions of the install and reinstall targets, and
only define them if DEBUG is also defined (when debug versions
are really built).

Prompted by: bde


# 95327 23-Apr-2002 obrien

Change the name of the 'bin' distribution to 'base'.
This is done since it contains much more than /bin, and also gets in the
way when making a combined install+fixit CD.

OK'ed by: jkh


# 95306 23-Apr-2002 ru

Merge bsd.obj.mk's version of the _SUBDIR target with bsd.subdir.mk.

Ensure all standard targets honor SUBDIR. Now `make obj' descends into
SUBDIRs even if NOOBJ is set (some descendants may still need an object
directory, but we do not have such precedents). Now `make install' in
non-bsd.subdir.mk makefiles runs `afterinstall' target _after_ `install'
in SUBDIRs, like we do in bsd.subdir.mk. Nothing depended on the wrong
order anyway.

Fixed `distribute' targets (except for the bsd.subdir.mk version) so that
they do not depend on _SUBDIR; `distribute' calls `install' which already
depends on _SUBDIR.

De-standardize `maninstall', otherwise manpages would be installed twice.
(To be revised later.)


# 94940 17-Apr-2002 ru

Don't include bsd.own.mk from sys.mk, this makes it impossible
to use ``.if defined()'' inside bsd.own.mk to test for defines
in individual makefiles. For example, setting DEBUG_FLAGS in
Makefile didn't take the desired effect on the STRIP assignment.

Added bsd.init.mk (like in NetBSD) that handles the inclusion
of ../Makefile.inc and bsd.own.mk from all bsd.*.mk files that
"build something".

Back out bsd.own.mk,v 1.15: moved OBJFORMAT initialization back
to sys.mk (several source tree makefiles want to check it early)
and removed MACHINE_ARCH initialization (it's hard to see from
looking at the commitlogs what the problem was at the time, but
now it serves no purpose).

Prohibit the direct inclusion of bsd.man.mk and bsd.libnames.mk.

Protect bsd.obj.mk from repetitive inclusion. Prohibiting the
direct inclusion of bsd.obj.mk might be a good idea too.


# 90311 06-Feb-2002 ru

Back out revision 1.23 (SUBDIR_CHANGE).

Not objected to by: bde, eivind


# 85570 26-Oct-2001 des

Support the "install.debug" and "reinstall.debug" targets for kernel modules.
Small tweaks to kldxref may be necessary to avoid the surprising (but harm-
less) behaviour of 'kldload foo' loading foo.ko.debug instead of foo.ko if
it is present in the kernel directory.

Approved by: a week of silence on -arch
MFC after: 2 weeks


# 74842 27-Mar-2001 ru

Make it possible to build manpages for the entire source tree.


# 55337 03-Jan-2000 marcel

Fix typo.

Submitted by: Richard Wackerbarth <rkw@dataplex.net>


# 53152 14-Nov-1999 marcel

${MACHINE} -> ${MACHINE_ARCH}

All Makefiles now use MACHINE_ARCH for the target architecture.
Unification is required for cross-building.

Tags added to:
sys/boot/Makefile
sys/boot/arc/loader/Makefile
sys/kern/Makefile
usr.bin/cpp/Makefile
usr.bin/gcore/Makefile
usr.bin/truss/Makefile

usr.bin/gcore/Makefile:
fixed typo: MACHINDE -> MACHINE_ARCH


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 44922 21-Mar-1999 bde

Restored objlink. The previous commit was confused about the difference
between OBJLINK and objlink.


# 44755 14-Mar-1999 markm

Bitrot. Remove objlink as it is not pleasant to be downwind.

PR: 8071
Reviewed by: Sheldon Hearn <sheldonh@iafrica.com>


# 38183 08-Aug-1998 peter

Make ../Makefile.inc handling more consistant to prevent multiple includes
when certain .mk files include other .mk files. This will remove the
need for multiple include protection in some other makefiles around the
tree (and helps some elf conditionals).


# 35784 06-May-1998 wosch

Delete stale comment.
Pointed out by: bde


# 34934 28-Mar-1998 eivind

Support for fine-grained external control of subdir building.


# 34892 26-Mar-1998 eivind

Remove special handling of 'tags' for complex subdir systems
(presently only used in tip; should have been used by e.g. pkg_add).

Submitted by: bde


# 34829 23-Mar-1998 eivind

Support new version of global.

Submitted by: Shigio Yamaguchi <shigio@wafu.netgate.net>
Tested by: make buildworld


# 34528 12-Mar-1998 eivind

Introduce the 'regress' target.

Silently approved by: -hackers, -current


# 31177 15-Nov-1997 wosch

target(__target) -> target(${__target})

PR: bin/4736
Submitted by: Martin Kammerhofer <dada@sbox.tu-graz.ac.at>

Index: bsd.subdir.mk
===================================================================
RCS file: /usr/cvs/src/share/mk/bsd.subdir.mk,v
retrieving revision 1.18
diff -u -r1.18 bsd.subdir.mk
--- bsd.subdir.mk 1997/06/21 15:40:34 1.18
+++ bsd.subdir.mk 1997/11/09 18:04:33
@@ -59,7 +59,7 @@

.for __target in all checkdpadd clean cleandir depend lint \
maninstall obj objlink
-.if !target(__target)
+.if !target(${__target})
${__target}: _SUBDIRUSE
.endif
.endfor


# 26760 21-Jun-1997 jkh

Change the distribute targets so that a given item in our source tree
can place itself into n distributions, where n >= 1.


# 24861 13-Apr-1997 jkh

Support GLOBAL style tags.


# 24431 31-Mar-1997 scrappy

Remove ${MAKEFLAGS} on recommendation by Bruce, mainly because the reason
for adding it was so that -j3 carried through on a make -j3 world, but found
at least one circumstance where it breaks 'make depend'


# 24421 30-Mar-1997 scrappy

Add ${MAKEFLAGS} to ${MAKE} in _SUBDIRUSE so that something like
'make -j3 world' works

Jordan points out that this may not be the only place this is required to be
added, but so far, its the only one I've found to break -j3


# 23549 08-Mar-1997 wosch

Add comments.


# 22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 18427 20-Sep-1996 bde

Added a `checkdpadd' target to help check that ${DPADD} is consistent with
${LDADD}. It doesn't handle internal libraries very well yet.


# 16672 24-Jun-1996 jkh

Add default targets for cleandepend and objlink.
Submitted by: Michael Hancock <michaelh@cet.co.jp>


# 15061 05-Apr-1996 wosch

remove BINGRP?=, BINOWN?=, BINMODE?=, STRIP?=
use .for loop for common targets


# 6716 25-Feb-1995 phk

"make distribute" have changed, beware if you use it.


# 5812 23-Jan-1995 jkh

Eliminate a bogus stray tab.


# 5585 14-Jan-1995 jkh

Change DISTRIBUTION names. Also make bsd.doc.mk go to doc distribution,
not bin. Hmmm.


# 4442 13-Nov-1994 phk

Add a new "distribute" target. This is a variant of install, which will
put the stuff into the right "distribution". As default things end up
in "bindist".

Normal (ie: most) makefiles know naught of this.

More commits will follow, which will direct various parts of the tree
into the distribution we want them in.

Some of the grief of being release-engineer is supposed to go away with this.


# 2827 16-Sep-1994 jkh

Add support for DEBUG_FLAGS. If you say something like:

make DEBUG_FLAGS=-g2

You can compile something for debugging at debugging level 2.
It will also take care not to strip the resulting executable(s).


# 2352 28-Aug-1994 bde

Use ${ECHODIR} instead of `echo' for printing directory names so that
`make -ss' is very quiet.


# 1844 04-Aug-1994 wollman

Spplat our 1.1.5 `mk' ifiles over the top of the 4.4 ones. So far
as I can tell, this is ts the right thing to do.


# 1639 30-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1638,
which included commits to RCS files with non-trunk default branches.


# 1638 30-May-1994 rgrimes

BSD 4.4 Lite Share Sources