diff options
Diffstat (limited to 'doc/user/depends.xml')
-rw-r--r-- | doc/user/depends.xml | 99 |
1 files changed, 50 insertions, 49 deletions
diff --git a/doc/user/depends.xml b/doc/user/depends.xml index b72f41f..d386a1f 100644 --- a/doc/user/depends.xml +++ b/doc/user/depends.xml @@ -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 @@ -259,7 +259,7 @@ </para> <programlisting> - Program('hello.c') + Object('hello.c') Decider('timestamp-newer') </programlisting> @@ -272,13 +272,11 @@ </para> <screen> - % <userinput>scons -Q hello</userinput> + % <userinput>scons -Q hello.o</userinput> cc -o hello.o -c hello.c - cc -o hello hello.o % <userinput>touch hello.c</userinput> - % <userinput>scons -Q hello</userinput> + % <userinput>scons -Q hello.o</userinput> cc -o hello.o -c hello.c - cc -o hello hello.o </screen> <para> @@ -292,7 +290,7 @@ </para> <programlisting> - Program('hello.c') + Object('hello.c') Decider('make') </programlisting> @@ -327,7 +325,7 @@ </para> <programlisting> - Program('hello.c') + Object('hello.c') Decider('timestamp-match') </programlisting> @@ -344,13 +342,11 @@ </para> <screen> - % <userinput>scons -Q hello</userinput> + % <userinput>scons -Q hello.o</userinput> cc -o hello.o -c hello.c - cc -o hello hello.o % <userinput>touch -t 198901010000 hello.c</userinput> - % <userinput>scons -Q hello</userinput> + % <userinput>scons -Q hello.o</userinput> cc -o hello.o -c hello.c - cc -o hello hello.o </screen> <para> @@ -990,12 +986,6 @@ <screen> C:\><userinput>scons -Q hello.exe</userinput> - - scons: warning: No installed VCs - File "<stdin>", line 67, in __call__ - - scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly - File "<stdin>", line 67, in __call__ cl /Fohello.obj /c hello.c /nologo /Iinclude /I\home\project\inc link /nologo /OUT:hello.exe hello.obj </screen> @@ -1430,8 +1420,9 @@ </para> <programlisting> - hello = Program('hello.c') - Ignore(hello, 'hello.h') + hello_obj=Object('hello.c') + hello = Program(hello_obj) + Ignore(hello_obj, 'hello.h') </programlisting> <!-- XXX mention that you can use lists for target and source? --> @@ -1568,7 +1559,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>) @@ -1578,27 +1569,30 @@ </para> - <!-- + <screen> + % <userinput>scons -Q hello</userinput> + cc -o hello.o -c hello.c + cc -o version.o -c version.c + cc -o hello hello.o version.o + % <userinput>sleep 1</userinput> + % <userinput>scons -Q hello</userinput> + cc -o version.o -c version.c + cc -o hello hello.o version.o + % <userinput>sleep 1</userinput> + % <userinput>scons -Q hello</userinput> + cc -o version.o -c version.c + cc -o hello hello.o version.o + </screen> - <scons_output example="no-Requires"> - <scons_output_command>scons -Q</scons_output_command> - <scons_output_command>scons -Q</scons_output_command> - </scons_output> + <para> - --> + (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.) - <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> + </para> <para> @@ -1644,28 +1638,35 @@ <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> <screen> - % <userinput>scons -Q</userinput> + % <userinput>scons -Q hello</userinput> cc -o version.o -c version.c cc -o hello.o -c hello.c cc -o hello version.o hello.o - % <userinput>scons -Q</userinput> - scons: `.' is up to date. + % <userinput>sleep 1</userinput> + % <userinput>scons -Q hello</userinput> + cc -o version.o -c version.c + scons: `hello' is up to date. + % <userinput>sleep 1</userinput> % <userinput>edit hello.c</userinput> [CHANGE THE CONTENTS OF hello.c] - % <userinput>scons -Q</userinput> + % <userinput>scons -Q hello</userinput> cc -o version.o -c version.c cc -o hello.o -c hello.c cc -o hello version.o hello.o - % <userinput>scons -Q</userinput> - scons: `.' is up to date. + % <userinput>sleep 1</userinput> + % <userinput>scons -Q hello</userinput> + cc -o version.o -c version.c + scons: `hello' is up to date. </screen> </section> |