summaryrefslogtreecommitdiffstats
path: root/doc/user/add-method.xml
diff options
context:
space:
mode:
authorTom Tanner <ttanner2@bloomberg.net>2013-10-30 12:33:19 (GMT)
committerTom Tanner <ttanner2@bloomberg.net>2013-10-30 12:33:19 (GMT)
commit7fdab2a7cae767172f4dcea67c3ab4d1a37926e2 (patch)
tree005ece6f3e371cee63e68bf070447c245592d6ed /doc/user/add-method.xml
parent91020237d64f53b2fa6e2b5bf155a1d8bfbdb547 (diff)
parente38f59cab5d40f09f15c5e65645aa2d8af165c66 (diff)
downloadSCons-7fdab2a7cae767172f4dcea67c3ab4d1a37926e2.zip
SCons-7fdab2a7cae767172f4dcea67c3ab4d1a37926e2.tar.gz
SCons-7fdab2a7cae767172f4dcea67c3ab4d1a37926e2.tar.bz2
Merged scons/scons into default
Diffstat (limited to 'doc/user/add-method.xml')
-rw-r--r--doc/user/add-method.xml54
1 files changed, 27 insertions, 27 deletions
diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml
index a9a89d3..c50786c 100644
--- a/doc/user/add-method.xml
+++ b/doc/user/add-method.xml
@@ -63,17 +63,17 @@
<scons_example name="addmethod_ex1">
<file name="SConstruct" printme="1">
- def install_in_bin_dirs(env, source):
- """Install source in both bin dirs"""
- i1 = env.Install("$BIN", source)
- i2 = env.Install("$LOCALBIN", source)
- return [i1[0], i2[0]] # Return a list, like a normal builder
- env = Environment(BIN='__ROOT__/usr/bin', LOCALBIN='#install/bin')
- env.AddMethod(install_in_bin_dirs, "InstallInBinDirs")
- env.InstallInBinDirs(Program('hello.c')) # installs hello in both bin dirs
+def install_in_bin_dirs(env, source):
+ """Install source in both bin dirs"""
+ i1 = env.Install("$BIN", source)
+ i2 = env.Install("$LOCALBIN", source)
+ return [i1[0], i2[0]] # Return a list, like a normal builder
+env = Environment(BIN='__ROOT__/usr/bin', LOCALBIN='#install/bin')
+env.AddMethod(install_in_bin_dirs, "InstallInBinDirs")
+env.InstallInBinDirs(Program('hello.c')) # installs hello in both bin dirs
</file>
<file name="hello.c">
- int main() { printf("Hello, world!\n"); }
+int main() { printf("Hello, world!\n"); }
</file>
</scons_example>
@@ -100,28 +100,28 @@
<scons_example name="addmethod_ex2">
<file name="SConstruct" printme="1">
- def BuildTestProg(env, testfile, resourcefile, testdir="tests"):
- """Build the test program;
- prepends "test_" to src and target,
- and puts target into testdir."""
- srcfile = "test_%s.c" % testfile
- target = "%s/test_%s" % (testdir, testfile)
- if env['PLATFORM'] == 'win32':
- resfile = env.RES(resourcefile)
- p = env.Program(target, [srcfile, resfile])
- else:
- p = env.Program(target, srcfile)
- return p
- AddMethod(Environment, BuildTestProg)
-
- env = Environment()
- env.BuildTestProg('stuff', resourcefile='res.rc')
+def BuildTestProg(env, testfile, resourcefile, testdir="tests"):
+ """Build the test program;
+ prepends "test_" to src and target,
+ and puts target into testdir."""
+ srcfile = "test_%s.c" % testfile
+ target = "%s/test_%s" % (testdir, testfile)
+ if env['PLATFORM'] == 'win32':
+ resfile = env.RES(resourcefile)
+ p = env.Program(target, [srcfile, resfile])
+ else:
+ p = env.Program(target, srcfile)
+ return p
+AddMethod(Environment, BuildTestProg)
+
+env = Environment()
+env.BuildTestProg('stuff', resourcefile='res.rc')
</file>
<file name="test_stuff.c">
- int main() { printf("Hello, world!\n"); }
+int main() { printf("Hello, world!\n"); }
</file>
<file name="res.rc">
- res.rc
+res.rc
</file>
</scons_example>