diff options
author | Dirk Baechle <dl9obn@darc.de> | 2013-10-06 16:48:36 (GMT) |
---|---|---|
committer | Dirk Baechle <dl9obn@darc.de> | 2013-10-06 16:48:36 (GMT) |
commit | a177bfae9c77a166aba93a8c0c4ab4cfc9012e71 (patch) | |
tree | 966f7b0c946e86bdb426f492d359997698b1d80b /doc/user/add-method.xml | |
parent | e2d8d87c5911067374d0b3b5be562c4ce2dddcce (diff) | |
download | SCons-a177bfae9c77a166aba93a8c0c4ab4cfc9012e71.zip SCons-a177bfae9c77a166aba93a8c0c4ab4cfc9012e71.tar.gz SCons-a177bfae9c77a166aba93a8c0c4ab4cfc9012e71.tar.bz2 |
- additional corrections for left alignment
Diffstat (limited to 'doc/user/add-method.xml')
-rw-r--r-- | doc/user/add-method.xml | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index e94626b..c50786c 100644 --- a/doc/user/add-method.xml +++ b/doc/user/add-method.xml @@ -100,28 +100,28 @@ int main() { printf("Hello, world!\n"); } <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> |