MAKEPP_SANDBOXES(1)
๐ MAKEPP_SANDBOXES ๐
okay bestie, so this is a page from the Makepp manual โ and it's literally all about how to partition a makepp build, aka carving up your file tree so nothing gets messy. it's giving very much "let's all stay in our own lanes" energy. ๐ฆ
โจ NAME โจ
makepp_sandboxes โ how to partition a makepp build ๐
๐ธ DESCRIPTION ๐ธ
okay so before we even get into it, here are the shorthand letters you're gonna see floating around, and which long options they map to:
D:--do-build,--dont-build,--dont-read,--do-readI:--in-sandbox,--inside-sandboxO:--out-of-sandboxS:--sandbox,--sandbox-warn,--sandbox-warningV:--virtual-sandbox
fr fr, there are a couple of reasons you might wanna partition the file tree for a makepp build:
- if you know that the majority of the tree is not affected by any changes made to source files since the previous build, then you can tell makepp to assume that files in those parts of the tree are already up-to-date โ which means it won't even implicitly load their makefiles, let alone compute and check their dependencies. (heads up though: explicitly loaded makefiles are still loaded. no take-backs on those. ๐)
- if you've got multiple makepp processes accessing the same tree, then you want an error to pop off if you detect that two concurrent processes are writing the same part of the tree, or that one process is reading a part of the tree that a concurrent process is writing. either way? you've got a race condition, and in a race condition the relative order of events in two concurrent processes (which cannot be guaranteed) may affect the result. ๐
makepp has sandboxing facilities that address both of these concerns. slay.
๐ Sandboxing Options ๐
the following makepp options may be used to set the sandboxing properties of the subtree given by path and all of its files and potential files:
--dont-buildpath--do-buildpath โ set or reset thedont-buildproperty. any file with this property set is assumed to be up-to-date already, and no build checks will be performed. the default is reset (i.e.do-build), except if you have aRootMakeppfile, in which case everything outside of its subtree isdont-build. ๐--sandboxpath--in-sandboxpath--inside-sandboxpath--out-of-sandboxpath โ set or reset thein-sandboxproperty. an error is raised if makepp would otherwise write a file with this property reset. build checks are still performed, unless thedont-buildproperty is also set. the default is set (i.e.in-sandbox), unless there are any--sandboxoptions, in which case the default for all other files is reset (i.e.out-of-sandbox).--sandbox-warn--sandbox-warningโ downgrade violations ofin-sandboxanddont-readto warnings instead of errors. this is useful when there are hundreds of violations, so that you can collect all of them in a single run and take appropriate corrective action. otherwise, you see only one violation per makepp invocation, and you don't know how many are left until they're all fixed. ๐ญ genuinely a lifesaver for cleanup arcs.--dont-readpath--do-readpath โ set or reset thedont-readproperty. an error is raised if makepp would otherwise read a file with this property set. the default is reset (i.e.do-read).--virtual-sandboxโ don't rewrite build infos of files that were not created by this makepp process. this is useful when running concurrent makepp processes with overlapping sandboxes, and you are certain that no two processes will attempt to build the same target. makepp will then refrain from caching additional information about files that it reads, because there might be other concurrent readers. ๐ซถ
each of these 3 properties applies to the entire subtree, including to files that do not yet exist. more specific paths override less specific paths. a specified path may be an individual file, even if the file does not yet exist. โจ
if a property is both set and reset on the exact same path, then the option that appears furthest to the right on the command line takes precedence. periodt.
๐ฆ Sandboxing for Acceleration ๐ฆ
if you want to prevent makepp from wasting time processing files that you know are already up-to-date (in particular, files that are generated by a build tool other than makepp), then --dont-build is the option for you. ๐
by far the most common case for such an optimization is that you know that everything not at or below the starting directory is already up-to-date. this can be communicated to makepp using:
--dont-build /. --do-build .
๐ Sandboxing for Concurrent Processes ๐
one technique that can reduce build latency is to have multiple makepp processes working on the same tree. ngl, this is quite a bit more difficult to manage than using the -j option, but it can also be substantially more effective because:
- with sandboxing, the processes may be running on multiple hosts, for example, via a job queuing system. increasing the
-jlimit eventually exhausts the CPU resources of a single host, and can even slow the build due to excessive process forking. ๐ฎโ๐จ -jdoes not currently parallelize some of makepp's time-consuming tasks such as loading makefiles, scanning, building implicit dependencies while scanning, and checking dependencies.
the biggest risk with this approach is that the build can become nondeterministic if processes that might be concurrent interact with one another. this leads to build systems that produce incorrect results sporadically, and with no simple mechanism to determine why it happens. absolutely cursed behavior, no cap. ๐
to address this risk, it is advisable to partition the tree among concurrent processes such that if any process accesses the filesystem improperly, then an error is deterministically raised immediately. normally, this is accomplished by assigning to each concurrent process a sandbox in which it is allowed to write, where the sandboxes of no two concurrent processes may overlap. ๐ฏโโ๏ธ
in addition, each process marks the sandboxes of any other possibly concurrent processes as dont-read. if a process reads a file that another concurrent process is responsible for writing (and which therefore might not yet be written), then an error is raised immediately. ๐จ
๐ธ Sandboxing for Sequential Processes ๐ธ
when the build is partitioned for concurrent makepp processes, there is also usually a sequential relationship between various pairs of processes. for example, there may be a dozen concurrent compile processes, followed by a single link process that cannot begin until all of the compile processes have completed. such sequential relationships must be enforced by whatever mechanism is orchestrating the various makepp processes (for example, the job queuing system). main character energy from the orchestrator, honestly.
when processes have a known sequential relationship, there is normally no need to raise an error when they access the same part of the tree, because the result is nonetheless deterministic. it's fine, bestie, we're chill. โจ
however, it is generally beneficial to specify --dont-build options to the dependent process (the link process in our example) that notify it of the areas that have already been updated by the prerequisite processes (the compile jobs in our example). in this manner, we avoid most of the unnecessary work of null-building targets that were just updated. ๐
๐ AUTHOR ๐
Anders Johnson (anders@ieee.org) โ we love a legend. ๐
okay that's the whole vibe check, bestie โ this was written for perl v5.32.0 and dated 2021-01-06, so if you ever need to cite it, that's the receipt. go forth and sandbox responsibly. ๐ฆ๐โจ
๐ฆ where this page comes from
- debian bookworm: makepp 2.0.98.5-2.1
- ubuntu jammy: makepp 2.0.98.5-2.1
- ubuntu noble: makepp 2.0.98.5-2.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms