diff options
author | Dirk Baechle <dl9obn@darc.de> | 2013-05-03 22:08:59 (GMT) |
---|---|---|
committer | Dirk Baechle <dl9obn@darc.de> | 2013-05-03 22:08:59 (GMT) |
commit | 9e7cf970a730549348fd22a0921ea0ed2e894a69 (patch) | |
tree | 0bbe0e399fa2f8bb9328c012c5931e0172ea4547 /doc/user/variants.xml | |
parent | e3827a98511acc0d208193920bc40d5e2724bf12 (diff) | |
download | SCons-9e7cf970a730549348fd22a0921ea0ed2e894a69.zip SCons-9e7cf970a730549348fd22a0921ea0ed2e894a69.tar.gz SCons-9e7cf970a730549348fd22a0921ea0ed2e894a69.tar.bz2 |
- removed *.in files from the user guide
Diffstat (limited to 'doc/user/variants.xml')
-rw-r--r-- | doc/user/variants.xml | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/doc/user/variants.xml b/doc/user/variants.xml index 29d2d65..9980b1d 100644 --- a/doc/user/variants.xml +++ b/doc/user/variants.xml @@ -61,7 +61,8 @@ is pretty smart about rebuilding things when you change options. </para> - <programlisting> + <scons_example name="ex_variants"> + <file name="SConstruct" printme="1"> platform = ARGUMENTS.get('OS', Platform()) include = "#export/$PLATFORM/include" @@ -79,7 +80,38 @@ is pretty smart about rebuilding things when you change options. Export('env') env.SConscript('src/SConscript', variant_dir='build/$PLATFORM') - </programlisting> + </file> + <directory name="src"></directory> + <directory name="src/hello"></directory> + <directory name="src/world"></directory> + <file name="src/SConscript"> + Import('env') + SConscript('hello/SConscript') + SConscript('world/SConscript') + </file> + <file name="src/hello/SConscript"> + Import('env') + hello = env.Program('hello.c') + env.Install('$BINDIR', hello) + </file> + <file name="src/hello/hello.c"> + #include "world.h" + int main(int argc, char *argv[]) { printf "hello.c\n"; world(); } + </file> + <file name="src/world/SConscript"> + Import('env') + world = env.Library('world.c') + env.Install('$LIBDIR', world) + env.Install('$INCDIR', 'world.h') + </file> + <file name="src/world/world.h"> + #define STRING "world.h" + extern int world(); + </file> + <file name="src/world/world.c"> + int world() { printf "world.c\n"; } + </file> + </scons_example> <para> @@ -88,17 +120,9 @@ is pretty smart about rebuilding things when you change options. </para> - <screen> - % <userinput>scons -Q OS=linux</userinput> - Install file: "build/linux/world/world.h" as "export/linux/include/world.h" - cc -o build/linux/hello/hello.o -c -Iexport/linux/include build/linux/hello/hello.c - cc -o build/linux/world/world.o -c -Iexport/linux/include build/linux/world/world.c - ar rc build/linux/world/libworld.a build/linux/world/world.o - ranlib build/linux/world/libworld.a - Install file: "build/linux/world/libworld.a" as "export/linux/lib/libworld.a" - cc -o build/linux/hello/hello build/linux/hello/hello.o -Lexport/linux/lib -lworld - Install file: "build/linux/hello/hello" as "export/linux/bin/hello" - </screen> + <scons_output example="ex_variants" os="posix"> + <scons_output_command>scons -Q OS=linux</scons_output_command> + </scons_output> <para> @@ -106,17 +130,9 @@ is pretty smart about rebuilding things when you change options. </para> - <screen> - C:\><userinput>scons -Q OS=windows</userinput> - Install file: "build/windows/world/world.h" as "export/windows/include/world.h" - cl /Fobuild\windows\hello\hello.obj /c build\windows\hello\hello.c /nologo /Iexport\windows\include - cl /Fobuild\windows\world\world.obj /c build\windows\world\world.c /nologo /Iexport\windows\include - lib /nologo /OUT:build\windows\world\world.lib build\windows\world\world.obj - Install file: "build/windows/world/world.lib" as "export/windows/lib/world.lib" - link /nologo /OUT:build\windows\hello\hello.exe /LIBPATH:export\windows\lib world.lib build\windows\hello\hello.obj - embedManifestExeCheck(target, source, env) - Install file: "build/windows/hello/hello.exe" as "export/windows/bin/hello.exe" - </screen> + <scons_output example="ex_variants" os="win32"> + <scons_output_command>scons -Q OS=windows</scons_output_command> + </scons_output> <!-- |