mirror of
https://github.com/boostorg/build.git
synced 2026-02-13 00:12:11 +00:00
Implement the 'always' function.
[SVN r57842]
This commit is contained in:
@@ -181,6 +181,26 @@ ECHO [ glob-tree *.cpp : .svn ] ;
|
||||
their containing project is built.</para></listitem>
|
||||
</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—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>
|
||||
|
||||
|
||||
@@ -1035,6 +1035,16 @@ module project-rules
|
||||
}
|
||||
}
|
||||
|
||||
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 ;
|
||||
|
||||
@@ -303,6 +303,13 @@ class project-target : abstract-target
|
||||
# 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 @@ class project-target : abstract-target
|
||||
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 @@ class basic-target : abstract-target
|
||||
[ 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 @@ class basic-target : abstract-target
|
||||
{
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user