From 140d836e9cd54fb67b969fd82ef7ed19ba574d40 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Sat, 26 Apr 2014 15:11:58 +0200 Subject: Imported Upstream version 2.3.1 --- doc/user/depends.xml | 872 +++++++++++++++++++++++++++------------------------ 1 file changed, 467 insertions(+), 405 deletions(-) (limited to 'doc/user/depends.xml') diff --git a/doc/user/depends.xml b/doc/user/depends.xml index d8e8719..5049565 100644 --- a/doc/user/depends.xml +++ b/doc/user/depends.xml @@ -1,6 +1,28 @@ + + + %scons; + + + %builders-mod; + + %functions-mod; + + %tools-mod; + + %variables-mod; + +]> + + +Dependencies + - % scons -Q hello - cc -o hello.o -c hello.c - cc -o hello hello.o - % touch hello.c - % scons -Q hello - scons: `hello' is up to date. - % edit hello.c - [CHANGE THE CONTENTS OF hello.c] - % scons -Q hello - cc -o hello.o -c hello.c - cc -o hello hello.o +% scons -Q hello +cc -o hello.o -c hello.c +cc -o hello hello.o +% touch hello.c +% scons -Q hello +scons: `hello' is up to date. +% edit hello.c + [CHANGE THE CONTENTS OF hello.c] +% scons -Q hello +cc -o hello.o -c hello.c +cc -o hello hello.o @@ -493,17 +514,22 @@ - - Program('hello.c') - def decide_if_changed(dependency, target, prev_ni): - if self.get_timestamp() != prev_ni.timestamp: - dep = str(dependency) - tgt = str(target) - if specific_part_of_file_has_changed(dep, tgt): - return True - return False - Decider(decide_if_changed) - + + +Program('hello.c') +def decide_if_changed(dependency, target, prev_ni): + if self.get_timestamp() != prev_ni.timestamp: + dep = str(dependency) + tgt = str(target) + if specific_part_of_file_has_changed(dep, tgt): + return True + return False +Decider(decide_if_changed) + + +int main() { printf("Hello, world!\n"); } + + @@ -608,37 +634,37 @@ - - env = Environment() - - def config_file_decider(dependency, target, prev_ni): - import os.path - - # We always have to init the .csig value... - dep_csig = dependency.get_csig() - # .csig may not exist, because no target was built yet... - if 'csig' not in dir(prev_ni): - return True - # Target file may not exist yet - if not os.path.exists(str(target.abspath)): - return True - if dep_csig != prev_ni.csig: - # Some change on source file => update installed one - return True - return False - - def update_file(): - f = open("test.txt","a") - f.write("some line\n") - f.close() - - update_file() - - # Activate our own decider function - env.Decider(config_file_decider) - - env.Install("install","test.txt") - + +env = Environment() + +def config_file_decider(dependency, target, prev_ni): + import os.path + + # We always have to init the .csig value... + dep_csig = dependency.get_csig() + # .csig may not exist, because no target was built yet... + if 'csig' not in dir(prev_ni): + return True + # Target file may not exist yet + if not os.path.exists(str(target.abspath)): + return True + if dep_csig != prev_ni.csig: + # Some change on source file => update installed one + return True + return False + +def update_file(): + f = open("test.txt","a") + f.write("some line\n") + f.close() + +update_file() + +# Activate our own decider function +env.Decider(config_file_decider) + +env.Install("install","test.txt") + @@ -670,13 +696,26 @@ - - env1 = Environment(CPPPATH = ['.']) - env2 = env1.Clone() - env2.Decider('timestamp-match') - env1.Program('prog-MD5', 'program1.c') - env2.Program('prog-timestamp', 'program2.c') - + + +env1 = Environment(CPPPATH = ['.']) +env2 = env1.Clone() +env2.Decider('timestamp-match') +env1.Program('prog-MD5', 'program1.c') +env2.Program('prog-timestamp', 'program2.c') + + +#include "inc.h" +int main() { printf("Hello, world!\n"); } + + +#include "inc.h" +int main() { printf("Hello, world!\n"); } + + +#define INC 1 + + @@ -690,17 +729,11 @@ - - % scons -Q - cc -o program1.o -c -I. program1.c - cc -o prog-MD5 program1.o - cc -o program2.o -c -I. program2.c - cc -o prog-timestamp program2.o - % touch inc.h - % scons -Q - cc -o program2.o -c -I. program2.c - cc -o prog-timestamp program2.o - + + scons -Q + touch inc.h + scons -Q + @@ -737,10 +770,10 @@ - - Program('hello.c') - SourceSignatures('MD5') - + +Program('hello.c') +SourceSignatures('MD5') + @@ -748,10 +781,10 @@ - - Program('hello.c') - SourceSignatures('timestamp') - + +Program('hello.c') +SourceSignatures('timestamp') + @@ -805,10 +838,10 @@ - - Program('hello.c') - TargetSignatures('MD5') - + +Program('hello.c') +TargetSignatures('MD5') + @@ -819,10 +852,10 @@ - - Program('hello.c') - TargetSignatures('timestamp') - + +Program('hello.c') +TargetSignatures('timestamp') + @@ -848,11 +881,11 @@ - - Program('hello.c') - TargetSignatures('source') - SourceSignatures('timestamp') - + +Program('hello.c') +TargetSignatures('source') +SourceSignatures('timestamp') + @@ -914,14 +947,22 @@ - - #include <hello.h> - int - main() - { - printf("Hello, %s!\n", string); - } - + + +Program('hello.c', CPPPATH = '.') + + +#include <hello.h> +int +main() +{ + printf("Hello, %s!\n", string); +} + + +#define string "world" + + @@ -929,10 +970,8 @@ - - - #define string "world" - + + @@ -944,10 +983,8 @@ - - - Program('hello.c', CPPPATH = '.') - + + @@ -960,18 +997,12 @@ - - % scons -Q hello - cc -o hello.o -c -I. hello.c - cc -o hello hello.o - % scons -Q hello - scons: `hello' is up to date. - % edit hello.h - [CHANGE THE CONTENTS OF hello.h] - % scons -Q hello - cc -o hello.o -c -I. hello.c - cc -o hello hello.o - + + scons -Q hello + scons -Q hello + edit hello.h + scons -Q hello + @@ -1016,9 +1047,14 @@ - - Program('hello.c', CPPPATH = ['include', '/home/project/inc']) - + + +Program('hello.c', CPPPATH = ['include', '/home/project/inc']) + + +int main() { printf("Hello, world!\n"); } + + @@ -1026,11 +1062,9 @@ - - % scons -Q hello - cc -o hello.o -c -Iinclude -I/home/project/inc hello.c - cc -o hello hello.o - + + scons -Q hello + @@ -1038,12 +1072,9 @@ - - C:\>scons -Q hello.exe - cl /Fohello.obj /c hello.c /nologo /Iinclude /I\home\project\inc - link /nologo /OUT:hello.exe hello.obj - embedManifestExeCheck(target, source, env) - + + scons -Q hello.exe + @@ -1095,13 +1126,10 @@ - - % scons -Q --implicit-cache hello - cc -o hello.o -c hello.c - cc -o hello hello.o - % scons -Q hello - scons: `hello' is up to date. - + + scons -Q --implicit-cache hello + scons -Q hello + @@ -1113,9 +1141,9 @@ - - SetOption('implicit_cache', 1) - + +SetOption('implicit_cache', 1) + @@ -1178,13 +1206,10 @@ - - % scons -Q --implicit-deps-changed hello - cc -o hello.o -c hello.c - cc -o hello hello.o - % scons -Q hello - scons: `hello' is up to date. - + + scons -Q --implicit-deps-changed hello + scons -Q hello + @@ -1216,13 +1241,10 @@ - - % scons -Q --implicit-deps-unchanged hello - cc -o hello.o -c hello.c - cc -o hello hello.o - % scons -Q hello - scons: `hello' is up to date. - + + scons -Q --implicit-deps-unchanged hello + scons -Q hello + @@ -1269,23 +1291,23 @@ - hello = Program('hello.c') - Depends(hello, 'other_file') +hello = Program('hello.c') +Depends(hello, 'other_file') - % scons -Q hello - cc -c hello.c -o hello.o - cc -o hello hello.o - % scons -Q hello - scons: `hello' is up to date. - % edit other_file - [CHANGE THE CONTENTS OF other_file] - % scons -Q hello - cc -c hello.c -o hello.o - cc -o hello hello.o +% scons -Q hello +cc -c hello.c -o hello.o +cc -o hello hello.o +% scons -Q hello +scons: `hello' is up to date. +% edit other_file + [CHANGE THE CONTENTS OF other_file] +% scons -Q hello +cc -c hello.c -o hello.o +cc -o hello hello.o @@ -1298,9 +1320,9 @@ - hello = Program('hello.c') - goodbye = Program('goodbye.c') - Depends(hello, goodbye) +hello = Program('hello.c') +goodbye = Program('goodbye.c') +Depends(hello, goodbye) @@ -1311,11 +1333,11 @@ - % scons -Q hello - cc -c goodbye.c -o goodbye.o - cc -o goodbye goodbye.o - cc -c hello.c -o hello.o - cc -o hello hello.o +% scons -Q hello +cc -c goodbye.c -o goodbye.o +cc -o goodbye goodbye.o +cc -c hello.c -o hello.o +cc -o hello hello.o @@ -1340,24 +1362,28 @@ - - #define FOO_HEADER <foo.h> - #include FOO_HEADER - - int main() { - return FOO; - } - - - - % scons -Q - cc -o hello.o -c -I. hello.c - cc -o hello hello.o - % edit foo.h - [CHANGE CONTENTS OF foo.h] - % scons -Q - scons: `.' is up to date. - + + +#define FOO_HEADER <foo.h> +#include FOO_HEADER + +int main() { + return FOO; +} + + +Program('hello', 'hello.c', CPPPATH='.') + + +#define FOO 42 + + + + + scons -Q + edit foo.h + scons -Q + @@ -1388,22 +1414,34 @@ priori specification of the dependency file. The produced hello.d file is not found (or used) for unknown reasons. --> - - obj = Object('hello.c', CCFLAGS='-MD -MF hello.d', CPPPATH='.') - SideEffect('hello.d', obj) - ParseDepends('hello.d') - Program('hello', obj) - - - - % scons -Q - cc -o hello.o -c -MD -MF hello.d -I. hello.c - cc -o hello hello.o - % edit foo.h - [CHANGE CONTENTS OF foo.h] - % scons -Q - cc -o hello.o -c -MD -MF hello.d -I. hello.c - + + +#define FOO_HEADER <foo.h> +#include FOO_HEADER + +int main() { + return FOO; +} + + +obj = Object('hello.c', CCFLAGS='-MD -MF hello.d', CPPPATH='.') +SideEffect('hello.d', obj) +ParseDepends('hello.d') +Program('hello', obj) + + +#define FOO 42 + + +hello.o: hello.c foo.h + + + + + scons -Q + edit foo.h + scons -Q + @@ -1413,10 +1451,28 @@ - + + +#define FOO_HEADER <foo.h> +#include FOO_HEADER + +int main() { + return FOO; +} + + +obj = Object('hello.c', CCFLAGS='-MD -MF hello.d', CPPPATH='.') +SideEffect('hello.d', obj) +ParseDepends('hello.d') +Program('hello', obj) + + +#define FOO 42 + + - % scons -Q - cc -o hello.o -c -MD -MF hello.d -I. hello.c - cc -o hello hello.o - % scons -Q --debug=explain - scons: rebuilding `hello.o' because `foo.h' is a new dependency - cc -o hello.o -c -MD -MF hello.d -I. hello.c - % scons -Q - scons: `.' is up to date. +% scons -Q +cc -o hello.o -c -MD -MF hello.d -I. hello.c +cc -o hello hello.o +% scons -Q --debug=explain +scons: rebuilding `hello.o' because `foo.h' is a new dependency +cc -o hello.o -c -MD -MF hello.d -I. hello.c +% scons -Q +scons: `.' is up to date. @@ -1474,16 +1530,25 @@ - - hello_obj=Object('hello.c') - hello = Program(hello_obj) - Ignore(hello_obj, 'hello.h') - + + +hello_obj=Object('hello.c') +hello = Program(hello_obj) +Ignore(hello_obj, 'hello.h') + + +#include "hello.h" +int main() { printf("Hello, %s!\n", string); } + + +#define string "world" + + - % scons -Q hello - cc -c -o hello.o hello.c - cc -o hello hello.o - % scons -Q hello - scons: `hello' is up to date. - % edit hello.h - [CHANGE THE CONTENTS OF hello.h] - % scons -Q hello - scons: `hello' is up to date. +% scons -Q hello +cc -c -o hello.o hello.c +cc -o hello hello.o +% scons -Q hello +scons: `hello' is up to date. +% edit hello.h + [CHANGE THE CONTENTS OF hello.h] +% scons -Q hello +scons: `hello' is up to date. @@ -1526,8 +1591,8 @@ - hello = Program('hello.c', CPPPATH=['/usr/include']) - Ignore(hello, '/usr/include/stdio.h') +hello = Program('hello.c', CPPPATH=['/usr/include']) +Ignore(hello, '/usr/include/stdio.h') @@ -1541,21 +1606,23 @@ by default. - - hello_obj=Object('hello.c') - hello = Program(hello_obj) - Ignore('.',[hello,hello_obj]) - - - - % scons -Q - scons: `.' is up to date. - % scons -Q hello - cc -o hello.o -c hello.c - cc -o hello hello.o - % scons -Q hello - scons: `hello' is up to date. - + + +hello_obj=Object('hello.c') +hello = Program(hello_obj) +Ignore('.',[hello,hello_obj]) + + +#include "stdio.h" +int main() { printf("Hello!\n"); } + + + + + scons -Q + scons -Q hello + scons -Q hello +
@@ -1600,16 +1667,22 @@ - - import time + + +import time - version_c_text = """ - char *date = "%s"; - """ % time.ctime(time.time()) - open('version.c', 'w').write(version_c_text) +version_c_text = """ +char *date = "%s"; +""" % time.ctime(time.time()) +open('version.c', 'w').write(version_c_text) - hello = Program(['hello.c', 'version.c']) - +hello = Program(['hello.c', 'version.c']) + + +extern char *date; +int main() { printf("Hello, %s! I was built: %s\n", date); } + + @@ -1624,20 +1697,13 @@ - - % scons -Q hello - cc -o hello.o -c hello.c - cc -o version.o -c version.c - cc -o hello hello.o version.o - % sleep 1 - % scons -Q hello - cc -o version.o -c version.c - cc -o hello hello.o version.o - % sleep 1 - % scons -Q hello - cc -o version.o -c version.c - cc -o hello hello.o version.o - + + scons -Q hello + sleep 1 + scons -Q hello + sleep 1 + scons -Q hello + @@ -1660,21 +1726,27 @@ - - import time + + +import time - version_c_text = """ - char *date = "%s"; - """ % time.ctime(time.time()) - open('version.c', 'w').write(version_c_text) +version_c_text = """ +char *date = "%s"; +""" % time.ctime(time.time()) +open('version.c', 'w').write(version_c_text) - version_obj = Object('version.c') +version_obj = Object('version.c') - hello = Program('hello.c', - LINKFLAGS = str(version_obj[0])) +hello = Program('hello.c', + LINKFLAGS = str(version_obj[0])) - Requires(hello, version_obj) - +Requires(hello, version_obj) + + +extern char *date; +int main() { printf("Hello, %s! I was built: %s\n", date); } + + @@ -1702,27 +1774,16 @@ - - % scons -Q hello - cc -o version.o -c version.c - cc -o hello.o -c hello.c - cc -o hello version.o hello.o - % sleep 1 - % scons -Q hello - cc -o version.o -c version.c - scons: `hello' is up to date. - % sleep 1 - % edit hello.c - [CHANGE THE CONTENTS OF hello.c] - % scons -Q hello - cc -o version.o -c version.c - cc -o hello.o -c hello.c - cc -o hello version.o hello.o - % sleep 1 - % scons -Q hello - cc -o version.o -c version.c - scons: `hello' is up to date. - + + scons -Q hello + sleep 1 + scons -Q hello + sleep 1 + edit hello.c + scons -Q hello + sleep 1 + scons -Q hello +
@@ -1738,10 +1799,15 @@
- - hello = Program('hello.c') - AlwaysBuild(hello) - + + +hello = Program('hello.c') +AlwaysBuild(hello) + + +int main() { printf("Hello, %s!\n", string); } + + @@ -1752,13 +1818,10 @@ - - % scons -Q - cc -o hello.o -c hello.c - cc -o hello hello.o - % scons -Q - cc -o hello hello.o - + + scons -Q + scons -Q + @@ -1777,13 +1840,10 @@ - - % scons -Q - cc -o hello.o -c hello.c - cc -o hello hello.o - % scons -Q hello.o - scons: `hello.o' is up to date. - + + scons -Q + scons -Q hello.o + + +
-- cgit v1.2.3