Skip to content

Commit e79b0a1

Browse files
authored
Merge pull request #4898 from mwichmann/doc/sideeffect
Manpage improvement: SideEffect
2 parents 814b4a4 + 8c544b2 commit e79b0a1

3 files changed

Lines changed: 51 additions & 43 deletions

File tree

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
1616
- ty: Initial support setup within `pyproject.toml`.
1717
- Removed Python 3.7 & 3.8 support.
1818

19+
From Mats Wichmann:
20+
- Reference manual improvements:
21+
* Additional clarification for SideEffect()
22+
1923

2024
RELEASE 4.11.1 - Mon, 26 Aug 2026 21:16:00 -0700
2125

RELEASE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ DOCUMENTATION
6060
typo fixes, even if they're mentioned in src/CHANGES.txt to give
6161
the contributor credit)
6262

63+
* Additional clarification for SideEffect() in manpage.
64+
6365
DEVELOPMENT
6466
-----------
6567

SCons/Environment.xml

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,63 +3274,65 @@ if 'FOO' not in env:
32743274
<para>
32753275
Declares
32763276
<parameter>side_effect</parameter>
3277-
as a side effect of building
3277+
as a file that may be created or updated while building
3278+
<parameter>target</parameter>,
3279+
but is not the primary output of the builder that builds
32783280
<parameter>target</parameter>.
32793281
Both
32803282
<parameter>side_effect</parameter>
32813283
and
32823284
<parameter>target</parameter>
3283-
can be a list, a file name, or a node.
3284-
A side effect is a target file that is created or updated
3285-
as a side effect of building other targets.
3286-
For example, a Windows PDB
3287-
file is created as a side effect of building the .obj
3288-
files for a static library,
3289-
and various log files are created updated
3290-
as side effects of various TeX commands.
3291-
If a target is a side effect of multiple build commands,
3292-
&scons;
3293-
will ensure that only one set of commands
3294-
is executed at a time.
3295-
Consequently, you only need to use this method
3296-
for side-effect targets that are built as a result of
3297-
multiple build commands.
3285+
may be a filename, a Node object, or a list of filenames or Nodes.
32983286
</para>
32993287

33003288
<para>
3301-
Because multiple build commands may update
3302-
the same side effect file,
3303-
by default the
3289+
Use &f-SideEffect; for shared auxiliary output files,
3290+
especially when the same file may be written by more than one
3291+
otherwise-independent build command.
3292+
Declaring the file as a side effect tells &SCons; that commands which
3293+
write the same
33043294
<parameter>side_effect</parameter>
3305-
target is
3306-
<emphasis>not</emphasis>
3307-
automatically removed
3308-
when the
3295+
must not run at the same time.
3296+
This is primarily important for parallel builds.
3297+
</para>
3298+
3299+
<para>
3300+
Typical examples include compiler-generated database files,
3301+
such as Windows PDB files, and log or auxiliary files generated by
3302+
document-processing tools.
3303+
For example, several object-file compilations may update the same PDB file.
3304+
Declaring the PDB file as a side effect of those object-file targets
3305+
prevents &SCons; from running those compilations concurrently when doing so
3306+
could corrupt the PDB file.
3307+
</para>
3308+
3309+
<para>
3310+
Do not use &f-SideEffect; for an ordinary additional output that should be
3311+
treated as a normal build target.
3312+
If a command deliberately produces multiple primary output files,
3313+
list those files as targets of the builder or &Command; call instead.
3314+
Use &f-SideEffect; only for auxiliary files whose contents are a consequence
3315+
of building other targets and whose exact update relationship is not suitable
3316+
as a normal target dependency.
3317+
</para>
3318+
3319+
<para>
3320+
A side-effect file is not automatically removed when
33093321
<parameter>target</parameter>
3310-
is removed by the
3311-
<option>-c</option>
3322+
is cleaned with the
3323+
<link linkend="opt-clean"><option>-c</option></link>
33123324
option.
3313-
(Note, however, that the
3314-
<parameter>side_effect</parameter>
3315-
might be removed as part of
3316-
cleaning the directory in which it lives.)
3317-
If you want to make sure the
3318-
<parameter>side_effect</parameter>
3319-
is cleaned whenever a specific
3320-
<parameter>target</parameter>
3321-
is cleaned,
3322-
you must specify this explicitly
3323-
with the
3324-
&f-link-Clean;
3325-
or
3326-
&f-env-Clean;
3327-
function.
3325+
This is because the same side-effect file may be shared by several targets.
3326+
If the side-effect file should be removed when cleaning a particular target,
3327+
declare that explicitly with
3328+
&f-link-Clean;.
33283329
</para>
33293330

33303331
<para>
3331-
This function returns the list of side effect Node objects that were successfully added.
3332-
If the list of side effects contained any side effects that had already been added,
3333-
they are not added and included in the returned list.
3332+
Returns the list of side-effect Node objects that were
3333+
successfully added by this call.
3334+
If any specified side effect had already been declared,
3335+
it is not added again and is not included in the returned list.
33343336
</para>
33353337
</summary>
33363338
</scons_function>

0 commit comments

Comments
 (0)