aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2017-10-20 19:38:40 +0200
committerGravatar Dmitry Lomov <dslomov@google.com>2017-10-23 17:15:57 +0200
commitbc616ec5a44119b8e2b60293947e3aa14fac053f (patch)
tree945508b9e51a3779b3a917b65217ad3a4788e59c /src
parent0b2f94d38f2d6cf27a47ce2e66e2423ccef770ce (diff)
Add a flag to disable Make variables in the C++ configuration.
RELNOTES: None. PiperOrigin-RevId: 172901568
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java14
2 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
index 359dbb2eb1..5e9e96e721 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
@@ -1526,6 +1526,10 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
@Override
public void addGlobalMakeVariables(Builder<String, String> globalMakeEnvBuilder) {
+ if (!cppOptions.enableMakeVariables) {
+ return;
+ }
+
// hardcoded CC->gcc setting for unit tests
globalMakeEnvBuilder.put("CC", getToolPathFragment(Tool.GCC).getPathString());
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
index 0e3b7a9379..6a91fc6696 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
@@ -852,6 +852,18 @@ public class CppOptions extends FragmentOptions {
)
public boolean strictSystemIncludes;
+ @Option(
+ name = "experimental_enable_cc_configuration_make_variables",
+ defaultValue = "true",
+ documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
+ effectTags = {OptionEffectTag.UNKNOWN},
+ metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
+ help = "If enabled, the C++ configuration fragment supplies Make variables. This option "
+ + "is used in the migration to remove them in favor of requiring an explicit "
+ + "dependency on the C++ toolchain for rules that use them."
+ )
+ public boolean enableMakeVariables;
+
@Override
public FragmentOptions getHost() {
CppOptions host = (CppOptions) getDefault();
@@ -865,6 +877,8 @@ public class CppOptions extends FragmentOptions {
host.crosstoolTop = hostCrosstoolTop;
}
+ host.enableMakeVariables = enableMakeVariables;
+
// hostLibcTop doesn't default to the target's libcTop.
// Only an explicit command-line option will change it.
// The default is whatever the host's crosstool (which might have been specified