diff options
Diffstat (limited to 'doc/user/file-removal.xml')
-rw-r--r-- | doc/user/file-removal.xml | 133 |
1 files changed, 89 insertions, 44 deletions
diff --git a/doc/user/file-removal.xml b/doc/user/file-removal.xml index f2730c1..1b58abe 100644 --- a/doc/user/file-removal.xml +++ b/doc/user/file-removal.xml @@ -1,6 +1,28 @@ +<?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-file-removal" + 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>Controlling Removal of Targets</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 @@ -56,11 +78,22 @@ </para> - <programlisting> - env = Environment(RANLIBCOM='') - lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) - env.Precious(lib) - </programlisting> + <scons_example name="fileremoval_precious-ex1"> + <file name="SConstruct" printme="1"> + env = Environment(RANLIBCOM='') + lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) + env.Precious(lib) + </file> + <file name="f1.c"> +int f1() { } + </file> + <file name="f2.c"> +int f2() { } + </file> + <file name="f3.c"> +int f3() { } + </file> + </scons_example> <para> @@ -70,13 +103,9 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - cc -o f1.o -c f1.c - cc -o f2.o -c f2.c - cc -o f3.o -c f3.c - ar rc libfoo.a f1.o f2.o f3.o - </screen> + <scons_output example="fileremoval_precious-ex1" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + </scons_output> <para> @@ -107,11 +136,22 @@ </para> - <programlisting> - env = Environment(RANLIBCOM='') - lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) - env.NoClean(lib) - </programlisting> + <scons_example name="fileremoval_noclean-ex1"> + <file name="SConstruct" printme="1"> +env = Environment(RANLIBCOM='') +lib = env.Library('foo', ['f1.c', 'f2.c', 'f3.c']) +env.NoClean(lib) + </file> + <file name="f1.c"> +int f1() { } + </file> + <file name="f2.c"> +int f2() { } + </file> + <file name="f3.c"> +int f3() { } + </file> + </scons_example> <para> @@ -120,21 +160,10 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - cc -o f1.o -c f1.c - cc -o f2.o -c f2.c - cc -o f3.o -c f3.c - ar rc libfoo.a f1.o f2.o f3.o - % <userinput>scons -c</userinput> - scons: Reading SConscript files ... - scons: done reading SConscript files. - scons: Cleaning targets ... - Removed f1.o - Removed f2.o - Removed f3.o - scons: done cleaning targets. - </screen> + <scons_output example="fileremoval_noclean-ex1" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + <scons_output_command>scons -c</scons_output_command> + </scons_output> </section> @@ -168,10 +197,27 @@ </para> - <programlisting> - t = Command('foo.out', 'foo.in', 'build -o $TARGET $SOURCE') - Clean(t, 'foo.log') - </programlisting> + <scons_example name="fileremoval_clean-ex1"> + <file name="S" printme="1"> +t = Command('foo.out', 'foo.in', 'build -o $TARGET $SOURCE') +Clean(t, 'foo.log') + </file> + <file name="SConstruct"> +env = DefaultEnvironment() +import os +env['ENV']['PATH'] = env['ENV']['PATH'] + os.pathsep + os.getcwd() +SConscript('S') + </file> + <file name="foo.in"> +foo.in + </file> + <file name="foo.log"> +foo.log + </file> + <file name="build" chmod="0755"> +cat $3 > $2 + </file> + </scons_example> <para> @@ -191,12 +237,11 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - build -o foo.out foo.in - % <userinput>scons -Q -c</userinput> - Removed foo.out - Removed foo.log - </screen> + <scons_output example="fileremoval_clean-ex1" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + <scons_output_command>scons -Q -c</scons_output_command> + </scons_output> </section> + +</chapter> |