diff options
author | Dirk Baechle <dl9obn@darc.de> | 2013-10-06 15:04:19 (GMT) |
---|---|---|
committer | Dirk Baechle <dl9obn@darc.de> | 2013-10-06 15:04:19 (GMT) |
commit | e2d8d87c5911067374d0b3b5be562c4ce2dddcce (patch) | |
tree | 2ee5b8a387b880e61a23a7abda1a152fead7af00 /doc/user | |
parent | 43f296c7c2a350de0c59a442e566c165420803e3 (diff) | |
download | SCons-e2d8d87c5911067374d0b3b5be562c4ce2dddcce.zip SCons-e2d8d87c5911067374d0b3b5be562c4ce2dddcce.tar.gz SCons-e2d8d87c5911067374d0b3b5be562c4ce2dddcce.tar.bz2 |
- left-aligned all code examples in documentation
- accordingly updated the generated files, containing example output
Diffstat (limited to 'doc/user')
34 files changed, 1906 insertions, 1906 deletions
diff --git a/doc/user/actions.xml b/doc/user/actions.xml index 4b7c13a..eab9c10 100644 --- a/doc/user/actions.xml +++ b/doc/user/actions.xml @@ -267,7 +267,7 @@ solutions to the above limitations. </para> <sconstruct> - b = Builder(action = 'build < $SOURCE > $TARGET') +b = Builder(action = 'build < $SOURCE > $TARGET') </sconstruct> <para> @@ -277,7 +277,7 @@ solutions to the above limitations. </para> <sconstruct> - b = Builder(action = Action('build < $SOURCE > $TARGET')) +b = Builder(action = Action('build < $SOURCE > $TARGET')) </sconstruct> <para> diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index a9a89d3..e94626b 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> diff --git a/doc/user/alias.xml b/doc/user/alias.xml index dfaea5b..6325316 100644 --- a/doc/user/alias.xml +++ b/doc/user/alias.xml @@ -54,13 +54,13 @@ <scons_example name="alias_ex1"> <file name="SConstruct" printme="1"> - env = Environment() - hello = env.Program('hello.c') - env.Install('__ROOT__/usr/bin', hello) - env.Alias('install', '__ROOT__/usr/bin') +env = Environment() +hello = env.Program('hello.c') +env.Install('__ROOT__/usr/bin', hello) +env.Alias('install', '__ROOT__/usr/bin') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -90,20 +90,20 @@ <scons_example name="alias_ex2"> <file name="SConstruct" printme="1"> - env = Environment() - p = env.Program('foo.c') - l = env.Library('bar.c') - env.Install('__ROOT__/usr/bin', p) - env.Install('__ROOT__/usr/lib', l) - ib = env.Alias('install-bin', '__ROOT__/usr/bin') - il = env.Alias('install-lib', '__ROOT__/usr/lib') - env.Alias('install', [ib, il]) +env = Environment() +p = env.Program('foo.c') +l = env.Library('bar.c') +env.Install('__ROOT__/usr/bin', p) +env.Install('__ROOT__/usr/lib', l) +ib = env.Alias('install-bin', '__ROOT__/usr/bin') +il = env.Alias('install-lib', '__ROOT__/usr/lib') +env.Alias('install', [ib, il]) </file> <file name="foo.c"> - int main() { printf("foo.c\n"); } +int main() { printf("foo.c\n"); } </file> <file name="bar.c"> - void bar() { printf("bar.c\n"); } +void bar() { printf("bar.c\n"); } </file> </scons_example> diff --git a/doc/user/build-install.xml b/doc/user/build-install.xml index 62fe2c4..c6f8e6d 100644 --- a/doc/user/build-install.xml +++ b/doc/user/build-install.xml @@ -106,8 +106,8 @@ </para> <screen> - $ <userinput>python -V</userinput> - Python 2.5.1 +$ <userinput>python -V</userinput> +Python 2.5.1 </screen> <para> @@ -117,8 +117,8 @@ </para> <screen> - C:\><userinput>python -V</userinput> - Python 2.5.1 +C:\><userinput>python -V</userinput> +Python 2.5.1 </screen> <para> @@ -200,7 +200,7 @@ </para> <screen> - # <userinput>yum install scons</userinput> +# <userinput>yum install scons</userinput> </screen> <para> @@ -225,7 +225,7 @@ </para> <screen> - # <userinput>rpm -Uvh scons-&buildversion;-1.noarch.rpm</userinput> +# <userinput>rpm -Uvh scons-&buildversion;-1.noarch.rpm</userinput> </screen> <para> @@ -258,7 +258,7 @@ </para> <screen> - # <userinput>apt-get install scons</userinput> +# <userinput>apt-get install scons</userinput> </screen> <!-- @@ -273,7 +273,7 @@ </para> <screen> - # <userinput>db-XXX scons-*.deb</userinput> +# <userinput>db-XXX scons-*.deb</userinput> </screen> --> @@ -419,8 +419,8 @@ </para> <screen> - # <userinput>cd scons-&buildversion;</userinput> - # <userinput>python setup.py install</userinput> +# <userinput>cd scons-&buildversion;</userinput> +# <userinput>python setup.py install</userinput> </screen> <para> @@ -480,7 +480,7 @@ </para> <screen> - # <userinput>python setup.py install --version-lib</userinput> +# <userinput>python setup.py install --version-lib</userinput> </screen> <para> @@ -522,7 +522,7 @@ </para> <screen> - # <userinput>python setup.py install --prefix=/opt/scons</userinput> +# <userinput>python setup.py install --prefix=/opt/scons</userinput> </screen> <para> @@ -573,7 +573,7 @@ </para> <screen> - $ <userinput>python setup.py install --prefix=$HOME</userinput> +$ <userinput>python setup.py install --prefix=$HOME</userinput> </screen> <para> diff --git a/doc/user/builders-built-in.xml b/doc/user/builders-built-in.xml index 9c28020..2fcf313 100644 --- a/doc/user/builders-built-in.xml +++ b/doc/user/builders-built-in.xml @@ -77,7 +77,7 @@ </para> <programlisting> - Program('prog', 'file1.o') +Program('prog', 'file1.o') </programlisting> <para> @@ -102,8 +102,8 @@ </para> <programlisting> - env = Environment(PROGPREFIX='my', PROGSUFFIX='.xxx') - env.Program('prog', ['file1.o', 'file2.o']) +env = Environment(PROGPREFIX='my', PROGSUFFIX='.xxx') +env.Program('prog', ['file1.o', 'file2.o']) </programlisting> <para> @@ -126,7 +126,7 @@ </para> <programlisting> - Program(['hello.c', 'goodbye.c']) +Program(['hello.c', 'goodbye.c']) </programlisting> <para> @@ -154,15 +154,15 @@ <scons_example name="buildersbuiltin_libs"> <file name="SConstruct" printme="1"> - env = Environment(LIBS = ['foo1', 'foo2'], - LIBPATH = ['/usr/dir1', 'dir2']) - env.Program(['hello.c', 'goodbye.c']) +env = Environment(LIBS = ['foo1', 'foo2'], + LIBPATH = ['/usr/dir1', 'dir2']) +env.Program(['hello.c', 'goodbye.c']) </file> <file name="hello.c"> - int hello() { printf("Hello, world!\n"); } +int hello() { printf("Hello, world!\n"); } </file> <file name="goodbye.c"> - int goodbye() { printf("Goodbye, world!\n"); } +int goodbye() { printf("Goodbye, world!\n"); } </file> </scons_example> @@ -258,7 +258,7 @@ </para> <programlisting> - StaticObject('file', 'file.c') +StaticObject('file', 'file.c') </programlisting> <para> @@ -283,8 +283,8 @@ </para> <programlisting> - env = Environment(OBJPREFIX='my', OBJSUFFIX='.xxx') - env.StaticObject('file', 'file.c') +env = Environment(OBJPREFIX='my', OBJSUFFIX='.xxx') +env.StaticObject('file', 'file.c') </programlisting> <para> @@ -307,7 +307,7 @@ </para> <programlisting> - StaticObject('file.c') +StaticObject('file.c') </programlisting> <para> @@ -337,7 +337,7 @@ </para> <programlisting> - SharedObject('file', 'file.c') +SharedObject('file', 'file.c') </programlisting> <para> @@ -362,8 +362,8 @@ </para> <programlisting> - env = Environment(SHOBJPREFIX='my', SHOBJSUFFIX='.xxx') - env.SharedObject('file', 'file.c') +env = Environment(SHOBJPREFIX='my', SHOBJSUFFIX='.xxx') +env.SharedObject('file', 'file.c') </programlisting> <para> @@ -386,7 +386,7 @@ </para> <programlisting> - SharedObject('file.c') +SharedObject('file.c') </programlisting> <para> @@ -440,7 +440,7 @@ </para> <programlisting> - StaticLibrary('foo', ['file1.c', 'file2.c']) +StaticLibrary('foo', ['file1.c', 'file2.c']) </programlisting> <para> @@ -457,8 +457,8 @@ </para> <programlisting> - env = Environment(LIBPREFIX='my', LIBSUFFIX='.xxx') - env.StaticLibrary('lib', ['file1.o', 'file2.o']) +env = Environment(LIBPREFIX='my', LIBSUFFIX='.xxx') +env.StaticLibrary('lib', ['file1.o', 'file2.o']) </programlisting> <para> @@ -470,7 +470,7 @@ </para> <programlisting> - StaticLibrary('foo', ['file1.c', 'file2.c']) +StaticLibrary('foo', ['file1.c', 'file2.c']) </programlisting> <para> @@ -484,7 +484,7 @@ </para> <programlisting> - StaticLibrary(['file.c', 'another.c']) +StaticLibrary(['file.c', 'another.c']) </programlisting> <para> @@ -514,7 +514,7 @@ </para> <programlisting> - SharedLibrary('foo', ['file1.c', 'file2.c']) +SharedLibrary('foo', ['file1.c', 'file2.c']) </programlisting> <para> @@ -531,8 +531,8 @@ </para> <programlisting> - env = Environment(SHLIBPREFIX='my', SHLIBSUFFIX='.xxx') - env.SharedLibrary('shared', ['file1.o', 'file2.o']) +env = Environment(SHLIBPREFIX='my', SHLIBSUFFIX='.xxx') +env.SharedLibrary('shared', ['file1.o', 'file2.o']) </programlisting> <para> @@ -544,7 +544,7 @@ </para> <programlisting> - SharedLibrary('foo', ['file1.c', 'file2.c']) +SharedLibrary('foo', ['file1.c', 'file2.c']) </programlisting> <para> @@ -558,7 +558,7 @@ </para> <programlisting> - SharedLibrary(['file.c', 'another.c']) +SharedLibrary(['file.c', 'another.c']) </programlisting> <para> @@ -631,11 +631,11 @@ </para> <programlisting> - XXX CFile() programlisting +XXX CFile() programlisting </programlisting> <screen> - XXX CFile() screen +XXX CFile() screen </screen> </section> @@ -650,11 +650,11 @@ </para> <programlisting> - XXX CXXFILE() programlisting +XXX CXXFILE() programlisting </programlisting> <screen> - XXX CXXFILE() screen +XXX CXXFILE() screen </screen> </section> @@ -681,11 +681,11 @@ </para> <programlisting> - XXX DVI() programlisting +XXX DVI() programlisting </programlisting> <screen> - XXX DVI() screen +XXX DVI() screen </screen> </section> @@ -711,11 +711,11 @@ </para> <programlisting> - XXX PostScript() programlisting +XXX PostScript() programlisting </programlisting> <screen> - XXX PostScript() screen +XXX PostScript() screen </screen> </section> @@ -745,18 +745,18 @@ <scons_example name="buildersbuiltin_ex1"> <file name="SConstruct" printme="1"> - env = Environment() - env.Tar('out1.tar', ['file1', 'file2']) - env.Tar('out2', 'directory') +env = Environment() +env.Tar('out1.tar', ['file1', 'file2']) +env.Tar('out2', 'directory') </file> <file name="file1"> - file1 +file1 </file> <file name="file2"> - file2 +file2 </file> <file name="directory/file3"> - directory/file3 +directory/file3 </file> </scons_example> @@ -781,11 +781,11 @@ <scons_example name="buildersbuiltin_ex2"> <file name="SConstruct" printme="1"> - env = Environment(TARFLAGS = '-c -z') - env.Tar('out.tar.gz', 'directory') +env = Environment(TARFLAGS = '-c -z') +env.Tar('out.tar.gz', 'directory') </file> <file name="directory/file"> - directory/file +directory/file </file> </scons_example> @@ -805,12 +805,12 @@ <scons_example name="buildersbuiltin_ex3"> <file name="SConstruct" printme="1"> - env = Environment(TARFLAGS = '-c -z', - TARSUFFIX = '.tgz') - env.Tar('out', 'directory') +env = Environment(TARFLAGS = '-c -z', + TARSUFFIX = '.tgz') +env.Tar('out', 'directory') </file> <file name="directory/file"> - directory/file +directory/file </file> </scons_example> @@ -837,14 +837,14 @@ <scons_example name="buildersbuiltin_ex4"> <file name="SConstruct" printme="1"> - env = Environment() - env.Zip('out', ['file1', 'file2']) +env = Environment() +env.Zip('out', ['file1', 'file2']) </file> <file name="file1"> - file1 +file1 </file> <file name="file2"> - file2 +file2 </file> </scons_example> @@ -891,8 +891,8 @@ </para> <programlisting> - env = Environment() - env.Java(target = 'classes', source = 'src') +env = Environment() +env.Java(target = 'classes', source = 'src') </programlisting> <para> @@ -905,7 +905,7 @@ </para> <screen> - XXX Java() screen +XXX Java() screen </screen> </section> @@ -920,13 +920,13 @@ </para> <programlisting> - env = Environment() - env.Java(target = 'classes', source = 'src') - env.Jar(target = '', source = 'classes') +env = Environment() +env.Java(target = 'classes', source = 'src') +env.Jar(target = '', source = 'classes') </programlisting> <screen> - XXX Jar() screen +XXX Jar() screen </screen> </section> @@ -941,11 +941,11 @@ </para> <programlisting> - XXX JavaH() programlisting +XXX JavaH() programlisting </programlisting> <screen> - XXX JavaH() screen +XXX JavaH() screen </screen> </section> @@ -960,11 +960,11 @@ </para> <programlisting> - XXX RMIC() programlisting +XXX RMIC() programlisting </programlisting> <screen> - XXX RMIC() screen +XXX RMIC() screen </screen> </section> diff --git a/doc/user/builders-commands.xml b/doc/user/builders-commands.xml index 52e98c8..d496ef1 100644 --- a/doc/user/builders-commands.xml +++ b/doc/user/builders-commands.xml @@ -93,11 +93,11 @@ <scons_example name="builderscommands_ex1"> <file name="SConstruct" printme="1"> - env = Environment() - env.Command('foo.out', 'foo.in', "sed 's/x/y/' < $SOURCE > $TARGET") +env = Environment() +env.Command('foo.out', 'foo.in', "sed 's/x/y/' < $SOURCE > $TARGET") </file> <file name="foo.in"> - foo.in +foo.in </file> </scons_example> @@ -133,14 +133,14 @@ <scons_example name="builderscommands_ex2"> <file name="SConstruct" printme="1"> - env = Environment() - def build(target, source, env): - # Whatever it takes to build - return None - env.Command('foo.out', 'foo.in', build) +env = Environment() +def build(target, source, env): + # Whatever it takes to build + return None +env.Command('foo.out', 'foo.in', build) </file> <file name="foo.in"> - foo.in +foo.in </file> </scons_example> @@ -164,7 +164,7 @@ <scons_example name="builderscommands_ex3"> <file name="SConstruct" printme="1"> - env.Command('${SOURCE.basename}.out', 'foo.in', build) +env.Command('${SOURCE.basename}.out', 'foo.in', build) </file> </scons_example> diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml index 2dea8f7..383823a 100644 --- a/doc/user/builders-writing.xml +++ b/doc/user/builders-writing.xml @@ -151,7 +151,7 @@ This functionality could be invoked as in the following example: </para> <programlisting> - bld = Builder(action = 'foobuild < $SOURCE > $TARGET') +bld = Builder(action = 'foobuild < $SOURCE > $TARGET') </programlisting> <para> @@ -187,23 +187,23 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_ex1"> <file name="SConstruct"> - bld = Builder(action = 'foobuild < $SOURCE > $TARGET') - env = Environment(BUILDERS = {'Foo' : bld}) - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - env.Foo('file.foo', 'file.input') +bld = Builder(action = 'foobuild < $SOURCE > $TARGET') +env = Environment(BUILDERS = {'Foo' : bld}) +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +env.Foo('file.foo', 'file.input') </file> <file name="file.input"> - file.input +file.input </file> <file name="foobuild" chmod="0755"> - cat +cat </file> </scons_example> <sconstruct> - bld = Builder(action = 'foobuild < $SOURCE > $TARGET') - env = Environment(BUILDERS = {'Foo' : bld}) +bld = Builder(action = 'foobuild < $SOURCE > $TARGET') +env = Environment(BUILDERS = {'Foo' : bld}) </sconstruct> <para> @@ -215,7 +215,7 @@ This functionality could be invoked as in the following example: </para> <programlisting> - env.Foo('file.foo', 'file.input') +env.Foo('file.foo', 'file.input') </programlisting> <para> @@ -261,22 +261,22 @@ This functionality could be invoked as in the following example: --> <scons_example name="builderswriting_ex2"> <file name="SConstruct"> - import SCons.Defaults; SCons.Defaults.ConstructionEnvironment['TOOLS'] = {}; bld = Builder(action = 'foobuild < $SOURCE > $TARGET') - env = Environment(BUILDERS = {'Foo' : bld}) - env.Foo('file.foo', 'file.input') - env.Program('hello.c') +import SCons.Defaults; SCons.Defaults.ConstructionEnvironment['TOOLS'] = {}; bld = Builder(action = 'foobuild < $SOURCE > $TARGET') +env = Environment(BUILDERS = {'Foo' : bld}) +env.Foo('file.foo', 'file.input') +env.Program('hello.c') </file> <file name="SConstruct.printme" printme="1"> - bld = Builder(action = 'foobuild < $SOURCE > $TARGET') - env = Environment(BUILDERS = {'Foo' : bld}) - env.Foo('file.foo', 'file.input') - env.Program('hello.c') +bld = Builder(action = 'foobuild < $SOURCE > $TARGET') +env = Environment(BUILDERS = {'Foo' : bld}) +env.Foo('file.foo', 'file.input') +env.Program('hello.c') </file> <file name="file.input"> - file.input +file.input </file> <file name="hello.c"> - hello.c +hello.c </file> </scons_example> @@ -295,31 +295,31 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_ex3"> <file name="SConstruct"> - env = Environment() - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - bld = Builder(action = 'foobuild < $SOURCE > $TARGET') - env.Append(BUILDERS = {'Foo' : bld}) - env.Foo('file.foo', 'file.input') - env.Program('hello.c') +env = Environment() +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +bld = Builder(action = 'foobuild < $SOURCE > $TARGET') +env.Append(BUILDERS = {'Foo' : bld}) +env.Foo('file.foo', 'file.input') +env.Program('hello.c') </file> <file name="file.input"> - file.input +file.input </file> <file name="hello.c"> - hello.c +hello.c </file> <file name="foobuild" chmod="0755"> - cat +cat </file> </scons_example> <sconstruct> - env = Environment() - bld = Builder(action = 'foobuild < $SOURCE > $TARGET') - env.Append(BUILDERS = {'Foo' : bld}) - env.Foo('file.foo', 'file.input') - env.Program('hello.c') +env = Environment() +bld = Builder(action = 'foobuild < $SOURCE > $TARGET') +env.Append(BUILDERS = {'Foo' : bld}) +env.Foo('file.foo', 'file.input') +env.Program('hello.c') </sconstruct> <para> @@ -330,11 +330,11 @@ This functionality could be invoked as in the following example: </para> <sconstruct> - env = Environment() - bld = Builder(action = 'foobuild < $SOURCE > $TARGET') - env['BUILDERS']['Foo'] = bld - env.Foo('file.foo', 'file.input') - env.Program('hello.c') +env = Environment() +bld = Builder(action = 'foobuild < $SOURCE > $TARGET') +env['BUILDERS']['Foo'] = bld +env.Foo('file.foo', 'file.input') +env.Program('hello.c') </sconstruct> <para> @@ -374,33 +374,33 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_ex4"> <file name="SConstruct"> - bld = Builder(action = 'foobuild < $SOURCE > $TARGET', - suffix = '.foo', - src_suffix = '.input') - env = Environment(BUILDERS = {'Foo' : bld}) - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - env.Foo('file1') - env.Foo('file2') +bld = Builder(action = 'foobuild < $SOURCE > $TARGET', + suffix = '.foo', + src_suffix = '.input') +env = Environment(BUILDERS = {'Foo' : bld}) +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +env.Foo('file1') +env.Foo('file2') </file> <file name="file1.input"> - file1.input +file1.input </file> <file name="file2.input"> - file2.input +file2.input </file> <file name="foobuild" chmod="0755"> - cat +cat </file> </scons_example> <sconstruct> - bld = Builder(action = 'foobuild < $SOURCE > $TARGET', - suffix = '.foo', - src_suffix = '.input') - env = Environment(BUILDERS = {'Foo' : bld}) - env.Foo('file1') - env.Foo('file2') +bld = Builder(action = 'foobuild < $SOURCE > $TARGET', + suffix = '.foo', + src_suffix = '.input') +env = Environment(BUILDERS = {'Foo' : bld}) +env.Foo('file1') +env.Foo('file2') </sconstruct> <scons_output example="builderswriting_ex4" suffix="1"> @@ -432,9 +432,9 @@ This functionality could be invoked as in the following example: </para> <programlisting> - def build_function(target, source, env): - # Code to build "target" from "source" - return None +def build_function(target, source, env): + # Code to build "target" from "source" + return None </programlisting> <para> @@ -521,17 +521,17 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_ex5"> <file name="SConstruct" printme="1"> - def build_function(target, source, env): - # Code to build "target" from "source" - return None - bld = Builder(action = build_function, - suffix = '.foo', - src_suffix = '.input') - env = Environment(BUILDERS = {'Foo' : bld}) - env.Foo('file') +def build_function(target, source, env): + # Code to build "target" from "source" + return None +bld = Builder(action = build_function, + suffix = '.foo', + src_suffix = '.input') +env = Environment(BUILDERS = {'Foo' : bld}) +env.Foo('file') </file> <file name="file.input"> - file.input +file.input </file> </scons_example> @@ -565,8 +565,8 @@ This functionality could be invoked as in the following example: </para> <programlisting> - def generate_actions(source, target, env, for_signature): - return 'foobuild < %s > %s' % (target[0], source[0]) +def generate_actions(source, target, env, for_signature): + return 'foobuild < %s > %s' % (target[0], source[0]) </programlisting> <para> @@ -668,32 +668,32 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_ex6"> <file name="SConstruct"> - def generate_actions(source, target, env, for_signature): - return 'foobuild < %s > %s' % (source[0], target[0]) - bld = Builder(generator = generate_actions, - suffix = '.foo', - src_suffix = '.input') - env = Environment(BUILDERS = {'Foo' : bld}) - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - env.Foo('file') +def generate_actions(source, target, env, for_signature): + return 'foobuild < %s > %s' % (source[0], target[0]) +bld = Builder(generator = generate_actions, + suffix = '.foo', + src_suffix = '.input') +env = Environment(BUILDERS = {'Foo' : bld}) +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +env.Foo('file') </file> <file name="file.input"> - file.input +file.input </file> <file name="foobuild" chmod="0755"> - cat +cat </file> </scons_example> <sconstruct> - def generate_actions(source, target, env, for_signature): - return 'foobuild < %s > %s' % (source[0], target[0]) - bld = Builder(generator = generate_actions, - suffix = '.foo', - src_suffix = '.input') - env = Environment(BUILDERS = {'Foo' : bld}) - env.Foo('file') +def generate_actions(source, target, env, for_signature): + return 'foobuild < %s > %s' % (source[0], target[0]) +bld = Builder(generator = generate_actions, + suffix = '.foo', + src_suffix = '.input') +env = Environment(BUILDERS = {'Foo' : bld}) +env.Foo('file') </sconstruct> <scons_output example="builderswriting_ex6" suffix="1"> @@ -746,41 +746,41 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_ex7"> <file name="SConstruct"> - def modify_targets(target, source, env): - target.append('new_target') - source.append('new_source') - return target, source - bld = Builder(action = 'foobuild $TARGETS - $SOURCES', - suffix = '.foo', - src_suffix = '.input', - emitter = modify_targets) - env = Environment(BUILDERS = {'Foo' : bld}) - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - env.Foo('file') +def modify_targets(target, source, env): + target.append('new_target') + source.append('new_source') + return target, source +bld = Builder(action = 'foobuild $TARGETS - $SOURCES', + suffix = '.foo', + src_suffix = '.input', + emitter = modify_targets) +env = Environment(BUILDERS = {'Foo' : bld}) +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +env.Foo('file') </file> <file name="file.input"> - file.input +file.input </file> <file name="new_source"> - new_source +new_source </file> <file name="foobuild" chmod="0755"> - cat +cat </file> </scons_example> <sconstruct> - def modify_targets(target, source, env): - target.append('new_target') - source.append('new_source') - return target, source - bld = Builder(action = 'foobuild $TARGETS - $SOURCES', - suffix = '.foo', - src_suffix = '.input', - emitter = modify_targets) - env = Environment(BUILDERS = {'Foo' : bld}) - env.Foo('file') +def modify_targets(target, source, env): + target.append('new_target') + source.append('new_source') + return target, source +bld = Builder(action = 'foobuild $TARGETS - $SOURCES', + suffix = '.foo', + src_suffix = '.input', + emitter = modify_targets) +env = Environment(BUILDERS = {'Foo' : bld}) +env.Foo('file') </sconstruct> <para> @@ -849,20 +849,20 @@ This functionality could be invoked as in the following example: </scons_example> <sconstruct> - bld = Builder(action = 'my_command $SOURCES > $TARGET', - suffix = '.foo', - src_suffix = '.input', - emitter = '$MY_EMITTER') - def modify1(target, source, env): - return target, source + ['modify1.in'] - def modify2(target, source, env): - return target, source + ['modify2.in'] - env1 = Environment(BUILDERS = {'Foo' : bld}, - MY_EMITTER = modify1) - env2 = Environment(BUILDERS = {'Foo' : bld}, - MY_EMITTER = modify2) - env1.Foo('file1') - env2.Foo('file2') +bld = Builder(action = 'my_command $SOURCES > $TARGET', + suffix = '.foo', + src_suffix = '.input', + emitter = '$MY_EMITTER') +def modify1(target, source, env): + return target, source + ['modify1.in'] +def modify2(target, source, env): + return target, source + ['modify2.in'] +env1 = Environment(BUILDERS = {'Foo' : bld}, + MY_EMITTER = modify1) +env2 = Environment(BUILDERS = {'Foo' : bld}, + MY_EMITTER = modify2) +env1.Foo('file1') +env2.Foo('file2') </sconstruct> <para> @@ -962,19 +962,19 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_site1"> <file name="site_scons/site_init.py" printme="1"> - def TOOL_ADD_HEADER(env): - """A Tool to add a header from $HEADER to the source file""" - add_header = Builder(action=['echo "$HEADER" > $TARGET', - 'cat $SOURCE >> $TARGET']) - env.Append(BUILDERS = {'AddHeader' : add_header}) - env['HEADER'] = '' # set default value +def TOOL_ADD_HEADER(env): + """A Tool to add a header from $HEADER to the source file""" + add_header = Builder(action=['echo "$HEADER" > $TARGET', + 'cat $SOURCE >> $TARGET']) + env.Append(BUILDERS = {'AddHeader' : add_header}) + env['HEADER'] = '' # set default value </file> <file name="SConstruct"> - env=Environment(tools=['default', TOOL_ADD_HEADER], HEADER="=====") - env.AddHeader('tgt', 'src') +env=Environment(tools=['default', TOOL_ADD_HEADER], HEADER="=====") +env.AddHeader('tgt', 'src') </file> <file name="src"> - hi there +hi there </file> </scons_example> @@ -985,9 +985,9 @@ This functionality could be invoked as in the following example: </para> <sconstruct> - # Use TOOL_ADD_HEADER from site_scons/site_init.py - env=Environment(tools=['default', TOOL_ADD_HEADER], HEADER="=====") - env.AddHeader('tgt', 'src') +# Use TOOL_ADD_HEADER from site_scons/site_init.py +env=Environment(tools=['default', TOOL_ADD_HEADER], HEADER="=====") +env.AddHeader('tgt', 'src') </sconstruct> <para> @@ -1036,18 +1036,18 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_site2"> <file name="site_scons/my_utils.py" printme="1"> - from SCons.Script import * # for Execute and Mkdir - def build_id(): - """Return a build ID (stub version)""" - return "100" - def MakeWorkDir(workdir): - """Create the specified dir immediately""" - Execute(Mkdir(workdir)) +from SCons.Script import * # for Execute and Mkdir +def build_id(): + """Return a build ID (stub version)""" + return "100" +def MakeWorkDir(workdir): + """Create the specified dir immediately""" + Execute(Mkdir(workdir)) </file> <file name="SConscript"> - import my_utils - MakeWorkDir('/tmp/work') - print "build_id=" + my_utils.build_id() +import my_utils +MakeWorkDir('/tmp/work') +print "build_id=" + my_utils.build_id() </file> </scons_example> @@ -1059,9 +1059,9 @@ This functionality could be invoked as in the following example: </para> <sconstruct> - import my_utils - print "build_id=" + my_utils.build_id() - my_utils.MakeWorkDir('/tmp/work') +import my_utils +print "build_id=" + my_utils.build_id() +my_utils.MakeWorkDir('/tmp/work') </sconstruct> <para> @@ -1074,7 +1074,7 @@ This functionality could be invoked as in the following example: than a &SConstruct; or &SConscript; you always need to do </para> <sconstruct> - from SCons.Script import * +from SCons.Script import * </sconstruct> <para> @@ -1112,12 +1112,12 @@ This functionality could be invoked as in the following example: <scons_example name="builderswriting_ex8"> <file name="SConstruct" printme="1"> - env = Environment() - #env.SourceCode('.', env.BitKeeper('my_command')) - env.Program('hello.c') +env = Environment() +#env.SourceCode('.', env.BitKeeper('my_command')) +env.Program('hello.c') </file> <file name="hello.c"> - hello.c +hello.c </file> </scons_example> diff --git a/doc/user/caching.xml b/doc/user/caching.xml index 4e6dcf5..f728653 100644 --- a/doc/user/caching.xml +++ b/doc/user/caching.xml @@ -67,17 +67,17 @@ <scons_example name="caching_ex1"> <file name="SConstruct"> - env = Environment() - env.Program('hello.c') - CacheDir('cache') +env = Environment() +env.Program('hello.c') +CacheDir('cache') </file> <file name="hello.c"> - hello.c +hello.c </file> <directory name="cache"> </directory> <file name="not_used" printme="1"> - CacheDir('/usr/local/build_cache') +CacheDir('/usr/local/build_cache') </file> </scons_example> @@ -205,14 +205,14 @@ <scons_example name="ex-NoCache"> <file name="SConstruct" printme="1"> - env = Environment() - obj = env.Object('hello.c') - env.Program('hello.c') - CacheDir('cache') - NoCache('hello.o') +env = Environment() +obj = env.Object('hello.c') +env.Program('hello.c') +CacheDir('cache') +NoCache('hello.o') </file> <file name="hello.c"> - hello.c +hello.c </file> <directory name="cache"> </directory> @@ -241,15 +241,15 @@ --> <screen> - % <userinput>scons -Q</userinput> - cc -o hello.o -c hello.c - cc -o hello hello.o - % <userinput>scons -Q -c</userinput> - Removed hello.o - Removed hello - % <userinput>scons -Q</userinput> - cc -o hello.o -c hello.c - Retrieved `hello' from cache +% <userinput>scons -Q</userinput> +cc -o hello.o -c hello.c +cc -o hello hello.o +% <userinput>scons -Q -c</userinput> +Removed hello.o +Removed hello +% <userinput>scons -Q</userinput> +cc -o hello.o -c hello.c +Retrieved `hello' from cache </screen> </section> @@ -367,8 +367,8 @@ <scons_example name="caching_ex-random"> <file name="SConstruct" printme="1"> - Program('prog', - ['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c']) +Program('prog', + ['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c']) </file> <file name="f1.c">f1.c</file> <file name="f2.c">f2.c</file> @@ -479,9 +479,9 @@ <scons_example name="caching_ex-random"> <file name="SConstruct" printme="1"> - SetOption('random', 1) - Program('prog', - ['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c']) +SetOption('random', 1) +Program('prog', + ['f1.c', 'f2.c', 'f3.c', 'f4.c', 'f5.c']) </file> <file name="f1.c">f1.c</file> <file name="f2.c">f2.c</file> diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index a167eca..d2e4146 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -170,16 +170,16 @@ <scons_example name="commandline_SCONSFLAGS"> <file name="SConstruct"> - def b(target, source, env): - pass - def s(target, source, env): - return " ... [build output] ..." - a = Action(b, strfunction = s) - env = Environment(BUILDERS = {'A' : Builder(action=a)}) - env.A('foo.out', 'foo.in') +def b(target, source, env): + pass +def s(target, source, env): + return " ... [build output] ..." +a = Action(b, strfunction = s) +env = Environment(BUILDERS = {'A' : Builder(action=a)}) +env.A('foo.out', 'foo.in') </file> <file name="foo.in"> - foo.in +foo.in </file> </scons_example> @@ -197,7 +197,7 @@ </para> <screen> - $ <userinput>setenv SCONSFLAGS "-Q"</userinput> +$ <userinput>setenv SCONSFLAGS "-Q"</userinput> </screen> <para> @@ -244,8 +244,8 @@ </para> <sconstruct> - if not GetOption('help'): - SConscript('src/SConscript', export='env') +if not GetOption('help'): + SConscript('src/SConscript', export='env') </sconstruct> <para> @@ -314,13 +314,13 @@ <scons_example name="commandline_SetOption"> <file name="SConstruct" printme="1"> - import os - num_cpu = int(os.environ.get('NUM_CPU', 2)) - SetOption('num_jobs', num_cpu) - print "running with -j", GetOption('num_jobs') +import os +num_cpu = int(os.environ.get('NUM_CPU', 2)) +SetOption('num_jobs', num_cpu) +print "running with -j", GetOption('num_jobs') </file> <file name="foo.in"> - foo.in +foo.in </file> </scons_example> @@ -699,7 +699,7 @@ </para> <screen> - % <userinput>scons -Q debug=1</userinput> +% <userinput>scons -Q debug=1</userinput> </screen> <para> @@ -733,14 +733,14 @@ <scons_example name="commandline_ARGUMENTS"> <file name="SConstruct" printme="1"> - env = Environment() - debug = ARGUMENTS.get('debug', 0) - if int(debug): - env.Append(CCFLAGS = '-g') - env.Program('prog.c') +env = Environment() +debug = ARGUMENTS.get('debug', 0) +if int(debug): + env.Append(CCFLAGS = '-g') +env.Program('prog.c') </file> <file name="prog.c"> - prog.c +prog.c </file> </scons_example> @@ -822,15 +822,15 @@ <scons_example name="commandline_ARGLIST"> <file name="SConstruct" printme="1"> - cppdefines = [] - for key, value in ARGLIST: - if key == 'define': - cppdefines.append(value) - env = Environment(CPPDEFINES = cppdefines) - env.Object('prog.c') +cppdefines = [] +for key, value in ARGLIST: + if key == 'define': + cppdefines.append(value) +env = Environment(CPPDEFINES = cppdefines) +env.Object('prog.c') </file> <file name="prog.c"> - prog.c +prog.c </file> </scons_example> @@ -907,17 +907,17 @@ <scons_example name="commandline_Variables1"> <file name="SConstruct" printme="1"> - vars = Variables(None, ARGUMENTS) - vars.Add('RELEASE', 'Set to 1 to build for release', 0) - env = Environment(variables = vars, - CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) - env.Program(['foo.c', 'bar.c']) +vars = Variables(None, ARGUMENTS) +vars.Add('RELEASE', 'Set to 1 to build for release', 0) +env = Environment(variables = vars, + CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) +env.Program(['foo.c', 'bar.c']) </file> <file name="foo.c"> - foo.c +foo.c </file> <file name="bar.c"> - bar.c +bar.c </file> </scons_example> @@ -998,10 +998,10 @@ <scons_example name="commandline_Variables_Help"> <file name="SConstruct" printme="1"> - vars = Variables(None, ARGUMENTS) - vars.Add('RELEASE', 'Set to 1 to build for release', 0) - env = Environment(variables = vars) - Help(vars.GenerateHelpText(env)) +vars = Variables(None, ARGUMENTS) +vars.Add('RELEASE', 'Set to 1 to build for release', 0) +env = Environment(variables = vars) +Help(vars.GenerateHelpText(env)) </file> </scons_example> @@ -1045,21 +1045,21 @@ <scons_example name="commandline_Variables_custom_py_1"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add('RELEASE', 'Set to 1 to build for release', 0) - env = Environment(variables = vars, - CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) - env.Program(['foo.c', 'bar.c']) - Help(vars.GenerateHelpText(env)) +vars = Variables('custom.py') +vars.Add('RELEASE', 'Set to 1 to build for release', 0) +env = Environment(variables = vars, + CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) +env.Program(['foo.c', 'bar.c']) +Help(vars.GenerateHelpText(env)) </file> <file name="foo.c"> - foo.c +foo.c </file> <file name="bar.c"> - bar.c +bar.c </file> <file name="custom.py"> - RELEASE = 1 +RELEASE = 1 </file> </scons_example> @@ -1128,7 +1128,7 @@ </para> <screen> - vars = Variables('custom.py', ARGUMENTS) +vars = Variables('custom.py', ARGUMENTS) </screen> <para> @@ -1182,14 +1182,14 @@ <scons_example name="commandline_BoolVariable"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(BoolVariable('RELEASE', 'Set to build for release', 0)) - env = Environment(variables = vars, - CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(BoolVariable('RELEASE', 'Set to build for release', 0)) +env = Environment(variables = vars, + CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -1286,15 +1286,15 @@ <scons_example name="commandline_EnumVariable"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(EnumVariable('COLOR', 'Set background color', 'red', - allowed_values=('red', 'green', 'blue'))) - env = Environment(variables = vars, - CPPDEFINES={'COLOR' : '"${COLOR}"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(EnumVariable('COLOR', 'Set background color', 'red', + allowed_values=('red', 'green', 'blue'))) +env = Environment(variables = vars, + CPPDEFINES={'COLOR' : '"${COLOR}"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -1340,16 +1340,16 @@ <scons_example name="EnumVariable_map"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(EnumVariable('COLOR', 'Set background color', 'red', - allowed_values=('red', 'green', 'blue'), - map={'navy':'blue'})) - env = Environment(variables = vars, - CPPDEFINES={'COLOR' : '"${COLOR}"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(EnumVariable('COLOR', 'Set background color', 'red', + allowed_values=('red', 'green', 'blue'), + map={'navy':'blue'})) +env = Environment(variables = vars, + CPPDEFINES={'COLOR' : '"${COLOR}"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -1395,17 +1395,17 @@ <scons_example name="commandline_EnumVariable_ic1"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(EnumVariable('COLOR', 'Set background color', 'red', - allowed_values=('red', 'green', 'blue'), - map={'navy':'blue'}, - ignorecase=1)) - env = Environment(variables = vars, - CPPDEFINES={'COLOR' : '"${COLOR}"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(EnumVariable('COLOR', 'Set background color', 'red', + allowed_values=('red', 'green', 'blue'), + map={'navy':'blue'}, + ignorecase=1)) +env = Environment(variables = vars, + CPPDEFINES={'COLOR' : '"${COLOR}"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -1435,17 +1435,17 @@ <scons_example name="commandline_EnumVariable_ic2"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(EnumVariable('COLOR', 'Set background color', 'red', - allowed_values=('red', 'green', 'blue'), - map={'navy':'blue'}, - ignorecase=2)) - env = Environment(variables = vars, - CPPDEFINES={'COLOR' : '"${COLOR}"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(EnumVariable('COLOR', 'Set background color', 'red', + allowed_values=('red', 'green', 'blue'), + map={'navy':'blue'}, + ignorecase=2)) +env = Environment(variables = vars, + CPPDEFINES={'COLOR' : '"${COLOR}"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -1484,15 +1484,15 @@ <scons_example name="commandline_ListVariable"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(ListVariable('COLORS', 'List of colors', 0, - ['red', 'green', 'blue'])) - env = Environment(variables = vars, - CPPDEFINES={'COLORS' : '"${COLORS}"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(ListVariable('COLORS', 'List of colors', 0, + ['red', 'green', 'blue'])) +env = Environment(variables = vars, + CPPDEFINES={'COLORS' : '"${COLORS}"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -1555,22 +1555,22 @@ <scons_example name="commandline_PathVariable"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(PathVariable('CONFIG', - 'Path to configuration file', - '__ROOT__/etc/my_config')) - env = Environment(variables = vars, - CPPDEFINES={'CONFIG_FILE' : '"$CONFIG"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(PathVariable('CONFIG', + 'Path to configuration file', + '__ROOT__/etc/my_config')) +env = Environment(variables = vars, + CPPDEFINES={'CONFIG_FILE' : '"$CONFIG"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> <file name="__ROOT__/etc/my_config"> - /opt/location +/opt/location </file> <file name="__ROOT__/usr/local/etc/other_config"> - /opt/location +/opt/location </file> </scons_example> @@ -1611,20 +1611,20 @@ <scons_example name="commandline_PathIsFile"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(PathVariable('CONFIG', - 'Path to configuration file', - '__ROOT__/etc/my_config', - PathVariable.PathIsFile)) - env = Environment(variables = vars, - CPPDEFINES={'CONFIG_FILE' : '"$CONFIG"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(PathVariable('CONFIG', + 'Path to configuration file', + '__ROOT__/etc/my_config', + PathVariable.PathIsFile)) +env = Environment(variables = vars, + CPPDEFINES={'CONFIG_FILE' : '"$CONFIG"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> <file name="__ROOT__/etc/my_config"> - /opt/location +/opt/location </file> </scons_example> @@ -1638,20 +1638,20 @@ <scons_example name="commandline_PathIsDir"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(PathVariable('DBDIR', - 'Path to database directory', - '__ROOT__/var/my_dbdir', - PathVariable.PathIsDir)) - env = Environment(variables = vars, - CPPDEFINES={'DBDIR' : '"$DBDIR"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(PathVariable('DBDIR', + 'Path to database directory', + '__ROOT__/var/my_dbdir', + PathVariable.PathIsDir)) +env = Environment(variables = vars, + CPPDEFINES={'DBDIR' : '"$DBDIR"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> <file name="__ROOT__/var/my_dbdir"> - /opt/location +/opt/location </file> </scons_example> @@ -1667,20 +1667,20 @@ <scons_example name="commandline_PathIsDirCreate"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(PathVariable('DBDIR', - 'Path to database directory', - '__ROOT__/var/my_dbdir', - PathVariable.PathIsDirCreate)) - env = Environment(variables = vars, - CPPDEFINES={'DBDIR' : '"$DBDIR"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(PathVariable('DBDIR', + 'Path to database directory', + '__ROOT__/var/my_dbdir', + PathVariable.PathIsDirCreate)) +env = Environment(variables = vars, + CPPDEFINES={'DBDIR' : '"$DBDIR"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> <file name="__ROOT__/var/my_dbdir"> - /opt/location +/opt/location </file> </scons_example> @@ -1695,17 +1695,17 @@ <scons_example name="commandline_PathAccept"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(PathVariable('OUTPUT', - 'Path to output file or directory', - None, - PathVariable.PathAccept)) - env = Environment(variables = vars, - CPPDEFINES={'OUTPUT' : '"$OUTPUT"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(PathVariable('OUTPUT', + 'Path to output file or directory', + None, + PathVariable.PathAccept)) +env = Environment(variables = vars, + CPPDEFINES={'OUTPUT' : '"$OUTPUT"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -1730,22 +1730,22 @@ <scons_example name="commandline_PackageVariable"> <file name="SConstruct" printme="1"> - vars = Variables('custom.py') - vars.Add(PackageVariable('PACKAGE', - 'Location package', - '__ROOT__/opt/location')) - env = Environment(variables = vars, - CPPDEFINES={'PACKAGE' : '"$PACKAGE"'}) - env.Program('foo.c') +vars = Variables('custom.py') +vars.Add(PackageVariable('PACKAGE', + 'Location package', + '__ROOT__/opt/location')) +env = Environment(variables = vars, + CPPDEFINES={'PACKAGE' : '"$PACKAGE"'}) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> <file name="__ROOT__/opt/location"> - /opt/location +/opt/location </file> <file name="__ROOT__/usr/local/location"> - /opt/location +/opt/location </file> </scons_example> @@ -1796,23 +1796,23 @@ <scons_example name="commandline_AddVariables_1"> <file name="SConstruct" printme="1"> - vars = Variables() - vars.AddVariables( - ('RELEASE', 'Set to 1 to build for release', 0), - ('CONFIG', 'Configuration file', '/etc/my_config'), - BoolVariable('warnings', 'compilation with -Wall and similiar', 1), - EnumVariable('debug', 'debug output and symbols', 'no', - allowed_values=('yes', 'no', 'full'), - map={}, ignorecase=0), # case sensitive - ListVariable('shared', - 'libraries to build as shared libraries', - 'all', - names = list_of_libs), - PackageVariable('x11', - 'use X11 installed here (yes = search some places)', - 'yes'), - PathVariable('qtdir', 'where the root of Qt is installed', qtdir), - ) +vars = Variables() +vars.AddVariables( + ('RELEASE', 'Set to 1 to build for release', 0), + ('CONFIG', 'Configuration file', '/etc/my_config'), + BoolVariable('warnings', 'compilation with -Wall and similiar', 1), + EnumVariable('debug', 'debug output and symbols', 'no', + allowed_values=('yes', 'no', 'full'), + map={}, ignorecase=0), # case sensitive + ListVariable('shared', + 'libraries to build as shared libraries', + 'all', + names = list_of_libs), + PackageVariable('x11', + 'use X11 installed here (yes = search some places)', + 'yes'), + PathVariable('qtdir', 'where the root of Qt is installed', qtdir), +) </file> </scons_example> @@ -1857,18 +1857,18 @@ <scons_example name="commandline_UnknownVariables"> <file name="SConstruct" printme="1"> - vars = Variables(None) - vars.Add('RELEASE', 'Set to 1 to build for release', 0) - env = Environment(variables = vars, - CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) - unknown = vars.UnknownVariables() - if unknown: - print "Unknown variables:", unknown.keys() - Exit(1) - env.Program('foo.c') +vars = Variables(None) +vars.Add('RELEASE', 'Set to 1 to build for release', 0) +env = Environment(variables = vars, + CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) +unknown = vars.UnknownVariables() +if unknown: + print "Unknown variables:", unknown.keys() + Exit(1) +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -1944,16 +1944,16 @@ <scons_example name="commandline_COMMAND_LINE_TARGETS"> <file name="SConstruct" printme="1"> - if 'bar' in COMMAND_LINE_TARGETS: - print "Don't forget to copy `bar' to the archive!" - Default(Program('foo.c')) - Program('bar.c') +if 'bar' in COMMAND_LINE_TARGETS: + print "Don't forget to copy `bar' to the archive!" +Default(Program('foo.c')) +Program('bar.c') </file> <file name="foo.c"> - foo.c +foo.c </file> <file name="bar.c"> - foo.c +foo.c </file> </scons_example> @@ -2006,16 +2006,16 @@ <scons_example name="commandline_Default1"> <file name="SConstruct" printme="1"> - env = Environment() - hello = env.Program('hello.c') - env.Program('goodbye.c') - Default(hello) +env = Environment() +hello = env.Program('hello.c') +env.Program('goodbye.c') +Default(hello) </file> <file name="hello.c"> - hello.c +hello.c </file> <file name="goodbye.c"> - goodbye.c +goodbye.c </file> </scons_example> @@ -2060,21 +2060,21 @@ <scons_example name="commandline_Default2"> <file name="SConstruct" printme="1"> - env = Environment() - prog1 = env.Program('prog1.c') - Default(prog1) - prog2 = env.Program('prog2.c') - prog3 = env.Program('prog3.c') - Default(prog3) +env = Environment() +prog1 = env.Program('prog1.c') +Default(prog1) +prog2 = env.Program('prog2.c') +prog3 = env.Program('prog3.c') +Default(prog3) </file> <file name="prog1.c"> - prog1.c +prog1.c </file> <file name="prog2.c"> - prog2.c +prog2.c </file> <file name="prog3.c"> - prog3.c +prog3.c </file> </scons_example> @@ -2086,11 +2086,11 @@ </para> <programlisting> - env = Environment() - prog1 = env.Program('prog1.c') - prog2 = env.Program('prog2.c') - prog3 = env.Program('prog3.c') - Default(prog1, prog3) +env = Environment() +prog1 = env.Program('prog1.c') +prog2 = env.Program('prog2.c') +prog3 = env.Program('prog3.c') +Default(prog1, prog3) </programlisting> <para> @@ -2118,24 +2118,24 @@ <scons_example name="commandline_Default3"> <file name="SConstruct" printme="1"> - env = Environment() - env.Program(['prog1/main.c', 'prog1/foo.c']) - env.Program(['prog2/main.c', 'prog2/bar.c']) - Default('prog1') +env = Environment() +env.Program(['prog1/main.c', 'prog1/foo.c']) +env.Program(['prog2/main.c', 'prog2/bar.c']) +Default('prog1') </file> <directory name="prog1"></directory> <directory name="prog2"></directory> <file name="prog1/main.c"> - int main() { printf("prog1/main.c\n"); } +int main() { printf("prog1/main.c\n"); } </file> <file name="prog1/foo.c"> - int foo() { printf("prog1/foo.c\n"); } +int foo() { printf("prog1/foo.c\n"); } </file> <file name="prog2/main.c"> - int main() { printf("prog2/main.c\n"); } +int main() { printf("prog2/main.c\n"); } </file> <file name="prog2/bar.c"> - int bar() { printf("prog2/bar.c\n"); } +int bar() { printf("prog2/bar.c\n"); } </file> </scons_example> @@ -2163,16 +2163,16 @@ <scons_example name="commandline_Default4"> <file name="SConstruct" printme="1"> - env = Environment() - prog1 = env.Program('prog1.c') - prog2 = env.Program('prog2.c') - Default(None) +env = Environment() +prog1 = env.Program('prog1.c') +prog2 = env.Program('prog2.c') +Default(None) </file> <file name="prog1.c"> - prog1.c +prog1.c </file> <file name="prog2.c"> - prog2.c +prog2.c </file> </scons_example> @@ -2208,12 +2208,12 @@ <scons_example name="commandline_DEFAULT_TARGETS_1"> <file name="SConstruct" printme="1"> - prog1 = Program('prog1.c') - Default(prog1) - print "DEFAULT_TARGETS is", map(str, DEFAULT_TARGETS) +prog1 = Program('prog1.c') +Default(prog1) +print "DEFAULT_TARGETS is", map(str, DEFAULT_TARGETS) </file> <file name="prog1.c"> - prog1.c +prog1.c </file> </scons_example> @@ -2242,18 +2242,18 @@ <scons_example name="commandline_DEFAULT_TARGETS_2"> <file name="SConstruct" printme="1"> - prog1 = Program('prog1.c') - Default(prog1) - print "DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS) - prog2 = Program('prog2.c') - Default(prog2) - print "DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS) +prog1 = Program('prog1.c') +Default(prog1) +print "DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS) +prog2 = Program('prog2.c') +Default(prog2) +print "DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS) </file> <file name="prog1.c"> - prog1.c +prog1.c </file> <file name="prog2.c"> - prog2.c +prog2.c </file> </scons_example> @@ -2304,10 +2304,10 @@ </para> <sconstruct> - if COMMAND_LINE_TARGETS: - targets = COMMAND_LINE_TARGETS - else: - targets = DEFAULT_TARGETS +if COMMAND_LINE_TARGETS: + targets = COMMAND_LINE_TARGETS +else: + targets = DEFAULT_TARGETS </sconstruct> <para> @@ -2335,16 +2335,16 @@ <scons_example name="commandline_BUILD_TARGETS_1"> <file name="SConstruct" printme="1"> - prog1 = Program('prog1.c') - Program('prog2.c') - Default(prog1) - print "BUILD_TARGETS is", map(str, BUILD_TARGETS) +prog1 = Program('prog1.c') +Program('prog2.c') +Default(prog1) +print "BUILD_TARGETS is", map(str, BUILD_TARGETS) </file> <file name="prog1.c"> - prog1.c +prog1.c </file> <file name="prog2.c"> - prog2.c +prog2.c </file> </scons_example> diff --git a/doc/user/depends.xml b/doc/user/depends.xml index d252544..2dd7ea6 100644 --- a/doc/user/depends.xml +++ b/doc/user/depends.xml @@ -60,10 +60,10 @@ <scons_example name="depends_ex1"> <file name="SConstruct"> - Program('hello.c') +Program('hello.c') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -173,8 +173,8 @@ </para> <sconstruct> - Program('hello.c') - Decider('MD5') +Program('hello.c') +Decider('MD5') </sconstruct> <para> @@ -270,11 +270,11 @@ <scons_example name="depends_newer"> <file name="SConstruct" printme="1"> - Object('hello.c') - Decider('timestamp-newer') +Object('hello.c') +Decider('timestamp-newer') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -303,8 +303,8 @@ </para> <sconstruct> - Object('hello.c') - Decider('make') +Object('hello.c') +Decider('make') </sconstruct> <para> @@ -339,11 +339,11 @@ <scons_example name="depends_match"> <file name="SConstruct" printme="1"> - Object('hello.c') - Decider('timestamp-match') +Object('hello.c') +Decider('timestamp-match') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -398,11 +398,11 @@ <scons_example name="depends_MD5-timestamp"> <file name="SConstruct" printme="1"> - Program('hello.c') - Decider('MD5-timestamp') +Program('hello.c') +Decider('MD5-timestamp') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -431,17 +431,17 @@ --> <screen> - % <userinput>scons -Q hello</userinput> - cc -o hello.o -c hello.c - cc -o hello hello.o - % <userinput>touch hello.c</userinput> - % <userinput>scons -Q hello</userinput> - scons: `hello' is up to date. - % <userinput>edit hello.c</userinput> - [CHANGE THE CONTENTS OF hello.c] - % <userinput>scons -Q hello</userinput> - cc -o hello.o -c hello.c - cc -o hello hello.o +% <userinput>scons -Q hello</userinput> +cc -o hello.o -c hello.c +cc -o hello hello.o +% <userinput>touch hello.c</userinput> +% <userinput>scons -Q hello</userinput> +scons: `hello' is up to date. +% <userinput>edit hello.c</userinput> + [CHANGE THE CONTENTS OF hello.c] +% <userinput>scons -Q hello</userinput> +cc -o hello.o -c hello.c +cc -o hello hello.o </screen> <para> @@ -516,18 +516,18 @@ <scons_example name="depends_function"> <file name="SConstruct" printme="1"> - Program('hello.c') - def decide_if_changed(dependency, target, prev_ni): - if self.get_timestamp() != prev_ni.timestamp: - dep = str(dependency) - tgt = str(target) - if specific_part_of_file_has_changed(dep, tgt): - return True - return False - Decider(decide_if_changed) +Program('hello.c') +def decide_if_changed(dependency, target, prev_ni): + if self.get_timestamp() != prev_ni.timestamp: + dep = str(dependency) + tgt = str(target) + if specific_part_of_file_has_changed(dep, tgt): + return True + return False +Decider(decide_if_changed) </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -635,35 +635,35 @@ </para> <sconstruct> - env = Environment() - - def config_file_decider(dependency, target, prev_ni): - import os.path - - # We always have to init the .csig value... - dep_csig = dependency.get_csig() - # .csig may not exist, because no target was built yet... - if 'csig' not in dir(prev_ni): - return True - # Target file may not exist yet - if not os.path.exists(str(target.abspath)): - return True - if dep_csig != prev_ni.csig: - # Some change on source file => update installed one - return True - return False - - def update_file(): - f = open("test.txt","a") - f.write("some line\n") - f.close() - - update_file() - - # Activate our own decider function - env.Decider(config_file_decider) - - env.Install("install","test.txt") +env = Environment() + +def config_file_decider(dependency, target, prev_ni): + import os.path + + # We always have to init the .csig value... + dep_csig = dependency.get_csig() + # .csig may not exist, because no target was built yet... + if 'csig' not in dir(prev_ni): + return True + # Target file may not exist yet + if not os.path.exists(str(target.abspath)): + return True + if dep_csig != prev_ni.csig: + # Some change on source file => update installed one + return True + return False + +def update_file(): + f = open("test.txt","a") + f.write("some line\n") + f.close() + +update_file() + +# Activate our own decider function +env.Decider(config_file_decider) + +env.Install("install","test.txt") </sconstruct> </section> @@ -698,22 +698,22 @@ <scons_example name="depends_mixing"> <file name="SConstruct" printme="1"> - env1 = Environment(CPPPATH = ['.']) - env2 = env1.Clone() - env2.Decider('timestamp-match') - env1.Program('prog-MD5', 'program1.c') - env2.Program('prog-timestamp', 'program2.c') +env1 = Environment(CPPPATH = ['.']) +env2 = env1.Clone() +env2.Decider('timestamp-match') +env1.Program('prog-MD5', 'program1.c') +env2.Program('prog-timestamp', 'program2.c') </file> <file name="program1.c"> - #include "inc.h" - int main() { printf("Hello, world!\n"); } +#include "inc.h" +int main() { printf("Hello, world!\n"); } </file> <file name="program2.c"> - #include "inc.h" - int main() { printf("Hello, world!\n"); } +#include "inc.h" +int main() { printf("Hello, world!\n"); } </file> <file name="inc.h"> - #define INC 1 +#define INC 1 </file> </scons_example> @@ -771,8 +771,8 @@ </para> <sconstruct> - Program('hello.c') - SourceSignatures('MD5') +Program('hello.c') +SourceSignatures('MD5') </sconstruct> <para> @@ -782,8 +782,8 @@ </para> <sconstruct> - Program('hello.c') - SourceSignatures('timestamp') +Program('hello.c') +SourceSignatures('timestamp') </sconstruct> <para> @@ -839,8 +839,8 @@ </para> <sconstruct> - Program('hello.c') - TargetSignatures('MD5') +Program('hello.c') +TargetSignatures('MD5') </sconstruct> <para> @@ -853,8 +853,8 @@ </para> <sconstruct> - Program('hello.c') - TargetSignatures('timestamp') +Program('hello.c') +TargetSignatures('timestamp') </sconstruct> <para> @@ -882,9 +882,9 @@ </para> <sconstruct> - Program('hello.c') - TargetSignatures('source') - SourceSignatures('timestamp') +Program('hello.c') +TargetSignatures('source') +SourceSignatures('timestamp') </sconstruct> <para> @@ -949,18 +949,18 @@ <scons_example name="depends_include"> <file name="SConstruct"> - Program('hello.c', CPPPATH = '.') +Program('hello.c', CPPPATH = '.') </file> <file name="hello.c" printme="1"> - #include <hello.h> - int - main() - { - printf("Hello, %s!\n", string); - } +#include <hello.h> +int +main() +{ + printf("Hello, %s!\n", string); +} </file> <file name="hello.h"> - #define string "world" +#define string "world" </file> </scons_example> @@ -1049,10 +1049,10 @@ <scons_example name="depends_ex5"> <file name="SConstruct" printme="1"> - Program('hello.c', CPPPATH = ['include', '/home/project/inc']) +Program('hello.c', CPPPATH = ['include', '/home/project/inc']) </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -1142,7 +1142,7 @@ </para> <sconstruct> - SetOption('implicit_cache', 1) +SetOption('implicit_cache', 1) </sconstruct> <para> @@ -1291,23 +1291,23 @@ </para> <programlisting> - hello = Program('hello.c') - Depends(hello, 'other_file') +hello = Program('hello.c') +Depends(hello, 'other_file') </programlisting> <!-- XXX mention that you can use arrays for target and source? --> <screen> - % <userinput>scons -Q hello</userinput> - cc -c hello.c -o hello.o - cc -o hello hello.o - % <userinput>scons -Q hello</userinput> - scons: `hello' is up to date. - % <userinput>edit other_file</userinput> - [CHANGE THE CONTENTS OF other_file] - % <userinput>scons -Q hello</userinput> - cc -c hello.c -o hello.o - cc -o hello hello.o +% <userinput>scons -Q hello</userinput> +cc -c hello.c -o hello.o +cc -o hello hello.o +% <userinput>scons -Q hello</userinput> +scons: `hello' is up to date. +% <userinput>edit other_file</userinput> + [CHANGE THE CONTENTS OF other_file] +% <userinput>scons -Q hello</userinput> +cc -c hello.c -o hello.o +cc -o hello hello.o </screen> <para> @@ -1320,9 +1320,9 @@ </para> <programlisting> - hello = Program('hello.c') - goodbye = Program('goodbye.c') - Depends(hello, goodbye) +hello = Program('hello.c') +goodbye = Program('goodbye.c') +Depends(hello, goodbye) </programlisting> <para> @@ -1333,11 +1333,11 @@ </para> <screen> - % <userinput>scons -Q hello</userinput> - cc -c goodbye.c -o goodbye.o - cc -o goodbye goodbye.o - cc -c hello.c -o hello.o - cc -o hello hello.o +% <userinput>scons -Q hello</userinput> +cc -c goodbye.c -o goodbye.o +cc -o goodbye goodbye.o +cc -c hello.c -o hello.o +cc -o hello hello.o </screen> </section> @@ -1480,14 +1480,14 @@ --> <screen> - % <userinput>scons -Q</userinput> - cc -o hello.o -c -MD -MF hello.d -I. hello.c - cc -o hello hello.o - % <userinput>scons -Q --debug=explain</userinput> - scons: rebuilding `hello.o' because `foo.h' is a new dependency - cc -o hello.o -c -MD -MF hello.d -I. hello.c - % <userinput>scons -Q</userinput> - scons: `.' is up to date. +% <userinput>scons -Q</userinput> +cc -o hello.o -c -MD -MF hello.d -I. hello.c +cc -o hello hello.o +% <userinput>scons -Q --debug=explain</userinput> +scons: rebuilding `hello.o' because `foo.h' is a new dependency +cc -o hello.o -c -MD -MF hello.d -I. hello.c +% <userinput>scons -Q</userinput> +scons: `.' is up to date. </screen> <para> @@ -1532,16 +1532,16 @@ <scons_example name="depends_ignore"> <file name="SConstruct" printme="1"> - hello_obj=Object('hello.c') - hello = Program(hello_obj) - Ignore(hello_obj, 'hello.h') +hello_obj=Object('hello.c') +hello = Program(hello_obj) +Ignore(hello_obj, 'hello.h') </file> <file name="hello.c"> - #include "hello.h" - int main() { printf("Hello, %s!\n", string); } +#include "hello.h" +int main() { printf("Hello, %s!\n", string); } </file> <file name="hello.h"> - #define string "world" +#define string "world" </file> </scons_example> @@ -1558,15 +1558,15 @@ --> <screen> - % <userinput>scons -Q hello</userinput> - cc -c -o hello.o hello.c - cc -o hello hello.o - % <userinput>scons -Q hello</userinput> - scons: `hello' is up to date. - % <userinput>edit hello.h</userinput> - [CHANGE THE CONTENTS OF hello.h] - % <userinput>scons -Q hello</userinput> - scons: `hello' is up to date. +% <userinput>scons -Q hello</userinput> +cc -c -o hello.o hello.c +cc -o hello hello.o +% <userinput>scons -Q hello</userinput> +scons: `hello' is up to date. +% <userinput>edit hello.h</userinput> + [CHANGE THE CONTENTS OF hello.h] +% <userinput>scons -Q hello</userinput> +scons: `hello' is up to date. </screen> <para> @@ -1591,8 +1591,8 @@ </para> <programlisting> - hello = Program('hello.c', CPPPATH=['/usr/include']) - Ignore(hello, '/usr/include/stdio.h') +hello = Program('hello.c', CPPPATH=['/usr/include']) +Ignore(hello, '/usr/include/stdio.h') </programlisting> <para> @@ -1608,13 +1608,13 @@ <scons_example name="depends_ignore_explicit"> <file name="SConstruct" printme="1"> - hello_obj=Object('hello.c') - hello = Program(hello_obj) - Ignore('.',[hello,hello_obj]) +hello_obj=Object('hello.c') +hello = Program(hello_obj) +Ignore('.',[hello,hello_obj]) </file> <file name="hello.c"> - #include "stdio.h" - int main() { printf("Hello!\n"); } +#include "stdio.h" +int main() { printf("Hello!\n"); } </file> </scons_example> @@ -1801,11 +1801,11 @@ <scons_example name="depends_AlwaysBuild"> <file name="SConstruct" printme="1"> - hello = Program('hello.c') - AlwaysBuild(hello) +hello = Program('hello.c') +AlwaysBuild(hello) </file> <file name="hello.c"> - int main() { printf("Hello, %s!\n", string); } +int main() { printf("Hello, %s!\n", string); } </file> </scons_example> diff --git a/doc/user/environments.xml b/doc/user/environments.xml index 0a4192f..f11a95b 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -490,10 +490,10 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_ex1"> <file name="SConstruct" printme="1"> - import os +import os </file> <file name="foo.c"> - int main() { } +int main() { } </file> </scons_example> @@ -546,7 +546,7 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env = Environment() +env = Environment() </sconstruct> <para> @@ -626,8 +626,8 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_ex6"> <file name="SConstruct" printme="1"> - env = Environment() - print "CC is:", env['CC'] +env = Environment() +print "CC is:", env['CC'] </file> </scons_example> @@ -655,10 +655,10 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_ex6b"> <file name="SConstruct" printme="1"> - env = Environment(FOO = 'foo', BAR = 'bar') - dict = env.Dictionary() - for key in ['OBJSUFFIX', 'LIBSUFFIX', 'PROGSUFFIX']: - print "key = %s, value = %s" % (key, dict[key]) +env = Environment(FOO = 'foo', BAR = 'bar') +dict = env.Dictionary() +for key in ['OBJSUFFIX', 'LIBSUFFIX', 'PROGSUFFIX']: + print "key = %s, value = %s" % (key, dict[key]) </file> </scons_example> @@ -693,9 +693,9 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env = Environment() - for item in sorted(env.Dictionary().items()): - print "construction variable = '%s', value = '%s'" % item +env = Environment() +for item in sorted(env.Dictionary().items()): + print "construction variable = '%s', value = '%s'" % item </sconstruct> </section> @@ -720,8 +720,8 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env = Environment() - print "CC is:", env.subst('$CC') +env = Environment() +print "CC is:", env.subst('$CC') </sconstruct> <para> @@ -737,8 +737,8 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env = Environment(CCFLAGS = '-DFOO') - print "CCCOM is:", env['CCCOM'] +env = Environment(CCFLAGS = '-DFOO') +print "CCCOM is:", env['CCCOM'] </sconstruct> <para> @@ -750,9 +750,9 @@ environment, of directory names, suffixes, etc. </para> <screen> - % <userinput>scons -Q</userinput> - CCCOM is: $CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES - scons: `.' is up to date. +% <userinput>scons -Q</userinput> +CCCOM is: $CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES +scons: `.' is up to date. </screen> <para> @@ -763,8 +763,8 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env = Environment(CCFLAGS = '-DFOO') - print "CCCOM is:", env.subst('$CCCOM') +env = Environment(CCFLAGS = '-DFOO') +print "CCCOM is:", env.subst('$CCCOM') </sconstruct> <para> @@ -777,9 +777,9 @@ environment, of directory names, suffixes, etc. </para> <screen> - % <userinput>scons -Q</userinput> - CCCOM is: gcc -DFOO -c -o - scons: `.' is up to date. +% <userinput>scons -Q</userinput> +CCCOM is: gcc -DFOO -c -o +scons: `.' is up to date. </screen> <para> @@ -805,8 +805,8 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_missing1"> <file name="SConstruct" printme="1"> - env = Environment() - print "value is:", env.subst( '->$MISSING<-' ) +env = Environment() +print "value is:", env.subst( '->$MISSING<-' ) </file> </scons_example> @@ -832,9 +832,9 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_missing2"> <file name="SConstruct" printme="1"> - AllowSubstExceptions() - env = Environment() - print "value is:", env.subst( '->$MISSING<-' ) +AllowSubstExceptions() +env = Environment() +print "value is:", env.subst( '->$MISSING<-' ) </file> </scons_example> @@ -852,9 +852,9 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_missing3"> <file name="SConstruct" printme="1"> - AllowSubstExceptions(IndexError, NameError, ZeroDivisionError) - env = Environment() - print "value is:", env.subst( '->${1 / 0}<-' ) +AllowSubstExceptions(IndexError, NameError, ZeroDivisionError) +env = Environment() +print "value is:", env.subst( '->${1 / 0}<-' ) </file> </scons_example> @@ -1190,12 +1190,12 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_Replace1"> <file name="SConstruct" printme="1"> - env = Environment(CCFLAGS = '-DDEFINE1') - env.Replace(CCFLAGS = '-DDEFINE2') - env.Program('foo.c') +env = Environment(CCFLAGS = '-DDEFINE1') +env.Replace(CCFLAGS = '-DDEFINE2') +env.Program('foo.c') </file> <file name="foo.c"> - int main() { } +int main() { } </file> </scons_example> @@ -1222,9 +1222,9 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_Replace-nonexistent"> <file name="SConstruct" printme="1"> - env = Environment() - env.Replace(NEW_VARIABLE = 'xyzzy') - print "NEW_VARIABLE =", env['NEW_VARIABLE'] +env = Environment() +env.Replace(NEW_VARIABLE = 'xyzzy') +print "NEW_VARIABLE =", env['NEW_VARIABLE'] </file> </scons_example> @@ -1321,7 +1321,7 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env.SetDefault(SPECIAL_FLAG = '-extra-option') +env.SetDefault(SPECIAL_FLAG = '-extra-option') </sconstruct> <para> @@ -1352,12 +1352,12 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_ex8"> <file name="SConstruct" printme="1"> - env = Environment(CCFLAGS = ['-DMY_VALUE']) - env.Append(CCFLAGS = ['-DLAST']) - env.Program('foo.c') +env = Environment(CCFLAGS = ['-DMY_VALUE']) +env.Append(CCFLAGS = ['-DLAST']) +env.Program('foo.c') </file> <file name="foo.c"> - int main() { } +int main() { } </file> </scons_example> @@ -1381,9 +1381,9 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_Append-nonexistent"> <file name="SConstruct" printme="1"> - env = Environment() - env.Append(NEW_VARIABLE = 'added') - print "NEW_VARIABLE =", env['NEW_VARIABLE'] +env = Environment() +env.Append(NEW_VARIABLE = 'added') +print "NEW_VARIABLE =", env['NEW_VARIABLE'] </file> </scons_example> @@ -1425,7 +1425,7 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env.AppendUnique(CCFLAGS=['-g']) +env.AppendUnique(CCFLAGS=['-g']) </sconstruct> <para> @@ -1452,12 +1452,12 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_ex9"> <file name="SConstruct" printme="1"> - env = Environment(CCFLAGS = ['-DMY_VALUE']) - env.Prepend(CCFLAGS = ['-DFIRST']) - env.Program('foo.c') +env = Environment(CCFLAGS = ['-DMY_VALUE']) +env.Prepend(CCFLAGS = ['-DFIRST']) +env.Program('foo.c') </file> <file name="foo.c"> - int main() { } +int main() { } </file> </scons_example> @@ -1481,9 +1481,9 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_Prepend-nonexistent"> <file name="SConstruct" printme="1"> - env = Environment() - env.Prepend(NEW_VARIABLE = 'added') - print "NEW_VARIABLE =", env['NEW_VARIABLE'] +env = Environment() +env.Prepend(NEW_VARIABLE = 'added') +print "NEW_VARIABLE =", env['NEW_VARIABLE'] </file> </scons_example> @@ -1527,7 +1527,7 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env.PrependUnique(CCFLAGS=['-g']) +env.PrependUnique(CCFLAGS=['-g']) </sconstruct> <para> @@ -1598,8 +1598,8 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - path = ['/usr/local/bin', '/bin', '/usr/bin'] - env = Environment(ENV = {'PATH' : path}) +path = ['/usr/local/bin', '/bin', '/usr/bin'] +env = Environment(ENV = {'PATH' : path}) </sconstruct> <para> @@ -1618,7 +1618,7 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env['ENV']['PATH'] = ['/usr/local/bin', '/bin', '/usr/bin'] +env['ENV']['PATH'] = ['/usr/local/bin', '/bin', '/usr/bin'] </sconstruct> <para> @@ -1631,7 +1631,7 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env['ENV']['PATH'] = '/usr/local/bin:/bin:/usr/bin' +env['ENV']['PATH'] = '/usr/local/bin:/bin:/usr/bin' </sconstruct> <para> @@ -1646,19 +1646,19 @@ environment, of directory names, suffixes, etc. <scons_example name="environments_ex1"> <file name="SConstruct" printme="1"> - env = Environment() - env.Command('foo', [], '__ROOT__/usr/bin/printenv.py') +env = Environment() +env.Command('foo', [], '__ROOT__/usr/bin/printenv.py') </file> <file name="__ROOT__/usr/bin/printenv.py" chmod="0755"> - #!/usr/bin/env python - import os - import sys - if len(sys.argv) > 1: - keys = sys.argv[1:] - else: - keys = sorted(os.environ.keys()) - for key in keys: - print " " + key + "=" + os.environ[key] +#!/usr/bin/env python +import os +import sys +if len(sys.argv) > 1: + keys = sys.argv[1:] +else: + keys = sorted(os.environ.keys()) +for key in keys: + print " " + key + "=" + os.environ[key] </file> </scons_example> @@ -1689,8 +1689,8 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - import os - env = Environment(ENV = {'PATH' : os.environ['PATH']}) +import os +env = Environment(ENV = {'PATH' : os.environ['PATH']}) </sconstruct> <para> @@ -1705,8 +1705,8 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - import os - env = Environment(ENV = os.environ) +import os +env = Environment(ENV = os.environ) </sconstruct> <para> @@ -1752,9 +1752,9 @@ environment, of directory names, suffixes, etc. </para> <sconstruct> - env = Environment(ENV = os.environ) - env.PrependENVPath('PATH', '/usr/local/bin') - env.AppendENVPath('LIB', '/usr/local/lib') +env = Environment(ENV = os.environ) +env.PrependENVPath('PATH', '/usr/local/bin') +env.AppendENVPath('LIB', '/usr/local/lib') </sconstruct> <para> diff --git a/doc/user/factories.xml b/doc/user/factories.xml index 15a962d..93283bb 100644 --- a/doc/user/factories.xml +++ b/doc/user/factories.xml @@ -84,7 +84,7 @@ <scons_example name="factories_Copy1"> <file name="SConstruct" printme="1"> - Command("file.out", "file.in", Copy("$TARGET", "$SOURCE")) +Command("file.out", "file.in", Copy("$TARGET", "$SOURCE")) </file> <file name="file.in">file.in</file> </scons_example> @@ -113,7 +113,7 @@ <scons_example name="factories_Copy2"> <file name="SConstruct" printme="1"> - Command("file.out", [], Copy("$TARGET", "file.in")) +Command("file.out", [], Copy("$TARGET", "file.in")) </file> <file name="file.in">file.in</file> </scons_example> @@ -147,22 +147,22 @@ <scons_example name="factories_Copy3"> <file name="S" printme="1"> - Command("file.out", "file.in", - [ - Copy("tempfile", "$SOURCE"), - "modify tempfile", - Copy("$TARGET", "tempfile"), - ]) +Command("file.out", "file.in", + [ + Copy("tempfile", "$SOURCE"), + "modify tempfile", + Copy("$TARGET", "tempfile"), + ]) </file> <file name="SConstruct"> - env = DefaultEnvironment() - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - SConscript('S') +env = DefaultEnvironment() +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +SConscript('S') </file> <file name="file.in">file.in</file> <file name="modify" chmod="0755"> - touch $* +touch $* </file> </scons_example> @@ -198,23 +198,23 @@ <scons_example name="factories_Delete1"> <file name="S" printme="1"> - Command("file.out", "file.in", - [ - Delete("tempfile"), - Copy("tempfile", "$SOURCE"), - "modify tempfile", - Copy("$TARGET", "tempfile"), - ]) +Command("file.out", "file.in", + [ + Delete("tempfile"), + Copy("tempfile", "$SOURCE"), + "modify tempfile", + Copy("$TARGET", "tempfile"), + ]) </file> <file name="SConstruct"> - env = DefaultEnvironment() - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - SConscript('S') +env = DefaultEnvironment() +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +SConscript('S') </file> <file name="file.in">file.in</file> <file name="modify" chmod="0755"> - touch $* +touch $* </file> </scons_example> @@ -239,11 +239,11 @@ <scons_example name="factories_Delete2"> <file name="SConstruct" printme="1"> - Command("file.out", "file.in", - [ - Delete("$TARGET"), - Copy("$TARGET", "$SOURCE") - ]) +Command("file.out", "file.in", + [ + Delete("$TARGET"), + Copy("$TARGET", "$SOURCE") + ]) </file> <file name="file.in">file.in</file> </scons_example> @@ -293,22 +293,22 @@ <scons_example name="factories_Move"> <file name="S" printme="1"> - Command("file.out", "file.in", - [ - Copy("tempfile", "$SOURCE"), - "modify tempfile", - Move("$TARGET", "tempfile"), - ]) +Command("file.out", "file.in", + [ + Copy("tempfile", "$SOURCE"), + "modify tempfile", + Move("$TARGET", "tempfile"), + ]) </file> <file name="SConstruct"> - env = DefaultEnvironment() - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - SConscript('S') +env = DefaultEnvironment() +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +SConscript('S') </file> <file name="file.in">file.in</file> <file name="modify" chmod="0755"> - touch $* +touch $* </file> </scons_example> @@ -337,17 +337,17 @@ <scons_example name="factories_Touch"> <file name="S" printme="1"> - Command("file.out", "file.in", - [ - Copy("$TARGET", "$SOURCE"), - Touch("$TARGET"), - ]) +Command("file.out", "file.in", + [ + Copy("$TARGET", "$SOURCE"), + Touch("$TARGET"), + ]) </file> <file name="SConstruct"> - env = DefaultEnvironment() - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - SConscript('S') +env = DefaultEnvironment() +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +SConscript('S') </file> <file name="file.in">file.in</file> </scons_example> @@ -381,25 +381,25 @@ <scons_example name="factories_Mkdir"> <file name="S" printme="1"> - Command("file.out", "file.in", - [ - Delete("tempdir"), - Mkdir("tempdir"), - Copy("tempdir/${SOURCE.file}", "$SOURCE"), - "process tempdir", - Move("$TARGET", "tempdir/output_file"), - Delete("tempdir"), - ]) +Command("file.out", "file.in", + [ + Delete("tempdir"), + Mkdir("tempdir"), + Copy("tempdir/${SOURCE.file}", "$SOURCE"), + "process tempdir", + Move("$TARGET", "tempdir/output_file"), + Delete("tempdir"), + ]) </file> <file name="SConstruct"> - env = DefaultEnvironment() - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - SConscript('S') +env = DefaultEnvironment() +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +SConscript('S') </file> <file name="file.in">file.in</file> <file name="process" chmod="0755"> - touch $* +touch $* </file> </scons_example> @@ -431,11 +431,11 @@ <scons_example name="factories_Chmod"> <file name="SConstruct" printme="1"> - Command("file.out", "file.in", - [ - Copy("$TARGET", "$SOURCE"), - Chmod("$TARGET", 0755), - ]) +Command("file.out", "file.in", + [ + Copy("$TARGET", "$SOURCE"), + Chmod("$TARGET", 0755), + ]) </file> <file name="file.in">file.in</file> </scons_example> @@ -470,7 +470,7 @@ <scons_example name="factories_Execute"> <file name="SConstruct" printme="1"> - Execute(Mkdir('__ROOT__/tmp/my_temp_directory')) +Execute(Mkdir('__ROOT__/tmp/my_temp_directory')) </file> </scons_example> @@ -521,9 +521,9 @@ </para> <sconstruct> - if Execute(Mkdir('__ROOT__/tmp/my_temp_directory')): - # A problem occurred while making the temp directory. - Exit(1) +if Execute(Mkdir('__ROOT__/tmp/my_temp_directory')): + # A problem occurred while making the temp directory. + Exit(1) </sconstruct> </section> diff --git a/doc/user/file-removal.xml b/doc/user/file-removal.xml index 3b1c36e..ebf7cc9 100644 --- a/doc/user/file-removal.xml +++ b/doc/user/file-removal.xml @@ -80,18 +80,18 @@ <scons_example name="fileremoval_precious-ex1"> <file name="SConstruct" printme="1"> - env = Environment(RANLIBCOM='') - lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) - env.Precious(lib) + env = Environment(RANLIBCOM='') + lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) + env.Precious(lib) </file> <file name="f1.c"> - int f1() { } +int f1() { } </file> <file name="f2.c"> - int f2() { } +int f2() { } </file> <file name="f3.c"> - int f3() { } +int f3() { } </file> </scons_example> @@ -138,18 +138,18 @@ <scons_example name="fileremoval_noclean-ex1"> <file name="SConstruct" printme="1"> - env = Environment(RANLIBCOM='') - lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) - env.NoClean(lib) +env = Environment(RANLIBCOM='') +lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) +env.NoClean(lib) </file> <file name="f1.c"> - int f1() { } +int f1() { } </file> <file name="f2.c"> - int f2() { } +int f2() { } </file> <file name="f3.c"> - int f3() { } +int f3() { } </file> </scons_example> @@ -199,23 +199,23 @@ <scons_example name="fileremoval_clean-ex1"> <file name="S" printme="1"> - t = Command('foo.out', 'foo.in', 'build -o $TARGET $SOURCE') - Clean(t, 'foo.log') +t = Command('foo.out', 'foo.in', 'build -o $TARGET $SOURCE') +Clean(t, 'foo.log') </file> <file name="SConstruct"> - env = DefaultEnvironment() - import os - env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() - SConscript('S') +env = DefaultEnvironment() +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +SConscript('S') </file> <file name="foo.in"> - foo.in +foo.in </file> <file name="foo.log"> - foo.log +foo.log </file> <file name="build" chmod="0755"> - cat $3 > $2 +cat $3 > $2 </file> </scons_example> diff --git a/doc/user/gettext.xml b/doc/user/gettext.xml index 9698c95..4b1e9ea 100644 --- a/doc/user/gettext.xml +++ b/doc/user/gettext.xml @@ -80,13 +80,13 @@ for example <scons_example name="gettext_ex1"> <file name="hello.c" printme="1"> - /* hello.c */ - #include <stdio.h> - int main(int argc, char* argv[]) - { - printf("Hello world\n"); - return 0; - } +/* hello.c */ +#include <stdio.h> +int main(int argc, char* argv[]) +{ + printf("Hello world\n"); + return 0; +} </file> </scons_example> @@ -94,9 +94,9 @@ as usual. <scons_example name="gettext_ex2"> <file name="SConstruct" printme="1"> - # SConstruct - env = Environment() - hello = Program(["hello.c"]) +# SConstruct +env = Environment() +hello = Program(["hello.c"]) </file> </scons_example> </para> @@ -120,18 +120,18 @@ internationalization. Change the previous code so it reads as follows: <scons_example name="gettext_ex3"> <file name="hello.c" printme="1"> - /* hello.c */ - #include <stdio.h> - #include <libintl.h> - #include <locale.h> - int main(int argc, char* argv[]) - { - bindtextdomain("hello", "locale"); - setlocale(LC_ALL, ""); - textdomain("hello"); - printf(gettext("Hello world\n")); - return 0; - } +/* hello.c */ +#include <stdio.h> +#include <libintl.h> +#include <locale.h> +int main(int argc, char* argv[]) +{ + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + return 0; +} </file> </scons_example> Detailed recipes for such conversion can @@ -162,18 +162,18 @@ <filename>SConstruct</filename> is as follows: <scons_example name="gettext_ex4"> <file name="SConstruct" printme="1"> - # SConstruct - env = Environment( tools = ['default', 'gettext'] ) - hello = env.Program(["hello.c"]) - env['XGETTEXTFLAGS'] = [ - '--package-name=%s' % 'hello', - '--package-version=%s' % '1.0', - ] - po = env.Translate(["pl","en", "de"], ["hello.c"], POAUTOINIT = 1) - mo = env.MOFiles(po) - InstallAs(["locale/en/LC_MESSAGES/hello.mo"], ["en.mo"]) - InstallAs(["locale/pl/LC_MESSAGES/hello.mo"], ["pl.mo"]) - InstallAs(["locale/de/LC_MESSAGES/hello.mo"], ["de.mo"]) +# SConstruct +env = Environment( tools = ['default', 'gettext'] ) +hello = env.Program(["hello.c"]) +env['XGETTEXTFLAGS'] = [ + '--package-name=%s' % 'hello', + '--package-version=%s' % '1.0', +] +po = env.Translate(["pl","en", "de"], ["hello.c"], POAUTOINIT = 1) +mo = env.MOFiles(po) +InstallAs(["locale/en/LC_MESSAGES/hello.mo"], ["en.mo"]) +InstallAs(["locale/pl/LC_MESSAGES/hello.mo"], ["pl.mo"]) +InstallAs(["locale/de/LC_MESSAGES/hello.mo"], ["de.mo"]) </file> </scons_example> </para> @@ -181,29 +181,29 @@ Generate the translation files with <command>scons po-update</command>. You should see the output from SCons simillar to this: <screen> - user@host:$ scons po-update - scons: Reading SConscript files ... - scons: done reading SConscript files. - scons: Building targets ... - Entering '/home/ptomulik/projects/tmp' - xgettext --package-name=hello --package-version=1.0 -o - hello.c - Leaving '/home/ptomulik/projects/tmp' - Writting 'messages.pot' (new file) - msginit --no-translator -l pl -i messages.pot -o pl.po - Created pl.po. - msginit --no-translator -l en -i messages.pot -o en.po - Created en.po. - msginit --no-translator -l de -i messages.pot -o de.po - Created de.po. - scons: done building targets. +user@host:$ scons po-update +scons: Reading SConscript files ... +scons: done reading SConscript files. +scons: Building targets ... +Entering '/home/ptomulik/projects/tmp' +xgettext --package-name=hello --package-version=1.0 -o - hello.c +Leaving '/home/ptomulik/projects/tmp' +Writting 'messages.pot' (new file) +msginit --no-translator -l pl -i messages.pot -o pl.po +Created pl.po. +msginit --no-translator -l en -i messages.pot -o en.po +Created en.po. +msginit --no-translator -l de -i messages.pot -o de.po +Created de.po. +scons: done building targets. </screen> </para> <para> If everything is right, you should see following new files. <screen> - user@host:$ ls *.po* - de.po en.po messages.pot pl.po +user@host:$ ls *.po* +de.po en.po messages.pot pl.po </screen> </para> @@ -228,19 +228,19 @@ Now compile the project by executing <command>scons</command>. The output should be similar to this: <screen> - user@host:$ scons - scons: Reading SConscript files ... - scons: done reading SConscript files. - scons: Building targets ... - msgfmt -c -o de.mo de.po - msgfmt -c -o en.mo en.po - gcc -o hello.o -c hello.c - gcc -o hello hello.o - Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" - Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" - msgfmt -c -o pl.mo pl.po - Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" - scons: done building targets. +user@host:$ scons +scons: Reading SConscript files ... +scons: done reading SConscript files. +scons: Building targets ... +msgfmt -c -o de.mo de.po +msgfmt -c -o en.mo en.po +gcc -o hello.o -c hello.c +gcc -o hello hello.o +Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" +Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" +msgfmt -c -o pl.mo pl.po +Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" +scons: done building targets. </screen> SCons automatically compiled the <literal>PO</literal> files to binary format <literal>MO</literal>, and the <literal>InstallAs</literal> lines installed @@ -249,16 +249,16 @@ <para> Your program should be now ready. You may try it as follows (linux): <screen> - user@host:$ LANG=en_US.UTF-8 ./hello - Welcome to beautiful world +user@host:$ LANG=en_US.UTF-8 ./hello +Welcome to beautiful world </screen> <screen> - user@host:$ LANG=de_DE.UTF-8 ./hello - Hallo Welt +user@host:$ LANG=de_DE.UTF-8 ./hello +Hallo Welt </screen> <screen> - user@host:$ LANG=pl_PL.UTF-8 ./hello - Witaj swiecie +user@host:$ LANG=pl_PL.UTF-8 ./hello +Witaj swiecie </screen> </para> <para> @@ -267,13 +267,13 @@ swiecie\n"</literal>. Run <command>scons</command> to see how scons reacts to this <screen> - user@host:$scons - scons: Reading SConscript files ... - scons: done reading SConscript files. - scons: Building targets ... - msgfmt -c -o pl.mo pl.po - Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" - scons: done building targets. +user@host:$scons +scons: Reading SConscript files ... +scons: done reading SConscript files. +scons: Building targets ... +msgfmt -c -o pl.mo pl.po +Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" +scons: done building targets. </screen> </para> <para> @@ -281,19 +281,19 @@ <literal>printf</literal> line with new message. <scons_example name="gettext_ex5"> <file name="hello.c" printme="1"> - /* hello.c */ - #include <stdio.h> - #include <libintl.h> - #include <locale.h> - int main(int argc, char* argv[]) - { - bindtextdomain("hello", "locale"); - setlocale(LC_ALL, ""); - textdomain("hello"); - printf(gettext("Hello world\n")); - printf(gettext("and good bye\n")); - return 0; - } +/* hello.c */ +#include <stdio.h> +#include <libintl.h> +#include <locale.h> +int main(int argc, char* argv[]) +{ + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + return 0; +} </file> </scons_example> </para> @@ -302,29 +302,29 @@ <command>msgmerge(1)</command> program is used by SCons to update <literal>PO</literal> file. The output from compilation is like: <screen> - user@host:$scons - scons: Reading SConscript files ... - scons: done reading SConscript files. - scons: Building targets ... - Entering '/home/ptomulik/projects/tmp' - xgettext --package-name=hello --package-version=1.0 -o - hello.c - Leaving '/home/ptomulik/projects/tmp' - Writting 'messages.pot' (messages in file were outdated) - msgmerge --update de.po messages.pot - ... done. - msgfmt -c -o de.mo de.po - msgmerge --update en.po messages.pot - ... done. - msgfmt -c -o en.mo en.po - gcc -o hello.o -c hello.c - gcc -o hello hello.o - Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" - Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" - msgmerge --update pl.po messages.pot - ... done. - msgfmt -c -o pl.mo pl.po - Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" - scons: done building targets. +user@host:$scons +scons: Reading SConscript files ... +scons: done reading SConscript files. +scons: Building targets ... +Entering '/home/ptomulik/projects/tmp' +xgettext --package-name=hello --package-version=1.0 -o - hello.c +Leaving '/home/ptomulik/projects/tmp' +Writting 'messages.pot' (messages in file were outdated) +msgmerge --update de.po messages.pot +... done. +msgfmt -c -o de.mo de.po +msgmerge --update en.po messages.pot +... done. +msgfmt -c -o en.mo en.po +gcc -o hello.o -c hello.c +gcc -o hello hello.o +Install file: "de.mo" as "locale/de/LC_MESSAGES/hello.mo" +Install file: "en.mo" as "locale/en/LC_MESSAGES/hello.mo" +msgmerge --update pl.po messages.pot +... done. +msgfmt -c -o pl.mo pl.po +Install file: "pl.mo" as "locale/pl/LC_MESSAGES/hello.mo" +scons: done building targets. </screen> </para> <para> @@ -336,35 +336,35 @@ line to the program (after the last printf), so its code becomes: <scons_example name="gettext_ex6"> <file name="hello.c" printme="1"> - /* hello.c */ - #include <stdio.h> - #include <libintl.h> - #include <locale.h> - int main(int argc, char* argv[]) - { - bindtextdomain("hello", "locale"); - setlocale(LC_ALL, ""); - textdomain("hello"); - printf(gettext("Hello world\n")); - printf(gettext("and good bye\n")); - printf("----------------\n"); - return a; - } +/* hello.c */ +#include <stdio.h> +#include <libintl.h> +#include <locale.h> +int main(int argc, char* argv[]) +{ + bindtextdomain("hello", "locale"); + setlocale(LC_ALL, ""); + textdomain("hello"); + printf(gettext("Hello world\n")); + printf(gettext("and good bye\n")); + printf("----------------\n"); + return a; +} </file> </scons_example> Compile the project. You'll see on your screen <screen> - user@host:$scons - scons: Reading SConscript files ... - scons: done reading SConscript files. - scons: Building targets ... - Entering '/home/ptomulik/projects/tmp' - xgettext --package-name=hello --package-version=1.0 -o - hello.c - Leaving '/home/ptomulik/projects/tmp' - Not writting 'messages.pot' (messages in file found to be up-to-date) - gcc -o hello.o -c hello.c - gcc -o hello hello.o - scons: done building targets. +user@host:$scons +scons: Reading SConscript files ... +scons: done reading SConscript files. +scons: Building targets ... +Entering '/home/ptomulik/projects/tmp' +xgettext --package-name=hello --package-version=1.0 -o - hello.c +Leaving '/home/ptomulik/projects/tmp' +Not writting 'messages.pot' (messages in file found to be up-to-date) +gcc -o hello.o -c hello.c +gcc -o hello hello.o +scons: done building targets. </screen> As you see, the internationalized messages ditn't change, so the <literal>POT</literal> and the rest of translation files have not diff --git a/doc/user/hierarchy.xml b/doc/user/hierarchy.xml index d2d01e7..9aaecc2 100644 --- a/doc/user/hierarchy.xml +++ b/doc/user/hierarchy.xml @@ -219,10 +219,10 @@ make no difference to the build. </para> <sconstruct> - SConscript(['drivers/display/SConscript', - 'drivers/mouse/SConscript', - 'parser/SConscript', - 'utilities/SConscript']) +SConscript(['drivers/display/SConscript', + 'drivers/mouse/SConscript', + 'parser/SConscript', + 'utilities/SConscript']) </sconstruct> <para> @@ -241,9 +241,9 @@ make no difference to the build. </para> <sconstruct> - SConscript(['drivers/SConscript', - 'parser/SConscript', - 'utilities/SConscript']) +SConscript(['drivers/SConscript', + 'parser/SConscript', + 'utilities/SConscript']) </sconstruct> <para> @@ -255,8 +255,8 @@ make no difference to the build. </para> <sconstruct> - SConscript(['display/SConscript', - 'mouse/SConscript']) +SConscript(['display/SConscript', + 'mouse/SConscript']) </sconstruct> <para> @@ -303,36 +303,36 @@ make no difference to the build. <scons_example name="hierarchy_ex1"> <file name="SConstruct" printme="1"> - SConscript(['prog1/SConscript', - 'prog2/SConscript']) +SConscript(['prog1/SConscript', + 'prog2/SConscript']) </file> <file name="prog1/SConscript"> - env = Environment() - env.Program('prog1', ['main.c', 'foo1.c', 'foo2.c']) +env = Environment() +env.Program('prog1', ['main.c', 'foo1.c', 'foo2.c']) </file> <file name="prog2/SConscript"> - env = Environment() - env.Program('prog2', ['main.c', 'bar1.c', 'bar2.c']) +env = Environment() +env.Program('prog2', ['main.c', 'bar1.c', 'bar2.c']) </file> <directory name="prog1"></directory> <file name="prog1/main.c"> - x +x </file> <file name="prog1/foo1.c"> - x +x </file> <file name="prog1/foo2.c"> - x +x </file> <directory name="prog2"></directory> <file name="prog2/main.c"> - x +x </file> <file name="prog2/bar1.c"> - x +x </file> <file name="prog2/bar2.c"> - x +x </file> </scons_example> @@ -404,20 +404,20 @@ make no difference to the build. <scons_example name="hierarchy_ex2"> <file name="SConstruct"> - SConscript('src/prog/SConscript') +SConscript('src/prog/SConscript') </file> <file name="src/prog/SConscript" printme="1"> - env = Environment() - env.Program('prog', ['main.c', '#lib/foo1.c', 'foo2.c']) +env = Environment() +env.Program('prog', ['main.c', '#lib/foo1.c', 'foo2.c']) </file> <file name="src/prog/main.c"> - x +x </file> <file name="lib/foo1.c"> - x +x </file> <file name="src/prog/foo2.c"> - x +x </file> </scons_example> @@ -460,20 +460,20 @@ make no difference to the build. <scons_example name="hierarchy_ex3"> <file name="SConstruct"> - SConscript('src/prog/SConscript') +SConscript('src/prog/SConscript') </file> <file name="src/prog/SConscript" printme="1"> - env = Environment() - env.Program('prog', ['main.c', '__ROOT__/usr/joe/lib/foo1.c', 'foo2.c']) +env = Environment() +env.Program('prog', ['main.c', '__ROOT__/usr/joe/lib/foo1.c', 'foo2.c']) </file> <file name="src/prog/main.c"> - x +x </file> <file name="__ROOT__/usr/joe/lib/foo1.c"> - x +x </file> <file name="src/prog/foo2.c"> - x +x </file> </scons_example> @@ -549,8 +549,8 @@ make no difference to the build. </para> <sconstruct> - env = Environment() - Export('env') +env = Environment() +Export('env') </sconstruct> <para> @@ -560,9 +560,9 @@ make no difference to the build. </para> <sconstruct> - env = Environment() - debug = ARGUMENTS['debug'] - Export('env', 'debug') +env = Environment() +debug = ARGUMENTS['debug'] +Export('env', 'debug') </sconstruct> <para> @@ -574,7 +574,7 @@ make no difference to the build. </para> <sconstruct> - Export('env debug') +Export('env debug') </sconstruct> <para> @@ -586,7 +586,7 @@ make no difference to the build. </para> <sconstruct> - SConscript('src/SConscript', 'env') +SConscript('src/SConscript', 'env') </sconstruct> <para> @@ -596,7 +596,7 @@ make no difference to the build. </para> <sconstruct> - SConscript('src/SConscript', exports='env') +SConscript('src/SConscript', exports='env') </sconstruct> <para> @@ -609,8 +609,8 @@ make no difference to the build. </para> <sconstruct> - SConscript(['src1/SConscript', - 'src2/SConscript'], exports='env') +SConscript(['src1/SConscript', + 'src2/SConscript'], exports='env') </sconstruct> <para> @@ -637,8 +637,8 @@ make no difference to the build. </para> <sconstruct> - Import('env') - env.Program('prog', ['prog.c']) +Import('env') +env.Program('prog', ['prog.c']) </sconstruct> <para> @@ -659,9 +659,9 @@ make no difference to the build. </para> <sconstruct> - Import('env', 'debug') - env = env.Clone(DEBUG = debug) - env.Program('prog', ['prog.c']) +Import('env', 'debug') +env = env.Clone(DEBUG = debug) +env.Program('prog', ['prog.c']) </sconstruct> <para> @@ -673,9 +673,9 @@ make no difference to the build. </para> <sconstruct> - Import('env debug') - env = env.Clone(DEBUG = debug) - env.Program('prog', ['prog.c']) +Import('env debug') +env = env.Clone(DEBUG = debug) +env.Program('prog', ['prog.c']) </sconstruct> <para> @@ -688,9 +688,9 @@ make no difference to the build. </para> <sconstruct> - Import('*') - env = env.Clone(DEBUG = debug) - env.Program('prog', ['prog.c']) +Import('*') +env = env.Clone(DEBUG = debug) +env.Program('prog', ['prog.c']) </sconstruct> <para> @@ -738,31 +738,31 @@ make no difference to the build. <scons_example name="hierarchy_Return"> <file name="SConstruct" printme="1"> - env = Environment() - Export('env') - objs = [] - for subdir in ['foo', 'bar']: - o = SConscript('%s/SConscript' % subdir) - objs.append(o) - env.Library('prog', objs) +env = Environment() +Export('env') +objs = [] +for subdir in ['foo', 'bar']: + o = SConscript('%s/SConscript' % subdir) + objs.append(o) +env.Library('prog', objs) </file> <directory name="foo"></directory> <directory name="bar"></directory> <file name="foo/SConscript"> - Import('env') - obj = env.Object('foo.c') - Return('obj') +Import('env') +obj = env.Object('foo.c') +Return('obj') </file> <file name="bar/SConscript"> - Import('env') - obj = env.Object('bar.c') - Return('obj') +Import('env') +obj = env.Object('bar.c') +Return('obj') </file> <file name="foo/foo.c"> - void foo(void) { printf("foo/foo.c\n"); } +void foo(void) { printf("foo/foo.c\n"); } </file> <file name="bar/bar.c"> - void bar(void) { printf("bar/bar.c\n"); } +void bar(void) { printf("bar/bar.c\n"); } </file> </scons_example> diff --git a/doc/user/install.xml b/doc/user/install.xml index 7c2f00e..159b886 100644 --- a/doc/user/install.xml +++ b/doc/user/install.xml @@ -58,12 +58,12 @@ <scons_example name="install_ex1"> <file name="SConstruct" printme="1"> - env = Environment() - hello = env.Program('hello.c') - env.Install('__ROOT__/usr/bin', hello) +env = Environment() +hello = env.Program('hello.c') +env.Install('__ROOT__/usr/bin', hello) </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -104,13 +104,13 @@ <scons_example name="install_ex2"> <file name="SConstruct" printme="1"> - env = Environment() - hello = env.Program('hello.c') - env.Install('__ROOT__/usr/bin', hello) - env.Alias('install', '__ROOT__/usr/bin') +env = Environment() +hello = env.Program('hello.c') +env.Install('__ROOT__/usr/bin', hello) +env.Alias('install', '__ROOT__/usr/bin') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -139,18 +139,18 @@ <scons_example name="install_ex3"> <file name="SConstruct" printme="1"> - env = Environment() - hello = env.Program('hello.c') - goodbye = env.Program('goodbye.c') - env.Install('__ROOT__/usr/bin', hello) - env.Install('__ROOT__/usr/bin', goodbye) - env.Alias('install', '__ROOT__/usr/bin') +env = Environment() +hello = env.Program('hello.c') +goodbye = env.Program('goodbye.c') +env.Install('__ROOT__/usr/bin', hello) +env.Install('__ROOT__/usr/bin', goodbye) +env.Alias('install', '__ROOT__/usr/bin') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> <file name="goodbye.c"> - int main() { printf("Goodbye, world!\n"); } +int main() { printf("Goodbye, world!\n"); } </file> </scons_example> @@ -163,11 +163,11 @@ </para> <sconstruct> - env = Environment() - hello = env.Program('hello.c') - goodbye = env.Program('goodbye.c') - env.Install('__ROOT__/usr/bin', [hello, goodbye]) - env.Alias('install', '__ROOT__/usr/bin') +env = Environment() +hello = env.Program('hello.c') +goodbye = env.Program('goodbye.c') +env.Install('__ROOT__/usr/bin', [hello, goodbye]) +env.Alias('install', '__ROOT__/usr/bin') </sconstruct> <para> @@ -197,13 +197,13 @@ <scons_example name="install_ex4"> <file name="SConstruct" printme="1"> - env = Environment() - hello = env.Program('hello.c') - env.InstallAs('__ROOT__/usr/bin/hello-new', hello) - env.Alias('install', '__ROOT__/usr/bin') +env = Environment() +hello = env.Program('hello.c') +env.InstallAs('__ROOT__/usr/bin/hello-new', hello) +env.Alias('install', '__ROOT__/usr/bin') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -237,19 +237,19 @@ <scons_example name="install_ex5"> <file name="SConstruct" printme="1"> - env = Environment() - hello = env.Program('hello.c') - goodbye = env.Program('goodbye.c') - env.InstallAs(['__ROOT__/usr/bin/hello-new', - '__ROOT__/usr/bin/goodbye-new'], - [hello, goodbye]) - env.Alias('install', '__ROOT__/usr/bin') +env = Environment() +hello = env.Program('hello.c') +goodbye = env.Program('goodbye.c') +env.InstallAs(['__ROOT__/usr/bin/hello-new', + '__ROOT__/usr/bin/goodbye-new'], + [hello, goodbye]) +env.Alias('install', '__ROOT__/usr/bin') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> <file name="goodbye.c"> - int main() { printf("Goodbye, world!\n"); } +int main() { printf("Goodbye, world!\n"); } </file> </scons_example> diff --git a/doc/user/java.xml b/doc/user/java.xml index 418faf6..40a82a3 100644 --- a/doc/user/java.xml +++ b/doc/user/java.xml @@ -80,34 +80,34 @@ <scons_example name="java_java"> <file name="SConstruct" printme="1"> - Java('classes', 'src') +Java('classes', 'src') </file> <file name="src/Example1.java"> - public class Example1 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> <file name="src/Example2.java"> - public class Example2 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example2 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> <file name="src/Example3.java"> - public class Example3 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> </scons_example> @@ -155,50 +155,50 @@ <scons_example name="java_java-classes"> <file name="SConstruct" printme="1"> - Java('classes', 'src') +Java('classes', 'src') </file> <file name="src/Example1.java"> - public class Example1 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } - public class AdditionalClass1 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} +public class AdditionalClass1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> <file name="src/Example2.java"> - public class Example2 - { - class Inner2 { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } - } +public class Example2 +{ + class Inner2 { + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } + } +} </file> <file name="src/Example3.java"> - public class Example3 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } - public class AdditionalClass3 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} +public class AdditionalClass3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> </scons_example> @@ -253,7 +253,7 @@ </para> <sconstruct> - Java('classes', 'src', JAVAVERSION='1.6') +Java('classes', 'src', JAVAVERSION='1.6') </sconstruct> <para> @@ -280,35 +280,35 @@ <scons_example name="java_jar1"> <file name="SConstruct" printme="1"> - Java(target = 'classes', source = 'src') - Jar(target = 'test.jar', source = 'classes') +Java(target = 'classes', source = 'src') +Jar(target = 'test.jar', source = 'classes') </file> <file name="src/Example1.java"> - public class Example1 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> <file name="src/Example2.java"> - public class Example2 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example2 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> <file name="src/Example3.java"> - public class Example3 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> </scons_example> @@ -344,46 +344,46 @@ <scons_example name="java_jar2"> <file name="SConstruct" printme="1"> - prog1_class_files = Java(target = 'classes', source = 'prog1') - prog2_class_files = Java(target = 'classes', source = 'prog2') - Jar(target = 'prog1.jar', source = prog1_class_files) - Jar(target = 'prog2.jar', source = prog2_class_files) +prog1_class_files = Java(target = 'classes', source = 'prog1') +prog2_class_files = Java(target = 'classes', source = 'prog2') +Jar(target = 'prog1.jar', source = prog1_class_files) +Jar(target = 'prog2.jar', source = prog2_class_files) </file> <file name="prog1/Example1.java"> - public class Example1 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> <file name="prog1/Example2.java"> - public class Example2 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example2 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> <file name="prog2/Example3.java"> - public class Example3 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> <file name="prog2/Example4.java"> - public class Example4 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example4 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> </scons_example> @@ -418,35 +418,35 @@ <scons_example name="java_javah"> <file name="SConstruct" printme="1"> - classes = Java(target = 'classes', source = 'src/pkg/sub') - JavaH(target = 'native', source = classes) +classes = Java(target = 'classes', source = 'src/pkg/sub') +JavaH(target = 'native', source = classes) </file> <file name="src/pkg/sub/Example1.java"> - package pkg.sub; - public class Example1 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example1 +{ + public static void main(String[] args) + { + } +} </file> <file name="src/pkg/sub/Example2.java"> - package pkg.sub; - public class Example2 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example2 +{ + public static void main(String[] args) + { + } +} </file> <file name="src/pkg/sub/Example3.java"> - package pkg.sub; - public class Example3 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example3 +{ + public static void main(String[] args) + { + } +} </file> </scons_example> @@ -502,38 +502,38 @@ <scons_example name="java_JAVACLASSDIR"> <file name="SConstruct" printme="1"> - Java(target = 'classes', source = 'src/pkg/sub') - class_file_list = ['classes/pkg/sub/Example1.class', - 'classes/pkg/sub/Example2.class', - 'classes/pkg/sub/Example3.class'] - JavaH(target = 'native', source = class_file_list, JAVACLASSDIR = 'classes') +Java(target = 'classes', source = 'src/pkg/sub') +class_file_list = ['classes/pkg/sub/Example1.class', + 'classes/pkg/sub/Example2.class', + 'classes/pkg/sub/Example3.class'] +JavaH(target = 'native', source = class_file_list, JAVACLASSDIR = 'classes') </file> <file name="src/pkg/sub/Example1.java"> - package pkg.sub; - public class Example1 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example1 +{ + public static void main(String[] args) + { + } +} </file> <file name="src/pkg/sub/Example2.java"> - package pkg.sub; - public class Example2 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example2 +{ + public static void main(String[] args) + { + } +} </file> <file name="src/pkg/sub/Example3.java"> - package pkg.sub; - public class Example3 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example3 +{ + public static void main(String[] args) + { + } +} </file> </scons_example> @@ -560,35 +560,35 @@ <scons_example name="java_javah_file"> <file name="SConstruct" printme="1"> - classes = Java(target = 'classes', source = 'src/pkg/sub') - JavaH(target = File('native.h'), source = classes) +classes = Java(target = 'classes', source = 'src/pkg/sub') +JavaH(target = File('native.h'), source = classes) </file> <file name="src/pkg/sub/Example1.java"> - package pkg.sub; - public class Example1 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example1 +{ + public static void main(String[] args) + { + } +} </file> <file name="src/pkg/sub/Example2.java"> - package pkg.sub; - public class Example2 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example2 +{ + public static void main(String[] args) + { + } +} </file> <file name="src/pkg/sub/Example3.java"> - package pkg.sub; - public class Example3 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example3 +{ + public static void main(String[] args) + { + } +} </file> </scons_example> @@ -629,26 +629,26 @@ <scons_example name="java_RMIC"> <file name="SConstruct" printme="1"> - classes = Java(target = 'classes', source = 'src/pkg/sub') - RMIC(target = 'outdir', source = classes) +classes = Java(target = 'classes', source = 'src/pkg/sub') +RMIC(target = 'outdir', source = classes) </file> <file name="src/pkg/sub/Example1.java"> - package pkg.sub; - public class Example1 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example1 +{ + public static void main(String[] args) + { + } +} </file> <file name="src/pkg/sub/Example2.java"> - package pkg.sub; - public class Example2 - { - public static void main(String[] args) - { - } - } +package pkg.sub; +public class Example2 +{ + public static void main(String[] args) + { + } +} </file> </scons_example> diff --git a/doc/user/less-simple.xml b/doc/user/less-simple.xml index 53e6433..4c60cc7 100644 --- a/doc/user/less-simple.xml +++ b/doc/user/less-simple.xml @@ -72,7 +72,7 @@ </para> <programlisting> - Program('hello.c') +Program('hello.c') </programlisting> <para> @@ -86,10 +86,10 @@ <scons_example name="lesssimple_target"> <file name="SConstruct" printme="1"> - Program('new_hello', 'hello.c') +Program('new_hello', 'hello.c') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -147,16 +147,16 @@ <scons_example name="lesssimple_ex2"> <file name="SConstruct" printme="1"> - Program(['prog.c', 'file1.c', 'file2.c']) +Program(['prog.c', 'file1.c', 'file2.c']) </file> <file name="prog.c"> - int main() { printf("prog.c\n"); } +int main() { printf("prog.c\n"); } </file> <file name="file1.c"> - void file1() { printf("file1.c\n"); } +void file1() { printf("file1.c\n"); } </file> <file name="file2.c"> - void file2() { printf("file2.c\n"); } +void file2() { printf("file2.c\n"); } </file> </scons_example> @@ -194,16 +194,16 @@ <scons_example name="lesssimple_ex3"> <file name="SConstruct" printme="1"> - Program('program', ['prog.c', 'file1.c', 'file2.c']) +Program('program', ['prog.c', 'file1.c', 'file2.c']) </file> <file name="prog.c"> - int main() { printf("prog.c\n"); } +int main() { printf("prog.c\n"); } </file> <file name="file1.c"> - void file1() { printf("file1.c\n"); } +void file1() { printf("file1.c\n"); } </file> <file name="file2.c"> - void file2() { printf("file2.c\n"); } +void file2() { printf("file2.c\n"); } </file> </scons_example> @@ -247,7 +247,7 @@ </para> <sconstruct> - Program('program', Glob('*.c')) +Program('program', Glob('*.c')) </sconstruct> <para> @@ -275,7 +275,7 @@ </para> <sconstruct> - Program('hello', ['file1.c', 'file2.c']) +Program('hello', ['file1.c', 'file2.c']) </sconstruct> <para> @@ -285,7 +285,7 @@ </para> <sconstruct> - Program('hello', 'hello.c') +Program('hello', 'hello.c') </sconstruct> <para> @@ -296,7 +296,7 @@ </para> <sconstruct> - Program('hello', ['hello.c']) +Program('hello', ['hello.c']) </sconstruct> <para> @@ -324,9 +324,9 @@ </para> <sconstruct> - # The following two calls both work correctly: - Program('program1', 'program1.c') - Program('program2', ['program2.c']) +# The following two calls both work correctly: +Program('program1', 'program1.c') +Program('program2', ['program2.c']) </sconstruct> <para> @@ -383,7 +383,7 @@ </para> <programlisting> - Program('program', Split('main.c file1.c file2.c')) +Program('program', Split('main.c file1.c file2.c')) </programlisting> <para> @@ -417,8 +417,8 @@ </para> <programlisting> - src_files = Split('main.c file1.c file2.c') - Program('program', src_files) +src_files = Split('main.c file1.c file2.c') +Program('program', src_files) </programlisting> <para> @@ -433,10 +433,10 @@ </para> <programlisting> - src_files = Split("""main.c - file1.c - file2.c""") - Program('program', src_files) +src_files = Split("""main.c + file1.c + file2.c""") +Program('program', src_files) </programlisting> <para> @@ -469,8 +469,8 @@ </para> <programlisting> - src_files = Split('main.c file1.c file2.c') - Program(target = 'program', source = src_files) +src_files = Split('main.c file1.c file2.c') +Program(target = 'program', source = src_files) </programlisting> <para> @@ -482,8 +482,8 @@ </para> <programlisting> - src_files = Split('main.c file1.c file2.c') - Program(source = src_files, target = 'program') +src_files = Split('main.c file1.c file2.c') +Program(source = src_files, target = 'program') </programlisting> <para> @@ -514,17 +514,17 @@ <scons_example name="lesssimple_ex4"> <file name="SConstruct" printme="1"> - Program('foo.c') - Program('bar', ['bar1.c', 'bar2.c']) +Program('foo.c') +Program('bar', ['bar1.c', 'bar2.c']) </file> <file name="foo.c"> - int main() { printf("foo.c\n"); } +int main() { printf("foo.c\n"); } </file> <file name="bar1.c"> - int main() { printf("bar1.c\n"); } +int main() { printf("bar1.c\n"); } </file> <file name="bar2.c"> - void bar2() { printf("bar2.c\n"); } +void bar2() { printf("bar2.c\n"); } </file> </scons_example> @@ -579,23 +579,23 @@ <scons_example name="lesssimple_ex5"> <file name="SConstruct" printme="1"> - Program(Split('foo.c common1.c common2.c')) - Program('bar', Split('bar1.c bar2.c common1.c common2.c')) +Program(Split('foo.c common1.c common2.c')) +Program('bar', Split('bar1.c bar2.c common1.c common2.c')) </file> <file name="foo.c"> - int main() { printf("foo.c\n"); } +int main() { printf("foo.c\n"); } </file> <file name="bar1.c"> - int main() { printf("bar1.c\n"); } +int main() { printf("bar1.c\n"); } </file> <file name="bar2.c"> - int bar2() { printf("bar2.c\n"); } +int bar2() { printf("bar2.c\n"); } </file> <file name="common1.c"> - void common1() { printf("common1.c\n"); } +void common1() { printf("common1.c\n"); } </file> <file name="common2.c"> - void common22() { printf("common2.c\n"); } +void common22() { printf("common2.c\n"); } </file> </scons_example> @@ -628,11 +628,11 @@ </para> <programlisting> - common = ['common1.c', 'common2.c'] - foo_files = ['foo.c'] + common - bar_files = ['bar1.c', 'bar2.c'] + common - Program('foo', foo_files) - Program('bar', bar_files) +common = ['common1.c', 'common2.c'] +foo_files = ['foo.c'] + common +bar_files = ['bar1.c', 'bar2.c'] + common +Program('foo', foo_files) +Program('bar', bar_files) </programlisting> <para> diff --git a/doc/user/libraries.xml b/doc/user/libraries.xml index 1b43a48..63d4544 100644 --- a/doc/user/libraries.xml +++ b/doc/user/libraries.xml @@ -65,16 +65,16 @@ <scons_example name="libraries_ex1" printme="1"> <file name="SConstruct" printme="1"> - Library('foo', ['f1.c', 'f2.c', 'f3.c']) +Library('foo', ['f1.c', 'f2.c', 'f3.c']) </file> <file name="f1.c"> - void f1() { printf("f1.c\n"); } +void f1() { printf("f1.c\n"); } </file> <file name="f2.c"> - void f2() { printf("f2.c\n"); } +void f2() { printf("f2.c\n"); } </file> <file name="f3.c"> - void f3() { printf("f3.c\n"); } +void f3() { printf("f3.c\n"); } </file> </scons_example> @@ -131,19 +131,19 @@ <scons_example name="libraries_objects" printme="1"> <file name="SConstruct" printme="1"> - Library('foo', ['f1.c', 'f2.o', 'f3.c', 'f4.o']) +Library('foo', ['f1.c', 'f2.o', 'f3.c', 'f4.o']) </file> <file name="f1.c"> - void f1() { printf("f1.c\n"); } +void f1() { printf("f1.c\n"); } </file> <file name="f2.o"> - object file +object file </file> <file name="f3.c"> - void f3() { printf("f3.c\n"); } +void f3() { printf("f3.c\n"); } </file> <file name="f4.o"> - object file +object file </file> </scons_example> @@ -186,7 +186,7 @@ <scons_example name="libraries_StaticLibrary" printme="1"> <file name="SConstruct" printme="1"> - StaticLibrary('foo', ['f1.c', 'f2.c', 'f3.c']) +StaticLibrary('foo', ['f1.c', 'f2.c', 'f3.c']) </file> </scons_example> @@ -212,16 +212,16 @@ <scons_example name="libraries_SharedLibrary" printme="1"> <file name="SConstruct" printme="1"> - SharedLibrary('foo', ['f1.c', 'f2.c', 'f3.c']) +SharedLibrary('foo', ['f1.c', 'f2.c', 'f3.c']) </file> <file name="f1.c"> - void f1() { printf("f1.c\n"); } +void f1() { printf("f1.c\n"); } </file> <file name="f2.c"> - void f2() { printf("f2.c\n"); } +void f2() { printf("f2.c\n"); } </file> <file name="f3.c"> - void f3() { printf("f3.c\n"); } +void f3() { printf("f3.c\n"); } </file> </scons_example> @@ -280,20 +280,20 @@ <scons_example name="libraries_ex2"> <file name="SConstruct" printme="1"> - Library('foo', ['f1.c', 'f2.c', 'f3.c']) - Program('prog.c', LIBS=['foo', 'bar'], LIBPATH='.') +Library('foo', ['f1.c', 'f2.c', 'f3.c']) +Program('prog.c', LIBS=['foo', 'bar'], LIBPATH='.') </file> <file name="f1.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> <file name="f2.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> <file name="f3.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> <file name="prog.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -347,7 +347,7 @@ </para> <sconstruct> - Program('prog.c', LIBS='foo', LIBPATH='.') +Program('prog.c', LIBS='foo', LIBPATH='.') </sconstruct> <para> @@ -357,7 +357,7 @@ </para> <sconstruct> - Program('prog.c', LIBS=['foo'], LIBPATH='.') +Program('prog.c', LIBS=['foo'], LIBPATH='.') </sconstruct> <para> @@ -387,11 +387,11 @@ <scons_example name="libraries_ex3"> <file name="SConstruct" printme="1"> - Program('prog.c', LIBS = 'm', - LIBPATH = ['/usr/lib', '/usr/local/lib']) +Program('prog.c', LIBS = 'm', + LIBPATH = ['/usr/lib', '/usr/local/lib']) </file> <file name="prog.c"> - int main() { printf("prog.c\n"); } +int main() { printf("prog.c\n"); } </file> </scons_example> @@ -406,7 +406,7 @@ </para> <sconstruct> - LIBPATH = '/usr/lib:/usr/local/lib' +LIBPATH = '/usr/lib:/usr/local/lib' </sconstruct> <para> @@ -416,7 +416,7 @@ </para> <sconstruct> - LIBPATH = 'C:\\lib;D:\\lib' +LIBPATH = 'C:\\lib;D:\\lib' </sconstruct> <para> diff --git a/doc/user/mergeflags.xml b/doc/user/mergeflags.xml index 393cfbc..1143ee9 100644 --- a/doc/user/mergeflags.xml +++ b/doc/user/mergeflags.xml @@ -73,11 +73,11 @@ <scons_example name="mergeflags_MergeFlags1"> <file name="SConstruct" printme="1"> - env = Environment() - env.Append(CCFLAGS = '-option -O3 -O1') - flags = { 'CCFLAGS' : '-whatever -O3' } - env.MergeFlags(flags) - print env['CCFLAGS'] +env = Environment() +env.Append(CCFLAGS = '-option -O3 -O1') +flags = { 'CCFLAGS' : '-whatever -O3' } +env.MergeFlags(flags) +print env['CCFLAGS'] </file> </scons_example> @@ -100,11 +100,11 @@ <scons_example name="mergeflags_MergeFlags2"> <file name="SConstruct" printme="1"> - env = Environment() - env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include']) - flags = { 'CPPPATH' : ['/usr/opt/include', '/usr/local/include'] } - env.MergeFlags(flags) - print env['CPPPATH'] +env = Environment() +env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include']) +flags = { 'CPPPATH' : ['/usr/opt/include', '/usr/local/include'] } +env.MergeFlags(flags) +print env['CPPPATH'] </file> </scons_example> @@ -134,12 +134,12 @@ <scons_example name="mergeflags_MergeFlags3"> <file name="SConstruct" printme="1"> - env = Environment() - env.Append(CCFLAGS = '-option -O3 -O1') - env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include']) - env.MergeFlags('-whatever -I/usr/opt/include -O3 -I/usr/local/include') - print env['CCFLAGS'] - print env['CPPPATH'] +env = Environment() +env.Append(CCFLAGS = '-option -O3 -O1') +env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include']) +env.MergeFlags('-whatever -I/usr/opt/include -O3 -I/usr/local/include') +print env['CCFLAGS'] +print env['CPPPATH'] </file> </scons_example> diff --git a/doc/user/misc.xml b/doc/user/misc.xml index 3739302..4145d49 100644 --- a/doc/user/misc.xml +++ b/doc/user/misc.xml @@ -91,14 +91,14 @@ <scons_example name="misc_EnsurePythonVersion"> <file name="SConstruct" printme="1"> - EnsurePythonVersion(2, 5) +EnsurePythonVersion(2, 5) </file> </scons_example> --> <sconstruct> - EnsurePythonVersion(2, 5) +EnsurePythonVersion(2, 5) </sconstruct> <para> @@ -122,8 +122,8 @@ --> <screen> - % <userinput>scons -Q</userinput> - Python 2.5 or greater required, but you have Python 2.3.6 +% <userinput>scons -Q</userinput> +Python 2.5 or greater required, but you have Python 2.3.6 </screen> </section> @@ -160,14 +160,14 @@ <scons_example name="misc_EnsureSConsVersion"> <file name="SConstruct" printme="1"> - EnsureSConsVersion(1, 0) +EnsureSConsVersion(1, 0) </file> </scons_example> --> <sconstruct> - EnsureSConsVersion(1, 0) +EnsureSConsVersion(1, 0) </sconstruct> <para> @@ -191,8 +191,8 @@ --> <screen> - % <userinput>scons -Q</userinput> - SCons 1.0 or greater required, but you have SCons 0.98.5 +% <userinput>scons -Q</userinput> +SCons 1.0 or greater required, but you have SCons 0.98.5 </screen> </section> @@ -212,14 +212,14 @@ <scons_example name="misc_Exit"> <file name="SConstruct" printme="1"> - if ARGUMENTS.get('FUTURE'): - print "The FUTURE option is not supported yet!" - Exit(2) - env = Environment() - env.Program('hello.c') +if ARGUMENTS.get('FUTURE'): + print "The FUTURE option is not supported yet!" + Exit(2) +env = Environment() +env.Program('hello.c') </file> <file name="hello.c"> - hello.c +hello.c </file> </scons_example> @@ -268,13 +268,13 @@ <scons_example name="misc_FindFile1a"> <file name="SConstruct" printme="1"> - # one directory - print FindFile('missing', '.') - t = FindFile('exists', '.') - print t.__class__, t +# one directory +print FindFile('missing', '.') +t = FindFile('exists', '.') +print t.__class__, t </file> <file name="exists"> - exists + exists </file> </scons_example> @@ -284,23 +284,23 @@ <scons_example name="misc_FindFile1b"> <file name="SConstruct" printme="1"> - # several directories - includes = [ '.', 'include', 'src/include'] - headers = [ 'nonesuch.h', 'config.h', 'private.h', 'dist.h'] - for hdr in headers: - print '%-12s' % ('%s:' % hdr), FindFile(hdr, includes) +# several directories +includes = [ '.', 'include', 'src/include'] +headers = [ 'nonesuch.h', 'config.h', 'private.h', 'dist.h'] +for hdr in headers: + print '%-12s' % ('%s:' % hdr), FindFile(hdr, includes) </file> <file name="config.h"> - exists +exists </file> <directory name="src"></directory> <directory name="src/include"></directory> <file name="src/include/private.h"> - exists +exists </file> <directory name="include"></directory> <file name="include/dist.h"> - exists +exists </file> </scons_example> @@ -318,23 +318,23 @@ <scons_example name="misc_FindFile1c"> <file name="SConstruct" printme="1"> - # several directories - includes = [ '.', 'include', 'src/include'] - headers = [ 'nonesuch.h', 'config.h', 'private.h', 'dist.h'] - print FindFile(headers, includes) +# several directories +includes = [ '.', 'include', 'src/include'] +headers = [ 'nonesuch.h', 'config.h', 'private.h', 'dist.h'] +print FindFile(headers, includes) </file> <file name="config.h"> - exists +exists </file> <directory name="src"></directory> <directory name="src/include"></directory> </file> <file name="src/include/private.h"> - exists +exists <directory name="include"></directory> </file> <file name="include/dist.h"> - exists +exists </scons_example> <scons_output example="misc_FindFile1c" os="posix" suffix="1"> @@ -351,21 +351,21 @@ <scons_example name="misc_FindFile1d"> <file name="SConstruct" printme="1"> - print FindFile('multiple', ['sub1', 'sub2', 'sub3']) - print FindFile('multiple', ['sub2', 'sub3', 'sub1']) - print FindFile('multiple', ['sub3', 'sub1', 'sub2']) +print FindFile('multiple', ['sub1', 'sub2', 'sub3']) +print FindFile('multiple', ['sub2', 'sub3', 'sub1']) +print FindFile('multiple', ['sub3', 'sub1', 'sub2']) </file> <directory name="sub1"></directory> <file name="sub1/multiple"> - exists +exists </file> <directory name="sub2"></directory> <file name="sub2/multiple"> - exists +exists </file> <directory name="sub3"></directory> <file name="sub3/multiple"> - exists +exists </file> </scons_example> @@ -385,10 +385,10 @@ <scons_example name="misc_FindFile2"> <file name="SConstruct" printme="1"> - # Neither file exists, so build will fail - Command('derived', 'leaf', 'cat >$TARGET $SOURCE') - print FindFile('leaf', '.') - print FindFile('derived', '.') +# Neither file exists, so build will fail +Command('derived', 'leaf', 'cat >$TARGET $SOURCE') +print FindFile('leaf', '.') +print FindFile('derived', '.') </file> </scons_example> @@ -398,13 +398,13 @@ <scons_example name="misc_FindFile2"> <file name="SConstruct" printme="1"> - # Only 'leaf' exists - Command('derived', 'leaf', 'cat >$TARGET $SOURCE') - print FindFile('leaf', '.') - print FindFile('derived', '.') +# Only 'leaf' exists +Command('derived', 'leaf', 'cat >$TARGET $SOURCE') +print FindFile('leaf', '.') +print FindFile('derived', '.') </file> <file name="leaf"> - leaf +leaf </file> </scons_example> @@ -421,13 +421,13 @@ <scons_example name="misc_FindFile3"> <file name="SConstruct" printme="1"> - # Only 'src/leaf' exists - VariantDir('build', 'src') - print FindFile('leaf', 'build') +# Only 'src/leaf' exists +VariantDir('build', 'src') +print FindFile('leaf', 'build') </file> <directory name="src"></directory> <file name="src/leaf"> - leaf +leaf </file> </scons_example> @@ -460,17 +460,17 @@ <scons_example name="misc_Flatten1"> <file name="SConstruct" printme="1"> - objects = [ - Object('prog1.c'), - Object('prog2.c', CCFLAGS='-DFOO'), - ] - Program(objects) +objects = [ + Object('prog1.c'), + Object('prog2.c', CCFLAGS='-DFOO'), +] +Program(objects) </file> <file name="prog1.c"> - prog1.c +prog1.c </file> <file name="prog2.c"> - prog2.c +prog2.c </file> </scons_example> @@ -570,12 +570,12 @@ --> <screen> - % <userinput>scons -Q</userinput> - /home/me/project/prog1.o - /home/me/project/prog2.o - cc -o prog1.o -c prog1.c - cc -o prog2.o -c -DFOO prog2.c - cc -o prog1 prog1.o prog2.o +% <userinput>scons -Q</userinput> +/home/me/project/prog1.o +/home/me/project/prog2.o +cc -o prog1.o -c prog1.c +cc -o prog2.o -c -DFOO prog2.c +cc -o prog1 prog1.o prog2.o </screen> </section> @@ -592,12 +592,12 @@ </para> <sconstruct> - env = Environment( - LAUNCHDIR = GetLaunchDir(), - ) - env.Command('directory_build_info', - '$LAUNCHDIR/build_info' - Copy('$TARGET', '$SOURCE')) +env = Environment( + LAUNCHDIR = GetLaunchDir(), +) +env.Command('directory_build_info', + '$LAUNCHDIR/build_info' + Copy('$TARGET', '$SOURCE')) </sconstruct> <para> diff --git a/doc/user/nodes.xml b/doc/user/nodes.xml index 9b5a7d6..78f15e3 100644 --- a/doc/user/nodes.xml +++ b/doc/user/nodes.xml @@ -80,8 +80,8 @@ </para> <sconstruct> - Object('hello.c', CCFLAGS='-DHELLO') - Object('goodbye.c', CCFLAGS='-DGOODBYE') +Object('hello.c', CCFLAGS='-DHELLO') +Object('goodbye.c', CCFLAGS='-DGOODBYE') </sconstruct> <para> @@ -95,9 +95,9 @@ </para> <sconstruct> - Object('hello.c', CCFLAGS='-DHELLO') - Object('goodbye.c', CCFLAGS='-DGOODBYE') - Program(['hello.o', 'goodbye.o']) +Object('hello.c', CCFLAGS='-DHELLO') +Object('goodbye.c', CCFLAGS='-DGOODBYE') +Program(['hello.o', 'goodbye.o']) </sconstruct> <para> @@ -123,15 +123,15 @@ <scons_example name="nodes_ex1"> <file name="SConstruct" printme="1"> - hello_list = Object('hello.c', CCFLAGS='-DHELLO') - goodbye_list = Object('goodbye.c', CCFLAGS='-DGOODBYE') - Program(hello_list + goodbye_list) +hello_list = Object('hello.c', CCFLAGS='-DHELLO') +goodbye_list = Object('goodbye.c', CCFLAGS='-DGOODBYE') +Program(hello_list + goodbye_list) </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> <file name="goodbye.c"> - int main() { printf("Goodbye, world!\n"); } +int main() { printf("Goodbye, world!\n"); } </file> </scons_example> @@ -229,7 +229,7 @@ </para> <sconstruct> - xyzzy = Entry('xyzzy') +xyzzy = Entry('xyzzy') </sconstruct> <para> @@ -263,13 +263,13 @@ <scons_example name="nodes_print"> <file name="SConstruct" printme="1"> - object_list = Object('hello.c') - program_list = Program(object_list) - print "The object file is:", object_list[0] - print "The program file is:", program_list[0] +object_list = Object('hello.c') +program_list = Program(object_list) +print "The object file is:", object_list[0] +print "The program file is:", program_list[0] </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -330,14 +330,14 @@ <scons_example name="nodes_exists"> <file name="SConstruct" printme="1"> - import os.path - program_list = Program('hello.c') - program_name = str(program_list[0]) - if not os.path.exists(program_name): - print program_name, "does not exist!" +import os.path +program_list = Program('hello.c') +program_name = str(program_list[0]) +if not os.path.exists(program_name): + print program_name, "does not exist!" </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -372,9 +372,9 @@ <scons_example name="nodes_GetBuildPath"> <file name="SConstruct" printme="1"> - env=Environment(VAR="value") - n=File("foo.c") - print env.GetBuildPath([n, "sub/dir/$VAR"]) +env=Environment(VAR="value") +n=File("foo.c") +print env.GetBuildPath([n, "sub/dir/$VAR"]) </file> </scons_example> @@ -412,13 +412,13 @@ <scons_example name="nodes_read"> <file name="SConstruct" printme="1"> - hello_c = File('hello.c') - contents = hello_c.read() - print "contents are:" - print contents +hello_c = File('hello.c') +contents = hello_c.read() +print "contents are:" +print contents </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> diff --git a/doc/user/output.xml b/doc/user/output.xml index d601e72..de6b8d4 100644 --- a/doc/user/output.xml +++ b/doc/user/output.xml @@ -74,10 +74,10 @@ <scons_example name="output_ex1"> <file name="SConstruct" printme="1"> - Help(""" - Type: 'scons program' to build the production program, - 'scons debug' to build the debug version. - """) +Help(""" +Type: 'scons program' to build the production program, + 'scons debug' to build the debug version. +""") </file> </scons_example> @@ -214,12 +214,12 @@ <scons_example name="output_COMSTR"> <file name="SConstruct" printme="1"> - env = Environment(CCCOMSTR = "Compiling $TARGET", - LINKCOMSTR = "Linking $TARGET") - env.Program('foo.c') +env = Environment(CCCOMSTR = "Compiling $TARGET", + LINKCOMSTR = "Linking $TARGET") +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -238,9 +238,9 @@ --> <screen> - % <userinput>scons -Q</userinput> - Compiling foo.o - Linking foo +% <userinput>scons -Q</userinput> +Compiling foo.o +Linking foo </screen> <para> @@ -286,14 +286,14 @@ <scons_example name="output_COMSTR-VERBOSE"> <file name="SConstruct" printme="1"> - env = Environment() - if ARGUMENTS.get('VERBOSE') != "1': - env['CCCOMSTR'] = "Compiling $TARGET" - env['LINKCOMSTR'] = "Linking $TARGET" - env.Program('foo.c') +env = Environment() +if ARGUMENTS.get('VERBOSE') != "1': + env['CCCOMSTR'] = "Compiling $TARGET" + env['LINKCOMSTR'] = "Linking $TARGET" +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -322,15 +322,15 @@ --> <screen> - % <userinput>scons -Q</userinput> - Compiling foo.o - Linking foo - % <userinput>scons -Q -c</userinput> - Removed foo.o - Removed foo - % <userinput>scons -Q VERBOSE=1</userinput> - cc -o foo.o -c foo.c - cc -o foo foo.o +% <userinput>scons -Q</userinput> +Compiling foo.o +Linking foo +% <userinput>scons -Q -c</userinput> +Removed foo.o +Removed foo +% <userinput>scons -Q VERBOSE=1</userinput> +cc -o foo.o -c foo.c +cc -o foo foo.o </screen> </section> @@ -372,15 +372,15 @@ <scons_example name="output_Progress-TARGET"> <file name="SConstruct" printme="1"> - Progress('Evaluating $TARGET\n') - Program('f1.c') - Program('f2.c') +Progress('Evaluating $TARGET\n') +Program('f1.c') +Program('f2.c') </file> <file name="f1.c"> - f1.c +f1.c </file> <file name="f2.c"> - f2.c +f2.c </file> </scons_example> @@ -425,11 +425,11 @@ </para> <sconstruct> - Progress('$TARGET\r', - file=open('/dev/tty', 'w'), - overwrite=True) - Program('f1.c') - Program('f2.c') +Progress('$TARGET\r', + file=open('/dev/tty', 'w'), + overwrite=True) +Program('f1.c') +Program('f2.c') </sconstruct> <para> @@ -482,9 +482,9 @@ </para> <sconstruct> - Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5) - Program('f1.c') - Program('f2.c') +Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5) +Program('f1.c') +Program('f2.c') </sconstruct> <para> diff --git a/doc/user/parseconfig.xml b/doc/user/parseconfig.xml index cf3531b..6125812 100644 --- a/doc/user/parseconfig.xml +++ b/doc/user/parseconfig.xml @@ -84,10 +84,10 @@ <scons_example name="parseconfig_ex1"> <file name="SConstruct" printme="1"> - env = Environment() - env['CPPPATH'] = ['/lib/compat'] - env.ParseConfig("pkg-config x11 --cflags --libs") - print env['CPPPATH'] +env = Environment() +env['CPPPATH'] = ['/lib/compat'] +env.ParseConfig("pkg-config x11 --cflags --libs") +print env['CPPPATH'] </file> </scons_example> @@ -111,9 +111,9 @@ --> <screen> - % <userinput>scons -Q</userinput> - ['/lib/compat', '/usr/X11/include'] - scons: `.' is up to date. +% <userinput>scons -Q</userinput> +['/lib/compat', '/usr/X11/include'] +scons: `.' is up to date. </screen> <para> @@ -136,10 +136,10 @@ <scons_example name="parseconfig_ex2"> <file name="SConstruct" printme="1"> - env = Environment() - env.ParseConfig("pkg-config x11 --cflags --libs") - env.ParseConfig("pkg-config x11 --cflags --libs") - print env['CPPPATH'] +env = Environment() +env.ParseConfig("pkg-config x11 --cflags --libs") +env.ParseConfig("pkg-config x11 --cflags --libs") +print env['CPPPATH'] </file> </scons_example> @@ -155,9 +155,9 @@ --> <screen> - % <userinput>scons -Q</userinput> - ['/usr/X11/include'] - scons: `.' is up to date. +% <userinput>scons -Q</userinput> +['/usr/X11/include'] +scons: `.' is up to date. </screen> </section> diff --git a/doc/user/parseflags.xml b/doc/user/parseflags.xml index d20df80..a3462a5 100644 --- a/doc/user/parseflags.xml +++ b/doc/user/parseflags.xml @@ -80,16 +80,16 @@ <scons_example name="parseflags_ex1"> <file name="SConstruct" printme="1"> - env = Environment() - d = env.ParseFlags("-I/opt/include -L/opt/lib -lfoo") - for k,v in sorted(d.items()): - if v: - print k, v - env.MergeFlags(d) - env.Program('f1.c') +env = Environment() +d = env.ParseFlags("-I/opt/include -L/opt/lib -lfoo") +for k,v in sorted(d.items()): + if v: + print k, v +env.MergeFlags(d) +env.Program('f1.c') </file> <file name="f1.c"> - int main() { return 0; } +int main() { return 0; } </file> </scons_example> @@ -119,16 +119,16 @@ <scons_example name="parseflags_ex2"> <file name="SConstruct" printme="1"> - env = Environment() - d = env.ParseFlags("-whatever") - for k,v in sorted(d.items()): - if v: - print k, v - env.MergeFlags(d) - env.Program('f1.c') +env = Environment() +d = env.ParseFlags("-whatever") +for k,v in sorted(d.items()): + if v: + print k, v +env.MergeFlags(d) +env.Program('f1.c') </file> <file name="f1.c"> - int main() { return 0; } + int main() { return 0; } </file> </scons_example> @@ -145,16 +145,16 @@ <scons_example name="parseflags_ex3"> <file name="SConstruct" printme="1"> - env = Environment() - d = env.ParseFlags(["-I/opt/include", ["-L/opt/lib", "-lfoo"]]) - for k,v in sorted(d.items()): - if v: - print k, v - env.MergeFlags(d) - env.Program('f1.c') +env = Environment() +d = env.ParseFlags(["-I/opt/include", ["-L/opt/lib", "-lfoo"]]) +for k,v in sorted(d.items()): + if v: + print k, v +env.MergeFlags(d) +env.Program('f1.c') </file> <file name="f1.c"> - int main() { return 0; } +int main() { return 0; } </file> </scons_example> @@ -172,16 +172,16 @@ <scons_example name="parseflags_ex4"> <file name="SConstruct" printme="1"> - env = Environment() - d = env.ParseFlags(["!echo -I/opt/include", "!echo -L/opt/lib", "-lfoo"]) - for k,v in sorted(d.items()): - if v: - print k, v - env.MergeFlags(d) - env.Program('f1.c') +env = Environment() +d = env.ParseFlags(["!echo -I/opt/include", "!echo -L/opt/lib", "-lfoo"]) +for k,v in sorted(d.items()): + if v: + print k, v +env.MergeFlags(d) +env.Program('f1.c') </file> <file name="f1.c"> - int main() { return 0; } +int main() { return 0; } </file> </scons_example> diff --git a/doc/user/repositories.xml b/doc/user/repositories.xml index 8e8ba4e..4ff8b93 100644 --- a/doc/user/repositories.xml +++ b/doc/user/repositories.xml @@ -96,12 +96,12 @@ <scons_example name="repositories_ex1"> <file name="SConstruct" printme="1"> - env = Environment() - env.Program('hello.c') - Repository('__ROOT__/usr/repository1', '__ROOT__/usr/repository2') +env = Environment() +env.Program('hello.c') +Repository('__ROOT__/usr/repository1', '__ROOT__/usr/repository2') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -165,12 +165,12 @@ <scons_example name="repositories_ex2"> <file name="SConstruct"> - env = Environment() - env.Program('hello.c') - Repository('__ROOT__/usr/repository1', '__ROOT__/usr/repository2') +env = Environment() +env.Program('hello.c') +Repository('__ROOT__/usr/repository1', '__ROOT__/usr/repository2') </file> <file name="__ROOT__/usr/repository1/hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -188,12 +188,12 @@ <scons_example name="repositories_ex3"> <file name="SConstruct"> - env = Environment() - env.Program('hello.c') - Repository('__ROOT__/usr/repository1', '__ROOT__/usr/repository2') +env = Environment() +env.Program('hello.c') +Repository('__ROOT__/usr/repository1', '__ROOT__/usr/repository2') </file> <file name="__ROOT__/usr/repository2/hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -238,9 +238,9 @@ </para> <screen> - % <userinput>scons -Q</userinput> - cc -o hello.o -c hello.c - hello.c:1: hello.h: No such file or directory +% <userinput>scons -Q</userinput> +cc -o hello.o -c hello.c +hello.c:1: hello.h: No such file or directory </screen> <para> @@ -256,12 +256,12 @@ <scons_example name="repositories_CPPPATH"> <file name="SConstruct" printme="1"> - env = Environment(CPPPATH = ['.']) - env.Program('hello.c') - Repository('__ROOT__/usr/repository1') +env = Environment(CPPPATH = ['.']) +env.Program('hello.c') +Repository('__ROOT__/usr/repository1') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -292,12 +292,12 @@ <scons_example name="repositories_CPPPATH3"> <file name="SConstruct" printme="1"> - env = Environment(CPPPATH = ['dir1', 'dir2', 'dir3']) - env.Program('hello.c') - Repository('__ROOT__/r1', '__ROOT__/r2') +env = Environment(CPPPATH = ['dir1', 'dir2', 'dir3']) +env.Program('hello.c') +Repository('__ROOT__/r1', '__ROOT__/r2') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -355,13 +355,13 @@ coming into existence.) </para> <programlisting> - #include "hello.h" - int - main(int argc, char *argv[]) - { - printf(HELLO_MESSAGE); - return (0); - } +#include "hello.h" +int +main(int argc, char *argv[]) +{ + printf(HELLO_MESSAGE); + return (0); +} </programlisting> <para> @@ -376,12 +376,12 @@ coming into existence.) <scons_example name="repositories_quote1"> <file name="SConstruct"> - env = Environment(CPPPATH = ['.']) - env.Program('hello.c') - Repository('__ROOT__/usr/repository1') +env = Environment(CPPPATH = ['.']) +env.Program('hello.c') +Repository('__ROOT__/usr/repository1') </file> <file name="__ROOT__/usr/repository1/hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -471,7 +471,7 @@ coming into existence.) </para> <screen> - % <userinput>scons -Q -Y /usr/repository1 -Y /usr/repository2</userinput> +% <userinput>scons -Q -Y /usr/repository1 -Y /usr/repository2</userinput> </screen> <para> @@ -515,18 +515,18 @@ coming into existence.) <scons_example name="repositories_ex4"> <file name="SConstruct"> - env = Environment() - env.Program(['hello.c', 'file1.c', 'file2.c']) - Repository('/usr/repository1', '/usr/repository2') +env = Environment() +env.Program(['hello.c', 'file1.c', 'file2.c']) +Repository('/usr/repository1', '/usr/repository2') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> <file name="file1.c"> - int f1() { printf("file1\n"); } +int f1() { printf("file1\n"); } </file> <file name="file2.c"> - int f2() { printf("file2.c\n"); } +int f2() { printf("file2.c\n"); } </file> </scons_example> @@ -563,11 +563,11 @@ coming into existence.) </scons_output> --> <screen> - % <userinput>cd $HOME/build</userinput> - % <userinput>edit hello.c</userinput> - % <userinput>scons -Q -Y /usr/repository1</userinput> - cc -c -o hello.o hello.c - cc -o hello hello.o /usr/repository1/file1.o /usr/repository1/file2.o +% <userinput>cd $HOME/build</userinput> +% <userinput>edit hello.c</userinput> +% <userinput>scons -Q -Y /usr/repository1</userinput> +cc -c -o hello.o hello.c +cc -o hello hello.o /usr/repository1/file1.o /usr/repository1/file2.o </screen> <para> @@ -594,10 +594,10 @@ coming into existence.) </para> <screen> - % <userinput>mkdir $HOME/build2</userinput> - % <userinput>cd $HOME/build2</userinput> - % <userinput>scons -Q -Y /usr/all/repository hello</userinput> - scons: `hello' is up-to-date. +% <userinput>mkdir $HOME/build2</userinput> +% <userinput>cd $HOME/build2</userinput> +% <userinput>scons -Q -Y /usr/all/repository hello</userinput> +scons: `hello' is up-to-date. </screen> <para> @@ -627,12 +627,12 @@ coming into existence.) <scons_example name="repositories_ex5"> <file name="SConstruct" printme="1"> - env = Environment() - hello = env.Program('hello.c') - Local(hello) +env = Environment() +hello = env.Program('hello.c') +Local(hello) </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -646,9 +646,9 @@ coming into existence.) </para> <screen> - % <userinput>scons -Y /usr/all/repository hello</userinput> - Local copy of hello from /usr/all/repository/hello - scons: `hello' is up-to-date. +% <userinput>scons -Y /usr/all/repository hello</userinput> +Local copy of hello from /usr/all/repository/hello +scons: `hello' is up-to-date. </screen> <para> diff --git a/doc/user/scanners.xml b/doc/user/scanners.xml index 46b2a9f..5ed0d62 100644 --- a/doc/user/scanners.xml +++ b/doc/user/scanners.xml @@ -172,7 +172,7 @@ over the file scanning rather than being called for each input line: </para> <programlisting> - include filename.foo +include filename.foo </programlisting> <para> @@ -186,13 +186,13 @@ over the file scanning rather than being called for each input line: </para> <programlisting> - import re - - include_re = re.compile(r'^include\s+(\S+)$', re.M) - - def kfile_scan(node, env, path, arg): - contents = node.get_text_contents() - return env.File(include_re.findall(contents)) +import re + +include_re = re.compile(r'^include\s+(\S+)$', re.M) + +def kfile_scan(node, env, path, arg): + contents = node.get_text_contents() + return env.File(include_re.findall(contents)) </programlisting> <para> @@ -295,9 +295,9 @@ over the file scanning rather than being called for each input line: </para> <programlisting> - kscan = Scanner(function = kfile_scan, - skeys = ['.k']) - env.Append(SCANNERS = kscan) +kscan = Scanner(function = kfile_scan, + skeys = ['.k']) +env.Append(SCANNERS = kscan) </programlisting> <para> @@ -393,9 +393,9 @@ over the file scanning rather than being called for each input line: <scons_example name="scanners_findpathdirs"> <file name="SConstruct" printme="1"> - kscan = Scanner(function = kfile_scan, - skeys = ['.k'], - path=FindPathDirs('KPATH')) +kscan = Scanner(function = kfile_scan, + skeys = ['.k'], + path=FindPathDirs('KPATH')) </file> </scons_example> diff --git a/doc/user/sconf.xml b/doc/user/sconf.xml index 92fb454..e787db9 100644 --- a/doc/user/sconf.xml +++ b/doc/user/sconf.xml @@ -80,10 +80,10 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env) - # Checks for libraries, header files, etc. go here! - env = conf.Finish() +env = Environment() +conf = Configure(env) +# Checks for libraries, header files, etc. go here! +env = conf.Finish() </sconstruct> <para> @@ -131,14 +131,14 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env) - if not conf.CheckCHeader('math.h'): - print 'Math.h must be installed!' - Exit(1) - if conf.CheckCHeader('foo.h'): - conf.env.Append('-DHAS_FOO_H') - env = conf.Finish() +env = Environment() +conf = Configure(env) +if not conf.CheckCHeader('math.h'): + print 'Math.h must be installed!' + Exit(1) +if conf.CheckCHeader('foo.h'): + conf.env.Append('-DHAS_FOO_H') +env = conf.Finish() </sconstruct> <para> @@ -159,12 +159,12 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env) - if not conf.CheckCXXHeader('vector.h'): - print 'vector.h must be installed!' - Exit(1) - env = conf.Finish() +env = Environment() +conf = Configure(env) +if not conf.CheckCXXHeader('vector.h'): + print 'vector.h must be installed!' + Exit(1) +env = conf.Finish() </sconstruct> </section> @@ -180,12 +180,12 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env) - if not conf.CheckFunc('strcpy'): - print 'Did not find strcpy(), using local version' - conf.env.Append(CPPDEFINES = '-Dstrcpy=my_local_strcpy') - env = conf.Finish() +env = Environment() +conf = Configure(env) +if not conf.CheckFunc('strcpy'): + print 'Did not find strcpy(), using local version' + conf.env.Append(CPPDEFINES = '-Dstrcpy=my_local_strcpy') +env = conf.Finish() </sconstruct> </section> @@ -204,12 +204,12 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env) - if not conf.CheckLib('m'): - print 'Did not find libm.a or m.lib, exiting!' - Exit(1) - env = conf.Finish() +env = Environment() +conf = Configure(env) +if not conf.CheckLib('m'): + print 'Did not find libm.a or m.lib, exiting!' + Exit(1) +env = conf.Finish() </sconstruct> <para> @@ -225,12 +225,12 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env) - if not conf.CheckLibWithHeader('m', 'math.h', 'c'): - print 'Did not find libm.a or m.lib, exiting!' - Exit(1) - env = conf.Finish() +env = Environment() +conf = Configure(env) +if not conf.CheckLibWithHeader('m', 'math.h', 'c'): + print 'Did not find libm.a or m.lib, exiting!' + Exit(1) +env = conf.Finish() </sconstruct> <para> @@ -254,12 +254,12 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env) - if not conf.CheckType('off_t'): - print 'Did not find off_t typedef, assuming int' - conf.env.Append(CCFLAGS = '-Doff_t=int') - env = conf.Finish() +env = Environment() +conf = Configure(env) +if not conf.CheckType('off_t'): + print 'Did not find off_t typedef, assuming int' + conf.env.Append(CCFLAGS = '-Doff_t=int') +env = conf.Finish() </sconstruct> <para> @@ -273,12 +273,12 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env) - if not conf.CheckType('off_t', '#include &lt;sys/types.h&gt;\n'): - print 'Did not find off_t typedef, assuming int' - conf.env.Append(CCFLAGS = '-Doff_t=int') - env = conf.Finish() +env = Environment() +conf = Configure(env) +if not conf.CheckType('off_t', '#include &lt;sys/types.h&gt;\n'): + print 'Did not find off_t typedef, assuming int' + conf.env.Append(CCFLAGS = '-Doff_t=int') +env = conf.Finish() </sconstruct> </section> @@ -358,8 +358,8 @@ </para> <sconstruct> - env = Environment() - conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary}) +env = Environment() +conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary}) </sconstruct> <para> @@ -414,10 +414,10 @@ </para> <screen> - % <userinput>scons</userinput> - scons: Reading SConscript file ... - Checking for MyLibrary... failed - MyLibrary is not installed! +% <userinput>scons</userinput> +scons: Reading SConscript file ... +Checking for MyLibrary... failed +MyLibrary is not installed! </screen> <para> @@ -428,14 +428,14 @@ </para> <screen> - % <userinput>scons</userinput> - scons: Reading SConscript file ... - Checking for MyLibrary... failed - scons: done reading SConscript - scons: Building targets ... - . - . - . +% <userinput>scons</userinput> +scons: Reading SConscript file ... +Checking for MyLibrary... failed +scons: done reading SConscript +scons: Building targets ... + . + . + . </screen> </section> @@ -455,10 +455,10 @@ </para> <screen> - % <userinput>scons -Q -c</userinput> - Checking for MyLibrary... yes - Removed foo.o - Removed foo +% <userinput>scons -Q -c</userinput> +Checking for MyLibrary... yes +Removed foo.o +Removed foo </screen> <para> @@ -474,19 +474,19 @@ </para> <sconstruct> - env = Environment() - if not env.GetOption('clean'): - conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary}) - if not conf.CheckMyLibrary(): - print 'MyLibrary is not installed!' - Exit(1) - env = conf.Finish() +env = Environment() +if not env.GetOption('clean'): + conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary}) + if not conf.CheckMyLibrary(): + print 'MyLibrary is not installed!' + Exit(1) + env = conf.Finish() </sconstruct> <screen> - % <userinput>scons -Q -c</userinput> - Removed foo.o - Removed foo +% <userinput>scons -Q -c</userinput> +Removed foo.o +Removed foo </screen> </section> diff --git a/doc/user/separate.xml b/doc/user/separate.xml index dfe83f6..0a2e0db 100644 --- a/doc/user/separate.xml +++ b/doc/user/separate.xml @@ -174,14 +174,14 @@ program using the F<build/foo.c> path name. <scons_example name="separate_ex1"> <file name="SConstruct" printme="1"> - SConscript('src/SConscript', variant_dir='build') +SConscript('src/SConscript', variant_dir='build') </file> <file name="src/SConscript"> - env = Environment() - env.Program('hello.c') +env = Environment() +env.Program('hello.c') </file> <file name="src/hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -267,7 +267,7 @@ program using the F<build/foo.c> path name. </para> <sconstruct> - #include "file.h" +#include "file.h" </sconstruct> <para> @@ -320,7 +320,7 @@ program using the F<build/foo.c> path name. </para> <sconstruct> - SConscript('src/SConscript', variant_dir='build', duplicate=0) +SConscript('src/SConscript', variant_dir='build', duplicate=0) </sconstruct> <para> @@ -334,15 +334,15 @@ program using the F<build/foo.c> path name. </para> <screen> - % <userinput>ls src</userinput> - SConscript - hello.c - % <userinput>scons -Q</userinput> - cc -c src/hello.c -o build/hello.o - cc -o build/hello build/hello.o - % <userinput>ls build</userinput> - hello - hello.o +% <userinput>ls src</userinput> +SConscript +hello.c +% <userinput>scons -Q</userinput> +cc -c src/hello.c -o build/hello.o +cc -o build/hello build/hello.o +% <userinput>ls build</userinput> +hello +hello.o </screen> </section> @@ -360,12 +360,12 @@ program using the F<build/foo.c> path name. <scons_example name="separate_builddir"> <file name="SConstruct" printme="1"> - VariantDir('build', 'src') - env = Environment() - env.Program('build/hello.c') +VariantDir('build', 'src') +env = Environment() +env.Program('build/hello.c') </file> <file name="src/hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -404,12 +404,12 @@ program using the F<build/foo.c> path name. <scons_example name="separate_duplicate0"> <file name="SConstruct" printme="1"> - VariantDir('build', 'src', duplicate=0) - env = Environment() - env.Program('build/hello.c') +VariantDir('build', 'src', duplicate=0) +env = Environment() +env.Program('build/hello.c') </file> <file name="src/hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -444,15 +444,15 @@ program using the F<build/foo.c> path name. <scons_example name="separate_builddir_sconscript"> <file name="SConstruct"> - VariantDir('build', 'src') - SConscript('build/SConscript') +VariantDir('build', 'src') +SConscript('build/SConscript') </file> <file name="src/SConscript" printme="1"> - env = Environment() - env.Program('hello.c') +env = Environment() +env.Program('hello.c') </file> <file name="src/hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -502,22 +502,22 @@ program using the F<build/foo.c> path name. <scons_example name="separate_glob_builddir_sconscript"> <file name="SConstruct"> - VariantDir('build', 'src') - SConscript('build/SConscript') +VariantDir('build', 'src') +SConscript('build/SConscript') </file> <file name="src/SConscript" printme="1"> - env = Environment() - env.Program('hello', Glob('*.c')) +env = Environment() +env.Program('hello', Glob('*.c')) </file> <file name="src/f1.c"> - #include "f2.h" - int main() { printf(f2()); } +#include "f2.h" +int main() { printf(f2()); } </file> <file name="src/f2.c"> - const char * f2() { return("Hello, world!\n"); } +const char * f2() { return("Hello, world!\n"); } </file> <file name="src/f2.h"> - const char * f2(); +const char * f2(); </file> </scons_example> diff --git a/doc/user/sideeffect.xml b/doc/user/sideeffect.xml index c0c7eca..cf959af 100644 --- a/doc/user/sideeffect.xml +++ b/doc/user/sideeffect.xml @@ -77,12 +77,12 @@ <scons_example name="sideeffect_simple"> <file name="SConstruct" printme="1"> - env = Environment() - f2 = env.Command('file2', 'log', Copy('$TARGET', '$SOURCE')) - f1 = env.Command('file1', [], - 'echo >$TARGET data1; echo >log updated file1')) - env.SideEffect('log', env.Command('file1', [], - 'echo >$TARGET data1; echo >log updated file1')) +env = Environment() +f2 = env.Command('file2', 'log', Copy('$TARGET', '$SOURCE')) +f1 = env.Command('file1', [], + 'echo >$TARGET data1; echo >log updated file1')) +env.SideEffect('log', env.Command('file1', [], + 'echo >$TARGET data1; echo >log updated file1')) </file> </scons_example> @@ -114,11 +114,11 @@ </para> <screen> - env = Environment() - env.Command('file1.out', 'file.in', - './build --log logfile.txt $SOURCE $TARGET') - env.Command('file2.out', 'file.in', - './build --log logfile.txt $SOURCE $TARGET') +env = Environment() +env.Command('file1.out', 'file.in', + './build --log logfile.txt $SOURCE $TARGET') +env.Command('file2.out', 'file.in', + './build --log logfile.txt $SOURCE $TARGET') </screen> <para> @@ -155,17 +155,17 @@ <scons_example name="sideeffect_shared"> <file name="SConstruct" printme="1"> - env = Environment() - f1 = env.Command('file1.out', 'file1.in', - './build --log logfile.txt $SOURCE $TARGET') - f2 = env.Command('file2.out', 'file2.in', - './build --log logfile.txt $SOURCE $TARGET') - env.SideEffect('logfile.txt', f1 + f2) +env = Environment() +f1 = env.Command('file1.out', 'file1.in', + './build --log logfile.txt $SOURCE $TARGET') +f2 = env.Command('file2.out', 'file2.in', + './build --log logfile.txt $SOURCE $TARGET') +env.SideEffect('logfile.txt', f1 + f2) </file> <file name="file1.in">file1.in</file> <file name="file2.in">file2.in</file> <file name="build" chmod="0755"> - cat +cat </file> </scons_example> @@ -199,11 +199,11 @@ <scons_example name="sideeffect_parallel"> <file name="SConstruct" printme="1"> - env = Environment() - f1 = env.Command('file1.out', [], 'echo >$TARGET data1') - env.SideEffect('not_really_updated', f1) - f2 = env.Command('file2.out', [], 'echo >$TARGET data2') - env.SideEffect('not_really_updated', f2) +env = Environment() +f1 = env.Command('file1.out', [], 'echo >$TARGET data1') +env.SideEffect('not_really_updated', f1) +f2 = env.Command('file2.out', [], 'echo >$TARGET data2') +env.SideEffect('not_really_updated', f2) </file> </scons_example> diff --git a/doc/user/simple.xml b/doc/user/simple.xml index 0e67e1e..33b9e27 100644 --- a/doc/user/simple.xml +++ b/doc/user/simple.xml @@ -66,11 +66,11 @@ </para> <programlisting> - int - main() - { - printf("Hello, world!\n"); - } +int +main() +{ + printf("Hello, world!\n"); +} </programlisting> <para> @@ -82,10 +82,10 @@ <scons_example name="simple_ex1"> <file name="SConstruct" printme="1"> - Program('hello.c') +Program('hello.c') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -179,10 +179,10 @@ <scons_example name="simple_Object"> <file name="SConstruct" printme="1"> - Object('hello.c') +Object('hello.c') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -228,16 +228,16 @@ <scons_example name="simple_java"> <file name="SConstruct" printme="1"> - Java('classes', 'src') +Java('classes', 'src') </file> <file name="src/hello.java"> - public class Example1 - { - public static void main(String[] args) - { - System.out.println("Hello Java world!\n"); - } - } +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} </file> </scons_example> @@ -285,10 +285,10 @@ <scons_example name="simple_clean"> <file name="SConstruct"> - Program('hello.c') +Program('hello.c') </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> </scons_example> @@ -358,8 +358,8 @@ </para> <programlisting> - # Arrange to build the "hello" program. - Program('hello.c') # "hello.c" is the source file. +# Arrange to build the "hello" program. +Program('hello.c') # "hello.c" is the source file. </programlisting> <para> @@ -442,17 +442,17 @@ <scons_example name="simple_declarative"> <file name="SConstruct" printme="1"> - print "Calling Program('hello.c')" - Program('hello.c') - print "Calling Program('goodbye.c')" - Program('goodbye.c') - print "Finished calling Program()" +print "Calling Program('hello.c')" +Program('hello.c') +print "Calling Program('goodbye.c')" +Program('goodbye.c') +print "Finished calling Program()" </file> <file name="hello.c"> - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } </file> <file name="goodbye.c"> - int main() { printf("Goodbye, world!\n"); } +int main() { printf("Goodbye, world!\n"); } </file> </scons_example> diff --git a/doc/user/sourcecode.xml b/doc/user/sourcecode.xml index 2225882..c6d645f 100644 --- a/doc/user/sourcecode.xml +++ b/doc/user/sourcecode.xml @@ -65,12 +65,12 @@ <scons_example name="sourcecode_bitkeeper"> <file name="SConstruct" printme="1"> - env = Environment() - env.SourceCode('.', env.BitKeeper()) - env.Program('hello.c') +env = Environment() +env.SourceCode('.', env.BitKeeper()) +env.Program('hello.c') </file> <file name="s.hello.c"> - s.hello.c +s.hello.c </file> </scons_example> @@ -91,9 +91,9 @@ <scons_example name="sourcecode_cvs"> <file name="SConstruct" printme="1"> - env = Environment() - env.SourceCode('.', env.CVS('/usr/local/CVS')) - env.Program('hello.c') +env = Environment() +env.SourceCode('.', env.CVS('/usr/local/CVS')) +env.Program('hello.c') </file> </scons_example> @@ -114,12 +114,12 @@ <scons_example name="sourcecode_rcs"> <file name="SConstruct" printme="1"> - env = Environment() - env.SourceCode('.', env.RCS()) - env.Program('hello.c') +env = Environment() +env.SourceCode('.', env.RCS()) +env.Program('hello.c') </file> <file name="hello.c,v"> - hello.c,v +hello.c,v </file> </scons_example> @@ -140,12 +140,12 @@ <scons_example name="sourcecode_sccs"> <file name="SConstruct" printme="1"> - env = Environment() - env.SourceCode('.', env.SCCS()) - env.Program('hello.c') +env = Environment() +env.SourceCode('.', env.SCCS()) +env.Program('hello.c') </file> <file name="s.hello.c"> - s.hello.c +s.hello.c </file> </scons_example> @@ -168,9 +168,9 @@ <scons_example name="sourcecode_subversion"> <file name="SConstruct" printme="1"> - env = Environment() - env.SourceCode('.', env.Subversion('XXX')) - env.Program('hello.c') +env = Environment() +env.SourceCode('.', env.Subversion('XXX')) +env.Program('hello.c') </file> </scons_example> diff --git a/doc/user/troubleshoot.xml b/doc/user/troubleshoot.xml index 076c054..94af727 100644 --- a/doc/user/troubleshoot.xml +++ b/doc/user/troubleshoot.xml @@ -92,12 +92,12 @@ <scons_example name="troubleshoot_explain1"> <file name="SConstruct" printme="1"> - # Intentionally misspell the output file name in the - # command used to create the file: - Command('file.out', 'file.in', 'cp $SOURCE file.oout') +# Intentionally misspell the output file name in the +# command used to create the file: +Command('file.out', 'file.in', 'cp $SOURCE file.oout') </file> <file name="file.in"> - file.in +file.in </file> </scons_example> @@ -174,16 +174,16 @@ <scons_example name="troubleshoot_explain2"> <file name="SConstruct"> - Program('prog', ['file1.c', 'file2.c', 'file3.c']) +Program('prog', ['file1.c', 'file2.c', 'file3.c']) </file> <file name="file1.c"> - file1.c +file1.c </file> <file name="file2.c"> - file2.c +file2.c </file> <file name="file3.c"> - file3.c +file3.c </file> </scons_example> @@ -212,21 +212,21 @@ <scons_example name="troubleshoot_explain3"> <file name="SConstruct"> - Program('prog', ['file1.c', 'file2.c', 'file3.c'], CPPPATH='.') +Program('prog', ['file1.c', 'file2.c', 'file3.c'], CPPPATH='.') </file> <file name="file1.c"> - #include <hello.h> - file1.c +#include <hello.h> +file1.c </file> <file name="file2.c"> - file2.c +file2.c </file> <file name="file3.c"> - #include <hello.h> - file3.c +#include <hello.h> +file3.c </file> <file name="hello.h"> - #define string "world" +#define string "world" </file> </scons_example> @@ -278,8 +278,8 @@ <scons_example name="troubleshoot_Dump"> <file name="SConstruct" printme="1"> - env = Environment() - print env.Dump() +env = Environment() +print env.Dump() </file> </scons_example> @@ -338,8 +338,8 @@ <scons_example name="troubleshoot_Dump_ENV"> <file name="SConstruct" printme="1"> - env = Environment() - print env.Dump('ENV') +env = Environment() +print env.Dump('ENV') </file> </scons_example> @@ -391,20 +391,20 @@ <scons_example name="troubleshoot_tree1"> <file name="SConstruct" printme="1"> - env = Environment(CPPPATH = ['.']) - env.Program('prog', ['f1.c', 'f2.c', 'f3.c']) +env = Environment(CPPPATH = ['.']) +env.Program('prog', ['f1.c', 'f2.c', 'f3.c']) </file> <file name="f1.c"> - #include "inc.h" +#include "inc.h" </file> <file name="f2.c"> - #include "inc.h" +#include "inc.h" </file> <file name="f3.c"> - #include "inc.h" +#include "inc.h" </file> <file name="inc.h"> - inc.h +inc.h </file> </scons_example> @@ -523,30 +523,30 @@ <scons_example name="troubleshoot_tree2"> <file name="SConstruct" printme="1"> - env = Environment(CPPPATH = ['.'], - LIBS = ['foo'], - LIBPATH = ['.']) - env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) - env.Program('prog1.c') - env.Program('prog2.c') +env = Environment(CPPPATH = ['.'], + LIBS = ['foo'], + LIBPATH = ['.']) +env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) +env.Program('prog1.c') +env.Program('prog2.c') </file> <file name="prog1.c"> - #include "inc.h" +#include "inc.h" </file> <file name="prog2.c"> - #include "inc.h" +#include "inc.h" </file> <file name="f1.c"> - #include "inc.h" +#include "inc.h" </file> <file name="f2.c"> - #include "inc.h" +#include "inc.h" </file> <file name="f3.c"> - #include "inc.h" +#include "inc.h" </file> <file name="inc.h"> - inc.h +inc.h </file> </scons_example> @@ -609,11 +609,11 @@ <scons_example name="troubleshoot_presub"> <file name="SConstruct"> - env = Environment(CPPPATH = ['.']) - env.Program('prog', 'prog.c') +env = Environment(CPPPATH = ['.']) +env.Program('prog', 'prog.c') </file> <file name="prog.c"> - prog.c +prog.c </file> </scons_example> @@ -630,13 +630,13 @@ --> <screen> - % <userinput>scons -Q --debug=presub</userinput> - Building prog.o with action: - $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCOMCOM $SOURCES - cc -o prog.o -c -I. prog.c - Building prog with action: - $SMART_LINKCOM - cc -o prog prog.o +% <userinput>scons -Q --debug=presub</userinput> +Building prog.o with action: + $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCOMCOM $SOURCES +cc -o prog.o -c -I. prog.c +Building prog with action: + $SMART_LINKCOM +cc -o prog prog.o </screen> </section> @@ -657,17 +657,17 @@ <scons_example name="troubleshoot_findlibs"> <file name="SConstruct" printme="1"> - env = Environment(LIBPATH = ['libs1', 'libs2']) - env.Program('prog.c', LIBS=['foo', 'bar']) +env = Environment(LIBPATH = ['libs1', 'libs2']) +env.Program('prog.c', LIBS=['foo', 'bar']) </file> <file name="prog.c"> - prog.c +prog.c </file> <file name="libs1/libfoo.a"> - libs1/libfoo.a +libs1/libfoo.a </file> <file name="libs2/libbar.a"> - libs2/libbar.a +libs2/libbar.a </file> </scons_example> @@ -701,19 +701,19 @@ <scons_example name="troubleshoot_includes"> <file name="SConstruct" printme="1"> - env = Environment(CPPPATH = ['inc1', 'inc2']) - env.Program('prog.c') +env = Environment(CPPPATH = ['inc1', 'inc2']) +env.Program('prog.c') </file> <file name="prog.c"> - #include "file1.h" - #include "file2.h" - prog.c +#include "file1.h" +#include "file2.h" +prog.c </file> <file name="inc1/file1.h"> - inc1/file1.h +inc1/file1.h </file> <file name="inc2/file2.h"> - inc2/file2.h +inc2/file2.h </file> </scons_example> @@ -749,7 +749,7 @@ <scons_example name="troubleshoot_stacktrace"> <file name="SConstruct" printme="1"> - Program('prog.c') +Program('prog.c') </file> </scons_example> @@ -829,15 +829,15 @@ <scons_example name="troubleshoot_taskmastertrace"> <file name="SConstruct" printme="1"> - env = Environment(CPPPATH = ['.']) - env.Program('prog.c') +env = Environment(CPPPATH = ['.']) +env.Program('prog.c') </file> <file name="prog.c"> - #include "inc.h" - prog.c +#include "inc.h" +prog.c </file> <file name="inc.h"> - #define STRING "one" +#define STRING "one" </file> </scons_example> diff --git a/doc/user/variants.xml b/doc/user/variants.xml index 491074f..f14cf6e 100644 --- a/doc/user/variants.xml +++ b/doc/user/variants.xml @@ -159,9 +159,9 @@ is pretty smart about rebuilding things when you change options. <scons_example name="variants_ex2"> <file name="SConstruct" printme="1"> - env = Environment(OS = ARGUMENTS.get('OS')) - for os in ['newell', 'post']: - SConscript('src/SConscript', variant_dir='build/' + os) +env = Environment(OS = ARGUMENTS.get('OS')) +for os in ['newell', 'post']: + SConscript('src/SConscript', variant_dir='build/' + os) </file> </scons_example> |