Page MenuHomeFreeBSD

Ensure files are created during the build when using bsd.subdir.mk.
AbandonedPublic

Authored by jmmv on Jun 8 2014, 4:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 14 2025, 3:21 AM
Unknown Object (File)
Nov 21 2025, 12:31 PM
Unknown Object (File)
Nov 15 2025, 12:09 PM
Unknown Object (File)
Nov 15 2025, 12:09 PM
Unknown Object (File)
Nov 15 2025, 12:09 PM
Unknown Object (File)
Nov 15 2025, 9:56 AM
Unknown Object (File)
Nov 15 2025, 7:47 AM
Unknown Object (File)
Nov 13 2025, 12:38 AM
Subscribers
None

Details

Reviewers
jilles
imp
Summary

When FILES is defined in a Makefile that _also_ includes
bsd.subdir.mk, the build of the files (if any) was not properly
triggered during the build stage. This was because bsd.files.mk
did not define the buildfiles target if it was already defined...
and bsd.subdir.mk defined this target on its own, thus causing a
conflict.

Fix this by unconditionally defining buildfiles from bsd.files.mk;
this is safe because nothing else in the tree needs to redefine this
and because the target itself contains no commands: all it does is
define dependencies. Also ensure that bsd.files.mk is always pulled
in by bsd.test.mk regardless of what bsd.prog.mk does.

These fixes allow "make installworld" to run cleanly on a system with
read-only src and obj trees.

Changed based on a patch from jilles.

Test Plan

make tinderbox clean.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

jmmv retitled this revision from to Ensure files are created during the build when using bsd.subdir.mk..
jmmv updated this object.
jmmv edited the test plan for this revision. (Show Details)
jmmv added reviewers: imp, jilles.
share/mk/bsd.files.mk
7

I'd move the .if !target(...) to this file. All the other guard targets are done this way to not leak implementation details.

share/mk/bsd.files.mk
7

You mean allowing bsd.files.mk to be included more than once and just protecting its whole contents behind this guard? If yes, SGTM.

Move include guard to bsd.files.mk per imp's suggestion.

Committed. Thanks for the feedback.