summaryrefslogtreecommitdiff
path: root/doc/user/less-simple.xml
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2014-04-26 15:11:58 +0200
committerLuca Falavigna <dktrkranz@debian.org>2014-04-26 15:11:58 +0200
commita3a0ab66f0da855e75e3a0e2acfb8aa106b46510 (patch)
tree5352edff1387c3d7e5a8b49ec56524f085c22782 /doc/user/less-simple.xml
parent51fa4e4acb6fc8fc7a2af0fbdc21fd1e8feddb3a (diff)
parent140d836e9cd54fb67b969fd82ef7ed19ba574d40 (diff)
Merge tag 'upstream/2.3.1'
Upstream version 2.3.1
Diffstat (limited to 'doc/user/less-simple.xml')
-rw-r--r--doc/user/less-simple.xml272
1 files changed, 160 insertions, 112 deletions
diff --git a/doc/user/less-simple.xml b/doc/user/less-simple.xml
index f41ea79..5bda302 100644
--- a/doc/user/less-simple.xml
+++ b/doc/user/less-simple.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-less-simple"
+ 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>Less Simple Things to Do With 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
@@ -51,7 +72,7 @@
</para>
<programlisting>
- Program('hello.c')
+Program('hello.c')
</programlisting>
<para>
@@ -63,9 +84,14 @@
</para>
- <programlisting>
- Program('new_hello', 'hello.c')
- </programlisting>
+ <scons_example name="lesssimple_target">
+ <file name="SConstruct" printme="1">
+Program('new_hello', 'hello.c')
+ </file>
+ <file name="hello.c">
+int main() { printf("Hello, world!\n"); }
+ </file>
+ </scons_example>
<para>
@@ -85,11 +111,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o hello.o -c hello.c
- cc -o new_hello hello.o
- </screen>
+ <scons_output example="lesssimple_target" os="posix" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -98,12 +122,9 @@
</para>
- <screen>
- C:\><userinput>scons -Q</userinput>
- cl /Fohello.obj /c hello.c /nologo
- link /nologo /OUT:new_hello.exe hello.obj
- embedManifestExeCheck(target, source, env)
- </screen>
+ <scons_output example="lesssimple_target" os="win32" suffix="2">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
</section>
@@ -124,9 +145,20 @@
</para>
- <programlisting>
- Program(['prog.c', 'file1.c', 'file2.c'])
- </programlisting>
+ <scons_example name="lesssimple_ex2">
+ <file name="SConstruct" printme="1">
+Program(['prog.c', 'file1.c', 'file2.c'])
+ </file>
+ <file name="prog.c">
+int main() { printf("prog.c\n"); }
+ </file>
+ <file name="file1.c">
+void file1() { printf("file1.c\n"); }
+ </file>
+ <file name="file2.c">
+void file2() { printf("file2.c\n"); }
+ </file>
+ </scons_example>
<para>
@@ -134,13 +166,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o file1.o -c file1.c
- cc -o file2.o -c file2.c
- cc -o prog.o -c prog.c
- cc -o prog prog.o file1.o file2.o
- </screen>
+ <scons_output example="lesssimple_ex2" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -164,9 +192,20 @@
</para>
- <programlisting>
- Program('program', ['prog.c', 'file1.c', 'file2.c'])
- </programlisting>
+ <scons_example name="lesssimple_ex3">
+ <file name="SConstruct" printme="1">
+Program('program', ['prog.c', 'file1.c', 'file2.c'])
+ </file>
+ <file name="prog.c">
+int main() { printf("prog.c\n"); }
+ </file>
+ <file name="file1.c">
+void file1() { printf("file1.c\n"); }
+ </file>
+ <file name="file2.c">
+void file2() { printf("file2.c\n"); }
+ </file>
+ </scons_example>
<para>
@@ -174,13 +213,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o file1.o -c file1.c
- cc -o file2.o -c file2.c
- cc -o prog.o -c prog.c
- cc -o program prog.o file1.o file2.o
- </screen>
+ <scons_output example="lesssimple_ex3" os="posix" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -188,14 +223,9 @@
</para>
- <screen>
- C:\><userinput>scons -Q</userinput>
- cl /Fofile1.obj /c file1.c /nologo
- cl /Fofile2.obj /c file2.c /nologo
- cl /Foprog.obj /c prog.c /nologo
- link /nologo /OUT:program.exe prog.obj file1.obj file2.obj
- embedManifestExeCheck(target, source, env)
- </screen>
+ <scons_output example="lesssimple_ex3" os="win32" suffix="2">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
</section>
@@ -216,9 +246,9 @@
</para>
- <programlisting>
- Program('program', Glob('*.c'))
- </programlisting>
+ <sconstruct>
+Program('program', Glob('*.c'))
+ </sconstruct>
<para>
@@ -244,9 +274,9 @@
</para>
- <programlisting>
- Program('hello', ['file1.c', 'file2.c'])
- </programlisting>
+ <sconstruct>
+Program('hello', ['file1.c', 'file2.c'])
+ </sconstruct>
<para>
@@ -254,9 +284,9 @@
</para>
- <programlisting>
- Program('hello', 'hello.c')
- </programlisting>
+ <sconstruct>
+Program('hello', 'hello.c')
+ </sconstruct>
<para>
@@ -265,9 +295,9 @@
</para>
- <programlisting>
- Program('hello', ['hello.c'])
- </programlisting>
+ <sconstruct>
+Program('hello', ['hello.c'])
+ </sconstruct>
<para>
@@ -293,11 +323,11 @@
</para>
- <programlisting>
- # The following two calls both work correctly:
- Program('program1', 'program1.c')
- Program('program2', ['program2.c'])
- </programlisting>
+ <sconstruct>
+# The following two calls both work correctly:
+Program('program1', 'program1.c')
+Program('program2', ['program2.c'])
+ </sconstruct>
<para>
@@ -306,17 +336,17 @@
</para>
- <programlisting>
- common_sources = ['file1.c', 'file2.c']
+ <sconstruct>
+common_sources = ['file1.c', 'file2.c']
- # THE FOLLOWING IS INCORRECT AND GENERATES A PYTHON ERROR
- # BECAUSE IT TRIES TO ADD A STRING TO A LIST:
- Program('program1', common_sources + 'program1.c')
+# THE FOLLOWING IS INCORRECT AND GENERATES A PYTHON ERROR
+# BECAUSE IT TRIES TO ADD A STRING TO A LIST:
+Program('program1', common_sources + 'program1.c')
- # The following works correctly, because it's adding two
- # lists together to make another list.
- Program('program2', common_sources + ['program2.c'])
- </programlisting>
+# The following works correctly, because it's adding two
+# lists together to make another list.
+Program('program2', common_sources + ['program2.c'])
+ </sconstruct>
</important>
@@ -353,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>
@@ -387,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>
@@ -403,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>
@@ -439,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>
@@ -452,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>
@@ -482,10 +512,21 @@
</para>
- <programlisting>
- Program('foo.c')
- Program('bar', ['bar1.c', 'bar2.c'])
- </programlisting>
+ <scons_example name="lesssimple_ex4">
+ <file name="SConstruct" printme="1">
+Program('foo.c')
+Program('bar', ['bar1.c', 'bar2.c'])
+ </file>
+ <file name="foo.c">
+int main() { printf("foo.c\n"); }
+ </file>
+ <file name="bar1.c">
+int main() { printf("bar1.c\n"); }
+ </file>
+ <file name="bar2.c">
+void bar2() { printf("bar2.c\n"); }
+ </file>
+ </scons_example>
<para>
@@ -493,14 +534,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o bar1.o -c bar1.c
- cc -o bar2.o -c bar2.c
- cc -o bar bar1.o bar2.o
- cc -o foo.o -c foo.c
- cc -o foo foo.o
- </screen>
+ <scons_output example="lesssimple_ex4" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -541,10 +577,27 @@
</para>
- <programlisting>
- Program(Split('foo.c common1.c common2.c'))
- Program('bar', Split('bar1.c bar2.c common1.c common2.c'))
- </programlisting>
+ <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'))
+ </file>
+ <file name="foo.c">
+int main() { printf("foo.c\n"); }
+ </file>
+ <file name="bar1.c">
+int main() { printf("bar1.c\n"); }
+ </file>
+ <file name="bar2.c">
+int bar2() { printf("bar2.c\n"); }
+ </file>
+ <file name="common1.c">
+void common1() { printf("common1.c\n"); }
+ </file>
+ <file name="common2.c">
+void common22() { printf("common2.c\n"); }
+ </file>
+ </scons_example>
<para>
@@ -556,16 +609,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o bar1.o -c bar1.c
- cc -o bar2.o -c bar2.c
- cc -o common1.o -c common1.c
- cc -o common2.o -c common2.c
- cc -o bar bar1.o bar2.o common1.o common2.o
- cc -o foo.o -c foo.c
- cc -o foo foo.o common1.o common2.o
- </screen>
+ <scons_output example="lesssimple_ex5" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -582,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>
@@ -596,3 +642,5 @@
</para>
</section>
+
+</chapter>