summaryrefslogtreecommitdiff
path: root/doc/user/command-line.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/command-line.xml')
-rw-r--r--doc/user/command-line.xml37
1 files changed, 19 insertions, 18 deletions
diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml
index 21c17c1..bb1d32b 100644
--- a/doc/user/command-line.xml
+++ b/doc/user/command-line.xml
@@ -22,7 +22,7 @@
<!--
- Copyright (c) 2001 - 2017 The SCons Foundation
+ Copyright (c) 2001 - 2019 The SCons Foundation
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -317,7 +317,7 @@ if not GetOption('help'):
import os
num_cpu = int(os.environ.get('NUM_CPU', 2))
SetOption('num_jobs', num_cpu)
-print("running with -j", GetOption('num_jobs'))
+print("running with -j %s"%GetOption('num_jobs'))
</file>
<file name="foo.in">
foo.in
@@ -1863,7 +1863,7 @@ env = Environment(variables = vars,
CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'})
unknown = vars.UnknownVariables()
if unknown:
- print("Unknown variables:", unknown.keys())
+ print("Unknown variables: %s"%unknown.keys())
Exit(1)
env.Program('foo.c')
</file>
@@ -1987,17 +1987,16 @@ foo.c
<para>
- One of the most basic things you can control
- is which targets &SCons; will build by default--that is,
+ You can control
+ which targets &SCons; will build by default - that is,
when there are no targets specified on the command line.
As mentioned previously,
&SCons; will normally build every target
- in or below the current directory
- by default--that is, when you don't
+ in or below the current directory unless you
explicitly specify one or more targets
on the command line.
Sometimes, however, you may want
- to specify explicitly that only
+ to specify that only
certain programs, or programs in certain directories,
should be built by default.
You do this with the &Default; function:
@@ -2193,16 +2192,16 @@ prog2.c
<para>
&SCons; supports a &DEFAULT_TARGETS; variable
- that lets you get at the current list of default targets.
+ that lets you get at the current list of default targets
+ specified by calls to the &Default; function or method.
The &DEFAULT_TARGETS; variable has
two important differences from the &COMMAND_LINE_TARGETS; variable.
First, the &DEFAULT_TARGETS; variable is a list of
internal &SCons; nodes,
so you need to convert the list elements to strings
if you want to print them or look for a specific target name.
- Fortunately, you can do this easily
- by using the Python <function>map</function> function
- to run the list through <function>str</function>:
+ You can do this easily by calling the <function>str</function>
+ on the elements in a list comprehension:
</para>
@@ -2210,7 +2209,7 @@ prog2.c
<file name="SConstruct" printme="1">
prog1 = Program('prog1.c')
Default(prog1)
-print("DEFAULT_TARGETS is", map(str, DEFAULT_TARGETS))
+print("DEFAULT_TARGETS is %s" % [str(t) for t in DEFAULT_TARGETS])
</file>
<file name="prog1.c">
prog1.c
@@ -2234,7 +2233,7 @@ prog1.c
<para>
Second,
- the contents of the &DEFAULT_TARGETS; list change
+ the contents of the &DEFAULT_TARGETS; list changes
in response to calls to the &Default; function,
as you can see from the following &SConstruct; file:
@@ -2244,10 +2243,10 @@ prog1.c
<file name="SConstruct" printme="1">
prog1 = Program('prog1.c')
Default(prog1)
-print("DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS))
+print("DEFAULT_TARGETS is now %s" % [str(t) for t in DEFAULT_TARGETS])
prog2 = Program('prog2.c')
Default(prog2)
-print("DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS))
+print("DEFAULT_TARGETS is now %s" % [str(t) for t in DEFAULT_TARGETS])
</file>
<file name="prog1.c">
prog1.c
@@ -2338,7 +2337,7 @@ else:
prog1 = Program('prog1.c')
Program('prog2.c')
Default(prog1)
-print("BUILD_TARGETS is", map(str, BUILD_TARGETS))
+print ("BUILD_TARGETS is %s" % [str(t) for t in BUILD_TARGETS])
</file>
<file name="prog1.c">
prog1.c
@@ -2352,7 +2351,9 @@ prog2.c
Notice how the value of &BUILD_TARGETS;
changes depending on whether a target is
- specified on the command line:
+ specified on the command line - &BUILD_TARGETS;
+ takes from &DEFAULT_TARGETS;
+ only if there are no &COMMAND_LINE_TARGETS;:
</para>