Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57842 - in trunk/tools/build/v2: build doc/src
From: ghost_at_[hidden]
Date: 2009-11-22 03:05:37


Author: vladimir_prus
Date: 2009-11-22 03:05:36 EST (Sun, 22 Nov 2009)
New Revision: 57842
URL: http://svn.boost.org/trac/boost/changeset/57842

Log:
Implement the 'always' function.

Text files modified:
   trunk/tools/build/v2/build/project.jam | 10 ++++++++++
   trunk/tools/build/v2/build/targets.jam | 29 +++++++++++++++++++++++++++--
   trunk/tools/build/v2/doc/src/reference.xml | 20 ++++++++++++++++++++
   3 files changed, 57 insertions(+), 2 deletions(-)

Modified: trunk/tools/build/v2/build/project.jam
==============================================================================
--- trunk/tools/build/v2/build/project.jam (original)
+++ trunk/tools/build/v2/build/project.jam 2009-11-22 03:05:36 EST (Sun, 22 Nov 2009)
@@ -1035,6 +1035,16 @@
         }
     }
 
+ rule always ( target-names * )
+ {
+ import project ;
+ local t = [ project.current ] ;
+ for local n in $(target-names)
+ {
+ $(t).mark-target-as-always $(n) ;
+ }
+ }
+
     rule glob ( wildcards + : excludes * )
     {
         import project ;

Modified: trunk/tools/build/v2/build/targets.jam
==============================================================================
--- trunk/tools/build/v2/build/targets.jam (original)
+++ trunk/tools/build/v2/build/targets.jam 2009-11-22 03:05:36 EST (Sun, 22 Nov 2009)
@@ -303,6 +303,13 @@
         # before main target instances are created.
         self.explicit-targets += $(target-name) ;
     }
+
+ rule mark-target-as-always ( target-name )
+ {
+ # Record the name of the target, not instance, since this rule is called
+ # before main target instances are created.
+ self.always-targets += $(target-name) ;
+ }
 
     # Add new target alternative
     #
@@ -466,6 +473,11 @@
                 self.main-targets += $(t) ;
                 target = $(self.main-target.$(name)) ;
             }
+
+ if $(name) in $(self.always-targets)
+ {
+ $(a).always ;
+ }
 
             $(target).add-alternative $(a) ;
         }
@@ -1100,7 +1112,12 @@
                 [ full-name ] ;
         }
     }
-
+
+ rule always ( )
+ {
+ self.always = 1 ;
+ }
+
     # Returns the list of abstract-targets which are used as sources. The extra
     # properties specified for sources are not represented. The only user for
     # this rule at the moment is the "--dump-tests" feature of the test system.
@@ -1267,7 +1284,15 @@
                 {
                     local gur = $(result[1]) ;
                     result = $(result[2-]) ;
-
+
+ if $(self.always)
+ {
+ for local t in $(result)
+ {
+ $(t).always ;
+ }
+ }
+
                     local s = [ create-subvariant $(result)
                         : [ virtual-target.recent-targets ]
                         : $(property-set) : $(source-targets)

Modified: trunk/tools/build/v2/doc/src/reference.xml
==============================================================================
--- trunk/tools/build/v2/doc/src/reference.xml (original)
+++ trunk/tools/build/v2/doc/src/reference.xml 2009-11-22 03:05:36 EST (Sun, 22 Nov 2009)
@@ -182,6 +182,26 @@
       </varlistentry>
 
       <varlistentry>
+ <term><literal>always</literal></term>
+ <indexterm><primary>always building a metatarget</primary></indexterm>
+
+ <listitem><para>The <literal>always</literal> funciton takes a single
+ parameter&#x2014;a list of metatarget names. The top-level targets produced
+ by the named metatargets will be always considered out of date. Consider this example:
+ </para>
+<programlisting>
+exe hello : hello.cpp ;
+exe bye : bye.cpp ;
+always hello ;
+</programlisting>
+ <para>If a build of <filename>hello</filename> is requested, then the binary will
+ always be relinked. The object files will not be recompiled, though. Note that if
+ a build of <filename>hello</filename> is not requested, for example you specify just
+ <filename>bye</filename> on the command line, <filename>hello</filename> will not
+ be relinked.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
         <term><literal>constant</literal></term>
 
         <listitem><para>Sets project-wide constant. Takes two


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk