summaryrefslogtreecommitdiff
path: root/doc/user/depends.in
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/depends.in')
-rw-r--r--doc/user/depends.in74
1 files changed, 38 insertions, 36 deletions
diff --git a/doc/user/depends.in b/doc/user/depends.in
index dfd52e3..213713f 100644
--- a/doc/user/depends.in
+++ b/doc/user/depends.in
@@ -1,6 +1,6 @@
<!--
- Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
+ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -248,7 +248,7 @@
<scons_example name="newer">
<file name="SConstruct" printme="1">
- Program('hello.c')
+ Object('hello.c')
Decider('timestamp-newer')
</file>
<file name="hello.c">
@@ -265,9 +265,9 @@
</para>
<scons_output example="newer" os="posix">
- <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>scons -Q hello.o</scons_output_command>
<scons_output_command>touch hello.c</scons_output_command>
- <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>scons -Q hello.o</scons_output_command>
</scons_output>
<para>
@@ -281,7 +281,7 @@
</para>
<sconstruct>
- Program('hello.c')
+ Object('hello.c')
Decider('make')
</sconstruct>
@@ -317,7 +317,7 @@
<scons_example name="match">
<file name="SConstruct" printme="1">
- Program('hello.c')
+ Object('hello.c')
Decider('timestamp-match')
</file>
<file name="hello.c">
@@ -338,9 +338,9 @@
</para>
<scons_output example="match" os="posix">
- <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>scons -Q hello.o</scons_output_command>
<scons_output_command>touch -t 198901010000 hello.c</scons_output_command>
- <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>scons -Q hello.o</scons_output_command>
</scons_output>
<para>
@@ -1458,8 +1458,9 @@
<scons_example name="ignore">
<file name="SConstruct" printme="1">
- hello = Program('hello.c')
- Ignore(hello, 'hello.h')
+ hello_obj=Object('hello.c')
+ hello = Program(hello_obj)
+ Ignore(hello_obj, 'hello.h')
</file>
<file name="hello.c">
#include "hello.h"
@@ -1612,7 +1613,7 @@
<para>
If we list <filename>version.c</filename> as an actual source file,
- though, then <filename>version.o</filename>
+ though, then the <filename>version.o</filename> file
will get rebuilt every time we run &SCons;
(because the &SConstruct; file itself changes
the contents of <filename>version.c</filename>)
@@ -1622,27 +1623,23 @@
</para>
- <!--
-
<scons_output example="no-Requires">
- <scons_output_command>scons -Q</scons_output_command>
- <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>sleep 1</scons_output_command>
+ <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>sleep 1</scons_output_command>
+ <scons_output_command>scons -Q hello</scons_output_command>
</scons_output>
- -->
+ <para>
- <screen>
- % <userinput>scons -Q</userinput>
- gcc -o hello.o -c hello.c
- gcc -o version.o -c version.c
- gcc -o hello hello.o version.o
- % <userinput>scons -Q</userinput>
- gcc -o version.o -c version.c
- gcc -o hello hello.o version.o
- % <userinput>scons -Q</userinput>
- gcc -o version.o -c version.c
- gcc -o hello hello.o version.o
- </screen>
+ (Note that for the above example to work,
+ we &sleep; for one second in between each run,
+ so that the &SConstruct; file will create a
+ <filename>version.c</filename> file with a time string
+ that's one second later than the previous run.)
+
+ </para>
<para>
@@ -1694,19 +1691,24 @@
<para>
With these changes,
- we get the desired behavior of
- re-building the <filename>version.o</filename> file,
- and therefore re-linking the <filename>hello</filename> executable,
- only when the <filename>hello.c</filename> has changed:
+ we get the desired behavior of only
+ re-linking the <filename>hello</filename> executable
+ when the <filename>hello.c</filename> has changed,
+ even though the <filename>version.o</filename> is rebuilt
+ (because the &SConstruct; file still changes the
+ <filename>version.c</filename> contents directly each run):
</para>
<scons_output example="Requires">
- <scons_output_command>scons -Q</scons_output_command>
- <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>sleep 1</scons_output_command>
+ <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>sleep 1</scons_output_command>
<scons_output_command output=" [CHANGE THE CONTENTS OF hello.c]">edit hello.c</scons_output_command>
- <scons_output_command>scons -Q</scons_output_command>
- <scons_output_command>scons -Q</scons_output_command>
+ <scons_output_command>scons -Q hello</scons_output_command>
+ <scons_output_command>sleep 1</scons_output_command>
+ <scons_output_command>scons -Q hello</scons_output_command>
</scons_output>
</section>