summaryrefslogtreecommitdiff
path: root/doc/user/nodes.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/nodes.xml')
-rw-r--r--doc/user/nodes.xml206
1 files changed, 112 insertions, 94 deletions
diff --git a/doc/user/nodes.xml b/doc/user/nodes.xml
index 1a37013..c355ca6 100644
--- a/doc/user/nodes.xml
+++ b/doc/user/nodes.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-nodes"
+ 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>Node Objects</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
@@ -58,10 +79,10 @@
</para>
- <programlisting>
- Object('hello.c', CCFLAGS='-DHELLO')
- Object('goodbye.c', CCFLAGS='-DGOODBYE')
- </programlisting>
+ <sconstruct>
+Object('hello.c', CCFLAGS='-DHELLO')
+Object('goodbye.c', CCFLAGS='-DGOODBYE')
+ </sconstruct>
<para>
@@ -73,11 +94,11 @@
</para>
- <programlisting>
- Object('hello.c', CCFLAGS='-DHELLO')
- Object('goodbye.c', CCFLAGS='-DGOODBYE')
- Program(['hello.o', 'goodbye.o'])
- </programlisting>
+ <sconstruct>
+Object('hello.c', CCFLAGS='-DHELLO')
+Object('goodbye.c', CCFLAGS='-DGOODBYE')
+Program(['hello.o', 'goodbye.o'])
+ </sconstruct>
<para>
@@ -100,11 +121,19 @@
</para>
- <programlisting>
- hello_list = Object('hello.c', CCFLAGS='-DHELLO')
- goodbye_list = Object('goodbye.c', CCFLAGS='-DGOODBYE')
- Program(hello_list + goodbye_list)
- </programlisting>
+ <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)
+ </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>
@@ -113,12 +142,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- cc -o goodbye.o -c -DGOODBYE goodbye.c
- cc -o hello.o -c -DHELLO hello.c
- cc -o hello hello.o goodbye.o
- </screen>
+ <scons_output example="nodes_ex1" os="posix" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -126,13 +152,9 @@
</para>
- <screen>
- C:\><userinput>scons -Q</userinput>
- cl /Fogoodbye.obj /c goodbye.c -DGOODBYE
- cl /Fohello.obj /c hello.c -DHELLO
- link /nologo /OUT:hello.exe hello.obj goodbye.obj
- embedManifestExeCheck(target, source, env)
- </screen>
+ <scons_output example="nodes_ex1" os="win32" suffix="2">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -159,13 +181,15 @@
</para>
- <programlisting>
- hello_c = File('hello.c')
- Program(hello_c)
+ <scons_example name="nodes_print">
+ <file name="SConstruct" printme="1">
+hello_c = File('hello.c')
+Program(hello_c)
- classes = Dir('classes')
- Java(classes, 'src')
- </programlisting>
+classes = Dir('classes')
+Java(classes, 'src')
+ </file>
+ </scons_example>
<para>
@@ -204,9 +228,9 @@
</para>
- <programlisting>
- xyzzy = Entry('xyzzy')
- </programlisting>
+ <sconstruct>
+xyzzy = Entry('xyzzy')
+ </sconstruct>
<para>
@@ -237,18 +261,17 @@
</para>
- <programlisting>
- hello_c = File('hello.c')
- Program(hello_c)
-
- classes = Dir('classes')
- Java(classes, 'src')
-
- 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]
- </programlisting>
+ <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]
+ </file>
+ <file name="hello.c">
+int main() { printf("Hello, world!\n"); }
+ </file>
+ </scons_example>
<para>
@@ -256,13 +279,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- The object file is: hello.o
- The program file is: hello
- cc -o hello.o -c hello.c
- cc -o hello hello.o
- </screen>
+ <scons_output example="nodes_print" os="posix" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -270,14 +289,9 @@
</para>
- <screen>
- C:\><userinput>scons -Q</userinput>
- The object file is: hello.obj
- The program file is: hello.exe
- cl /Fohello.obj /c hello.c /nologo
- link /nologo /OUT:hello.exe hello.obj
- embedManifestExeCheck(target, source, env)
- </screen>
+ <scons_output example="nodes_print" os="win32" suffix="2">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -314,13 +328,18 @@
</para>
- <programlisting>
- 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!"
- </programlisting>
+ <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!"
+ </file>
+ <file name="hello.c">
+int main() { printf("Hello, world!\n"); }
+ </file>
+ </scons_example>
<para>
@@ -328,12 +347,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- hello does not exist!
- cc -o hello.o -c hello.c
- cc -o hello hello.o
- </screen>
+ <scons_output example="nodes_exists" os="posix" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
</section>
@@ -354,11 +370,13 @@
</para>
- <programlisting>
- env=Environment(VAR="value")
- n=File("foo.c")
- print env.GetBuildPath([n, "sub/dir/$VAR"])
- </programlisting>
+ <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"])
+ </file>
+ </scons_example>
<para>
@@ -366,11 +384,9 @@
</para>
- <screen>
- % <userinput>scons -Q</userinput>
- ['foo.c', 'sub/dir/value']
- scons: `.' is up to date.
- </screen>
+ <scons_output example="nodes_GetBuildPath" os="posix" suffix="1">
+ <scons_output_command>scons -Q</scons_output_command>
+ </scons_output>
<para>
@@ -394,15 +410,15 @@
</para>
- <scons_example name="read">
+ <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>
@@ -412,7 +428,7 @@
</para>
- <scons_output example="read" os="posix">
+ <scons_output example="nodes_read" os="posix" suffix="1">
<scons_output_command>scons -Q</scons_output_command>
</scons_output>
@@ -434,3 +450,5 @@
</section>
-->
+
+</chapter>