diff --git a/boost_build_v2.html b/boost_build_v2.html
index 0230df7c7..1e3060aaf 100644
--- a/boost_build_v2.html
+++ b/boost_build_v2.html
@@ -22,12 +22,12 @@
div.alert { color: red }
table { align: center; border: thin; }
-
+
+ - build request, build request expansion and directly requested targets
+ - conditional properties
+ -->
bjam there. A simple application will be built. You can also
play with other projects in examples-v2.
+ it somewhere.
+
+ It is slighly better way is to copy new/user-config.jam
+ into one of the locations where it can be found (given in this table). This prevent you from
+ accidentally overwriting your config when updating.
-->
@@ -1211,6 +1211,13 @@ borland/runtime-link=static,dynamic
Build another project when this one is built. |
+
+
+ | explicit |
+
+ States that the target should be built only by explicit
+ request. |
+
Each project is also associated with project root. That's a
@@ -1461,17 +1468,17 @@ borland/runtime-link=static,dynamic
It allows to have main target names with slashes.
+ That makes good rationale for why main target must contain names.
+ -->
@@ -1554,10 +1561,21 @@ borland/runtime-link=static,dynamic
follows:
- - For project targets, all of main targets are generated with the
- same properties. Then all projects referred via "build-project" are
- generated as well. If it's not possible to refine requested properties
- with project requirements, the project is skipped.
+ -
+
For project targets, all of main targets are generated with the
+ same properties. Then all projects referred via "build-project" are
+ generated as well. If it's not possible to refine requested
+ properties with project requirements, the project is skipped.
+
+ It is possible to disable building of certain
+ target using the explicit rule, available in all project
+ modules. The syntax is
+
+ rule explicit ( target-name )
+
+ If this rule is invoked on a target, it will be built only when it's
+ explicitly requested on the command line.
+
-
For main target, steps are:
diff --git a/new/project.jam b/new/project.jam
index a1c5be6c9..7234b0452 100644
--- a/new/project.jam
+++ b/new/project.jam
@@ -467,7 +467,7 @@ rule project-attributes ( location )
self.build-dir = [ path.root $(specification) $(self.location) ] ;
}
else if ! $(attribute) in "id" "default-build" "location" "source-location"
- "parent" "projects-to-build" "explicit-targets"
+ "parent" "projects-to-build"
{
errors.error "Invalid project attribute '$(attribute)' specified "
"for project at '$(self.location)'" ;
@@ -605,6 +605,13 @@ module project-rules
local now = [ $(attributes).get projects-to-build ] ;
$(attributes).set projects-to-build : $(now) $(dir) ;
}
+
+ rule explicit ( target-name )
+ {
+ import project ;
+ local t = [ project.target $(__name__) ] ;
+ $(t).mark-target-as-explicit $(target-name) ;
+ }
}
diff --git a/new/targets.jam b/new/targets.jam
index 79fe57d2b..8d967d3a1 100644
--- a/new/targets.jam
+++ b/new/targets.jam
@@ -195,18 +195,17 @@ rule project-target ( name : project : requirements * : default-build * )
}
return $(usage-requirements) $(targets) ;
}
-
+
# Computes and returns a list of abstract-target instances which
# must be built when this project is built.
rule targets-to-build ( )
{
local result ;
-
+
# Collect all main targets here, except for "explicit" ones.
- local explicit-targets = [ project.attribute $(self.project) explicit-targets ] ;
for local name in $(self.main-targets)
{
- if ! $(name) in $(explicit-targets)
+ if ! $(name) in $(self.explicit-targets)
{
result += [ main-target $(name) ] ;
}
@@ -223,7 +222,13 @@ rule project-target ( name : project : requirements * : default-build * )
return $(result) ;
}
-
+ # Add 'target' to the list of targets in this project that should be build
+ # only by explicit request
+ rule mark-target-as-explicit ( target-name )
+ {
+ self.explicit-targets += $(target-name) ;
+ }
+
# Returns a 'main-target' class instance corresponding to the 'name'.
# Creates the instance if needed.
rule main-target ( name )
diff --git a/test/explicit.py b/test/explicit.py
index 42140238e..23d4f3cba 100644
--- a/test/explicit.py
+++ b/test/explicit.py
@@ -14,12 +14,11 @@ t = Tester()
t.write("project-root.jam", "")
t.write("Jamfile", """
-project
- : explicit-targets hello2
- ;
exe hello : hello.cpp ;
exe hello2 : hello.cpp ;
+
+explicit hello2 ;
""")
t.write("hello.cpp", """
int main()
diff --git a/v2/boost_build_v2.html b/v2/boost_build_v2.html
index 0230df7c7..1e3060aaf 100644
--- a/v2/boost_build_v2.html
+++ b/v2/boost_build_v2.html
@@ -22,12 +22,12 @@
div.alert { color: red }
table { align: center; border: thin; }
-
+
+ - build request, build request expansion and directly requested targets
+ - conditional properties
+ -->
bjam there. A simple application will be built. You can also
play with other projects in examples-v2.
+ it somewhere.
+
+ It is slighly better way is to copy new/user-config.jam
+ into one of the locations where it can be found (given in this table). This prevent you from
+ accidentally overwriting your config when updating.
-->
@@ -1211,6 +1211,13 @@ borland/runtime-link=static,dynamic
Build another project when this one is built. |
+
+
+ | explicit |
+
+ States that the target should be built only by explicit
+ request. |
+
Each project is also associated with project root. That's a
@@ -1461,17 +1468,17 @@ borland/runtime-link=static,dynamic
- It allows to have main target names with slashes.
+ That makes good rationale for why main target must contain names.
+ -->
@@ -1554,10 +1561,21 @@ borland/runtime-link=static,dynamic
follows:
- - For project targets, all of main targets are generated with the
- same properties. Then all projects referred via "build-project" are
- generated as well. If it's not possible to refine requested properties
- with project requirements, the project is skipped.
+ -
+
For project targets, all of main targets are generated with the
+ same properties. Then all projects referred via "build-project" are
+ generated as well. If it's not possible to refine requested
+ properties with project requirements, the project is skipped.
+
+ It is possible to disable building of certain
+ target using the explicit rule, available in all project
+ modules. The syntax is
+
+ rule explicit ( target-name )
+
+ If this rule is invoked on a target, it will be built only when it's
+ explicitly requested on the command line.
+
-
For main target, steps are:
diff --git a/v2/build/project.jam b/v2/build/project.jam
index a1c5be6c9..7234b0452 100644
--- a/v2/build/project.jam
+++ b/v2/build/project.jam
@@ -467,7 +467,7 @@ rule project-attributes ( location )
self.build-dir = [ path.root $(specification) $(self.location) ] ;
}
else if ! $(attribute) in "id" "default-build" "location" "source-location"
- "parent" "projects-to-build" "explicit-targets"
+ "parent" "projects-to-build"
{
errors.error "Invalid project attribute '$(attribute)' specified "
"for project at '$(self.location)'" ;
@@ -605,6 +605,13 @@ module project-rules
local now = [ $(attributes).get projects-to-build ] ;
$(attributes).set projects-to-build : $(now) $(dir) ;
}
+
+ rule explicit ( target-name )
+ {
+ import project ;
+ local t = [ project.target $(__name__) ] ;
+ $(t).mark-target-as-explicit $(target-name) ;
+ }
}
diff --git a/v2/build/targets.jam b/v2/build/targets.jam
index 79fe57d2b..8d967d3a1 100644
--- a/v2/build/targets.jam
+++ b/v2/build/targets.jam
@@ -195,18 +195,17 @@ rule project-target ( name : project : requirements * : default-build * )
}
return $(usage-requirements) $(targets) ;
}
-
+
# Computes and returns a list of abstract-target instances which
# must be built when this project is built.
rule targets-to-build ( )
{
local result ;
-
+
# Collect all main targets here, except for "explicit" ones.
- local explicit-targets = [ project.attribute $(self.project) explicit-targets ] ;
for local name in $(self.main-targets)
{
- if ! $(name) in $(explicit-targets)
+ if ! $(name) in $(self.explicit-targets)
{
result += [ main-target $(name) ] ;
}
@@ -223,7 +222,13 @@ rule project-target ( name : project : requirements * : default-build * )
return $(result) ;
}
-
+ # Add 'target' to the list of targets in this project that should be build
+ # only by explicit request
+ rule mark-target-as-explicit ( target-name )
+ {
+ self.explicit-targets += $(target-name) ;
+ }
+
# Returns a 'main-target' class instance corresponding to the 'name'.
# Creates the instance if needed.
rule main-target ( name )
diff --git a/v2/test/explicit.py b/v2/test/explicit.py
index 42140238e..23d4f3cba 100644
--- a/v2/test/explicit.py
+++ b/v2/test/explicit.py
@@ -14,12 +14,11 @@ t = Tester()
t.write("project-root.jam", "")
t.write("Jamfile", """
-project
- : explicit-targets hello2
- ;
exe hello : hello.cpp ;
exe hello2 : hello.cpp ;
+
+explicit hello2 ;
""")
t.write("hello.cpp", """
int main()