summaryrefslogtreecommitdiff
path: root/doc/user/simple.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/simple.xml')
-rw-r--r--doc/user/simple.xml249
1 files changed, 117 insertions, 132 deletions
diff --git a/doc/user/simple.xml b/doc/user/simple.xml
index 238e40c..3ddb0dc 100644
--- a/doc/user/simple.xml
+++ b/doc/user/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-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>Simple 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
@@ -45,11 +66,11 @@
</para>
<programlisting>
- int
- main()
- {
- printf("Hello, world!\n");
- }
+int
+main()
+{
+ printf("Hello, world!\n");
+}
</programlisting>
<para>
@@ -59,9 +80,14 @@
</para>
- <programlisting>
- Program('hello.c')
- </programlisting>
+ <scons_example name="simple_ex1">
+ <file name="SConstruct" printme="1">
+Program('hello.c')
+ </file>
+ <file name="hello.c">
+int main() { printf("Hello, world!\n"); }
+ </file>
+ </scons_example>
<para>
@@ -86,15 +112,9 @@
</para>
- <screen>
- % <userinput>scons</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Building targets ...
- cc -o hello.o -c hello.c
- cc -o hello hello.o
- scons: done building targets.
- </screen>
+ <scons_output example="simple_ex1" os="posix" suffix="1">
+ <scons_output_command>scons</scons_output_command>
+ </scons_output>
<para>
@@ -103,16 +123,9 @@
</para>
- <screen>
- C:\><userinput>scons</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Building targets ...
- cl /Fohello.obj /c hello.c /nologo
- link /nologo /OUT:hello.exe hello.obj
- embedManifestExeCheck(target, source, env)
- scons: done building targets.
- </screen>
+ <scons_output example="simple_ex1" os="win32" suffix="2">
+ <scons_output_command>scons</scons_output_command>
+ </scons_output>
<para>
@@ -164,9 +177,14 @@
</para>
- <programlisting>
- Object('hello.c')
- </programlisting>
+ <scons_example name="simple_Object">
+ <file name="SConstruct" printme="1">
+Object('hello.c')
+ </file>
+ <file name="hello.c">
+int main() { printf("Hello, world!\n"); }
+ </file>
+ </scons_example>
<para>
@@ -175,14 +193,9 @@
</para>
- <screen>
- % <userinput>scons</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Building targets ...
- cc -o hello.o -c hello.c
- scons: done building targets.
- </screen>
+ <scons_output example="simple_Object" os="posix" suffix="1">
+ <scons_output_command>scons</scons_output_command>
+ </scons_output>
<para>
@@ -191,14 +204,9 @@
</para>
- <screen>
- C:\><userinput>scons</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Building targets ...
- cl /Fohello.obj /c hello.c /nologo
- scons: done building targets.
- </screen>
+ <scons_output example="simple_Object" os="win32" suffix="2">
+ <scons_output_command>scons</scons_output_command>
+ </scons_output>
</section>
@@ -218,9 +226,20 @@
</para>
- <programlisting>
- Java('classes', 'src')
- </programlisting>
+ <scons_example name="simple_java">
+ <file name="SConstruct" printme="1">
+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");
+ }
+}
+ </file>
+ </scons_example>
<para>
@@ -232,14 +251,9 @@
</para>
- <screen>
- % <userinput>scons</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Building targets ...
- javac -d classes -sourcepath src src/hello.java
- scons: done building targets.
- </screen>
+ <scons_output example="simple_java" os="posix" suffix="1">
+ <scons_output_command>scons</scons_output_command>
+ </scons_output>
<para>
@@ -269,24 +283,19 @@
</para>
-
-
- <screen>
- % <userinput>scons</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Building targets ...
- cc -o hello.o -c hello.c
- cc -o hello hello.o
- scons: done building targets.
- % <userinput>scons -c</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Cleaning targets ...
- Removed hello.o
- Removed hello
- scons: done cleaning targets.
- </screen>
+ <scons_example name="simple_clean">
+ <file name="SConstruct">
+Program('hello.c')
+ </file>
+ <file name="hello.c">
+int main() { printf("Hello, world!\n"); }
+ </file>
+ </scons_example>
+
+ <scons_output example="simple_clean" os="posix" suffix="1">
+ <scons_output_command>scons</scons_output_command>
+ <scons_output_command>scons -c</scons_output_command>
+ </scons_output>
<para>
@@ -294,23 +303,10 @@
</para>
- <screen>
- C:\><userinput>scons</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Building targets ...
- cl /Fohello.obj /c hello.c /nologo
- link /nologo /OUT:hello.exe hello.obj
- embedManifestExeCheck(target, source, env)
- scons: done building targets.
- C:\><userinput>scons -c</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Cleaning targets ...
- Removed hello.obj
- Removed hello.exe
- scons: done cleaning targets.
- </screen>
+ <scons_output example="simple_clean" os="win32" suffix="2">
+ <scons_output_command>scons</scons_output_command>
+ <scons_output_command>scons -c</scons_output_command>
+ </scons_output>
<para>
@@ -362,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>
@@ -444,13 +440,21 @@
</para>
- <programlisting>
- print "Calling Program('hello.c')"
- Program('hello.c')
- print "Calling Program('goodbye.c')"
- Program('goodbye.c')
- print "Finished calling Program()"
- </programlisting>
+ <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()"
+ </file>
+ <file name="hello.c">
+int main() { printf("Hello, world!\n"); }
+ </file>
+ <file name="goodbye.c">
+int main() { printf("Goodbye, world!\n"); }
+ </file>
+ </scons_example>
<para>
@@ -463,20 +467,9 @@
</para>
- <screen>
- % <userinput>scons</userinput>
- scons: Reading SConscript files ...
- Calling Program('hello.c')
- Calling Program('goodbye.c')
- Finished calling Program()
- scons: done reading SConscript files.
- scons: Building targets ...
- cc -o goodbye.o -c goodbye.c
- cc -o goodbye goodbye.o
- cc -o hello.o -c hello.c
- cc -o hello hello.o
- scons: done building targets.
- </screen>
+ <scons_output example="simple_declarative" os="posix" suffix="1">
+ <scons_output_command>scons</scons_output_command>
+ </scons_output>
<para>
@@ -502,16 +495,9 @@
</para>
- <screen>
- C:\><userinput>scons</userinput>
- scons: Reading SConscript files ...
- scons: done reading SConscript files.
- scons: Building targets ...
- cl /Fohello.obj /c hello.c /nologo
- link /nologo /OUT:hello.exe hello.obj
- embedManifestExeCheck(target, source, env)
- scons: done building targets.
- </screen>
+ <scons_output example="simple_ex1" os="win32" suffix="3">
+ <scons_output_command>scons</scons_output_command>
+ </scons_output>
<para>
@@ -535,12 +521,9 @@
</para>
- <screen>
- C:\><userinput>scons -Q</userinput>
- cl /Fohello.obj /c hello.c /nologo
- link /nologo /OUT:hello.exe hello.obj
- embedManifestExeCheck(target, source, env)
- </screen>
+ <scons_output example="simple_ex1" os="win32" suffix="4">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -553,3 +536,5 @@
</para>
</section>
+
+</chapter>