diff options
author | Luca Falavigna <dktrkranz@debian.org> | 2014-04-26 15:11:58 +0200 |
---|---|---|
committer | Luca Falavigna <dktrkranz@debian.org> | 2014-04-26 15:11:58 +0200 |
commit | a3a0ab66f0da855e75e3a0e2acfb8aa106b46510 (patch) | |
tree | 5352edff1387c3d7e5a8b49ec56524f085c22782 /doc/user/variants.xml | |
parent | 51fa4e4acb6fc8fc7a2af0fbdc21fd1e8feddb3a (diff) | |
parent | 140d836e9cd54fb67b969fd82ef7ed19ba574d40 (diff) |
Merge tag 'upstream/2.3.1'
Upstream version 2.3.1
Diffstat (limited to 'doc/user/variants.xml')
-rw-r--r-- | doc/user/variants.xml | 125 |
1 files changed, 82 insertions, 43 deletions
diff --git a/doc/user/variants.xml b/doc/user/variants.xml index b0d1096..7915dfd 100644 --- a/doc/user/variants.xml +++ b/doc/user/variants.xml @@ -1,6 +1,27 @@ +<?xml version='1.0'?> +<!DOCTYPE sconsdoc [ + <!ENTITY % scons SYSTEM "../scons.mod"> + %scons; + + <!ENTITY % builders-mod SYSTEM "../generated/builders.mod"> + %builders-mod; + <!ENTITY % functions-mod SYSTEM "../generated/functions.mod"> + %functions-mod; + <!ENTITY % tools-mod SYSTEM "../generated/tools.mod"> + %tools-mod; + <!ENTITY % variables-mod SYSTEM "../generated/variables.mod"> + %variables-mod; +]> + +<chapter id="chap-variants" + xmlns="http://www.scons.org/dbxsd/v1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0/scons.xsd scons.xsd"> +<title>Variant Builds</title> + <!-- - Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation + Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -61,25 +82,57 @@ is pretty smart about rebuilding things when you change options. </para> - <programlisting> - platform = ARGUMENTS.get('OS', Platform()) + <scons_example name="variants_ex"> + <file name="SConstruct" printme="1"> +platform = ARGUMENTS.get('OS', Platform()) - include = "#export/$PLATFORM/include" - lib = "#export/$PLATFORM/lib" - bin = "#export/$PLATFORM/bin" +include = "#export/$PLATFORM/include" +lib = "#export/$PLATFORM/lib" +bin = "#export/$PLATFORM/bin" - env = Environment(PLATFORM = platform, - BINDIR = bin, - INCDIR = include, - LIBDIR = lib, - CPPPATH = [include], - LIBPATH = [lib], - LIBS = 'world') +env = Environment(PLATFORM = platform, + BINDIR = bin, + INCDIR = include, + LIBDIR = lib, + CPPPATH = [include], + LIBPATH = [lib], + LIBS = 'world') - Export('env') +Export('env') - env.SConscript('src/SConscript', variant_dir='build/$PLATFORM') - </programlisting> +env.SConscript('src/SConscript', variant_dir='build/$PLATFORM') + </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 +141,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="variants_ex" os="posix" suffix="1"> + <scons_output_command>scons -Q OS=linux</scons_output_command> + </scons_output> <para> @@ -106,30 +151,24 @@ 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="variants_ex" os="win32" suffix="2"> + <scons_output_command>scons -Q OS=windows</scons_output_command> + </scons_output> <!-- - <scons_example name="ex_var2"> + <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> - <scons_output example="ex_var2"> + <scons_output example="variants_ex2" suffix="1"> <scons_output_command>scons -Q</scons_output_command> </scons_output> --> + +</chapter> |