aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-06-21 15:01:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-06-21 15:01:41 +0200
commit85399cf60764b0fe54d44d4a5bacb54feae8dd62 (patch)
tree8d0bead9007ab1f92c6214e9a0062ff78c798876
parent131b0a852e70ecd198c4f769aff1435639cd35c6 (diff)
Add support for [config.]{cc,c,cxx}.aoptions (archive options)
In particular, this can be used to suppress lib.exe warnings, for example: cc.aoptions += /IGNORE:4221
-rw-r--r--build2/c/init.cxx7
-rw-r--r--build2/cc/common.hxx3
-rw-r--r--build2/cc/init.cxx5
-rw-r--r--build2/cc/link-rule.cxx23
-rw-r--r--build2/cc/module.cxx3
-rw-r--r--build2/cxx/init.cxx5
-rw-r--r--doc/manual.cli19
7 files changed, 50 insertions, 15 deletions
diff --git a/build2/c/init.cxx b/build2/c/init.cxx
index 0f74539..7c12fdd 100644
--- a/build2/c/init.cxx
+++ b/build2/c/init.cxx
@@ -168,6 +168,7 @@ namespace build2
v.insert<strings> ("config.c.poptions", true),
v.insert<strings> ("config.c.coptions", true),
v.insert<strings> ("config.c.loptions", true),
+ v.insert<strings> ("config.c.aoptions", true),
v.insert<strings> ("config.c.libs", true),
nullptr /* config.c.importable_headers */,
@@ -176,15 +177,19 @@ namespace build2
v.insert<dir_paths> ("c.sys_inc_dirs"),
v.insert<string> ("c.std", variable_visibility::project),
+
v.insert<strings> ("c.poptions"),
v.insert<strings> ("c.coptions"),
v.insert<strings> ("c.loptions"),
+ v.insert<strings> ("c.aoptions"),
v.insert<strings> ("c.libs"),
- nullptr /* c.importable_headers */,
+
+ nullptr /* c.importable_headers */,
v["cc.poptions"],
v["cc.coptions"],
v["cc.loptions"],
+ v["cc.aoptions"],
v["cc.libs"],
v.insert<strings> ("c.export.poptions"),
diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx
index 3f0f9fb..6eccf23 100644
--- a/build2/cc/common.hxx
+++ b/build2/cc/common.hxx
@@ -48,6 +48,7 @@ namespace build2
const variable& config_x_poptions;
const variable& config_x_coptions;
const variable& config_x_loptions;
+ const variable& config_x_aoptions;
const variable& config_x_libs;
const variable* config_x_importable_headers;
@@ -59,12 +60,14 @@ namespace build2
const variable& x_poptions;
const variable& x_coptions;
const variable& x_loptions;
+ const variable& x_aoptions;
const variable& x_libs;
const variable* x_importable_headers;
const variable& c_poptions; // cc.*
const variable& c_coptions;
const variable& c_loptions;
+ const variable& c_aoptions;
const variable& c_libs;
const variable& x_export_poptions;
diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx
index 4223d84..882b205 100644
--- a/build2/cc/init.cxx
+++ b/build2/cc/init.cxx
@@ -85,11 +85,13 @@ namespace build2
v.insert<strings> ("config.cc.poptions", true);
v.insert<strings> ("config.cc.coptions", true);
v.insert<strings> ("config.cc.loptions", true);
+ v.insert<strings> ("config.cc.aoptions", true);
v.insert<strings> ("config.cc.libs", true);
v.insert<strings> ("cc.poptions");
v.insert<strings> ("cc.coptions");
v.insert<strings> ("cc.loptions");
+ v.insert<strings> ("cc.aoptions");
v.insert<strings> ("cc.libs");
v.insert<strings> ("cc.export.poptions");
@@ -259,6 +261,9 @@ namespace build2
rs.assign ("cc.loptions") += cast_null<strings> (
config::optional (rs, "config.cc.loptions"));
+ rs.assign ("cc.aoptions") += cast_null<strings> (
+ config::optional (rs, "config.cc.aoptions"));
+
rs.assign ("cc.libs") += cast_null<strings> (
config::optional (rs, "config.cc.libs"));
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index 3b58ab7..588f3ae 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -1870,7 +1870,15 @@ namespace build2
{
if (tsys == "win32-msvc")
{
- // No options for lib.exe.
+ // lib.exe has /LIBPATH but it's not clear/documented what it's used
+ // for. Perhaps for link-time code generation (/LTCG)? If that's the
+ // case, then we may need to pass *.loptions.
+ //
+ args.push_back ("/NOLOGO");
+
+ // Add /MACHINE.
+ //
+ args.push_back (msvc_machine (cast<string> (rs[x_target_cpu])));
}
else
{
@@ -1914,6 +1922,9 @@ namespace build2
args.push_back (arg1.c_str ());
}
+
+ append_options (args, t, c_aoptions);
+ append_options (args, t, x_aoptions);
}
else
{
@@ -2172,16 +2183,6 @@ namespace build2
if (tsys == "win32-msvc")
{
- // lib.exe has /LIBPATH but it's not clear/documented what it's used
- // for. Perhaps for link-time code generation (/LTCG)? If that's the
- // case, then we may need to pass *.loptions.
- //
- args.push_back ("/NOLOGO");
-
- // Add /MACHINE.
- //
- args.push_back (msvc_machine (cast<string> (rs[x_target_cpu])));
-
out = "/OUT:" + relt.string ();
args.push_back (out.c_str ());
}
diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx
index aa775ae..00c5aa9 100644
--- a/build2/cc/module.cxx
+++ b/build2/cc/module.cxx
@@ -520,6 +520,9 @@ namespace build2
rs.assign (x_loptions) += cast_null<strings> (
config::optional (rs, config_x_loptions));
+ rs.assign (x_aoptions) += cast_null<strings> (
+ config::optional (rs, config_x_aoptions));
+
rs.assign (x_libs) += cast_null<strings> (
config::optional (rs, config_x_libs));
diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx
index 25b6c0d..518a823 100644
--- a/build2/cxx/init.cxx
+++ b/build2/cxx/init.cxx
@@ -393,6 +393,7 @@ namespace build2
v.insert<strings> ("config.cxx.poptions", true),
v.insert<strings> ("config.cxx.coptions", true),
v.insert<strings> ("config.cxx.loptions", true),
+ v.insert<strings> ("config.cxx.aoptions", true),
v.insert<strings> ("config.cxx.libs", true),
// List of importable headers. Inclusion of such headers is translated
@@ -411,15 +412,19 @@ namespace build2
v.insert<dir_paths> ("cxx.sys_inc_dirs"),
v.insert<string> ("cxx.std", variable_visibility::project),
+
v.insert<strings> ("cxx.poptions"),
v.insert<strings> ("cxx.coptions"),
v.insert<strings> ("cxx.loptions"),
+ v.insert<strings> ("cxx.aoptions"),
v.insert<strings> ("cxx.libs"),
+
&v.insert<strings> ("cxx.importable_headers"),
v["cc.poptions"],
v["cc.coptions"],
v["cc.loptions"],
+ v["cc.aoptions"],
v["cc.libs"],
v.insert<strings> ("cxx.export.poptions"),
diff --git a/doc/manual.cli b/doc/manual.cli
index b145818..ac6cb24 100644
--- a/doc/manual.cli
+++ b/doc/manual.cli
@@ -1349,9 +1349,19 @@ int main ()
\
\N|Besides \c{poptions}, there are also \c{coptions} (compile options),
-\c{loptions} (link options) and \c{libs} (extra libraries to link). If you are
-familiar with \c{make}, these are roughly equivalent to \c{CPPFLAGS},
-\c{CFLAGS}/\c{CXXFLAGS}, \c{LDFLAGS}, and \c{LIBS}.
+\c{loptions} (link options), \c{aoptions} (archive options) and \c{libs}
+(extra libraries to link). If you are familiar with \c{make}, these are
+roughly equivalent to \c{CPPFLAGS}, \c{CFLAGS}/\c{CXXFLAGS}, \c{LDFLAGS},
+\c{ARFLAGS}, and \c{LIBS}, respectively. Here they are again in the tabular
+form:
+
+\
+*.poptions preprocess CPPFLAGS
+*.coptions compile CFLAGS/CXXFLAGS
+*.loptions link LDFLAGS
+*.aoptions archive ARFLAGS
+*.libs extra libraries LIBS
+\
More specifically, there are three sets of these variables: \c{cc.*} (stands
for \i{C-common}) which applies to all C-like languages as well as \c{c.*} and
@@ -1663,6 +1673,7 @@ config.cxx = clang++
config.cxx.poptions = [null]
config.cxx.coptions = -g
config.cxx.loptions = [null]
+config.cxx.aoptions = [null]
config.cxx.libs = [null]
...
\
@@ -1681,6 +1692,7 @@ config.cxx = g++
config.cxx.poptions = [null]
config.cxx.coptions = -g
config.cxx.loptions = [null]
+config.cxx.aoptions = [null]
config.cxx.libs = [null]
...
\
@@ -2975,6 +2987,7 @@ config.cxx = clang++
config.cxx.poptions = [null]
config.cxx.coptions = -g
config.cxx.loptions = [null]
+config.cxx.aoptions = [null]
config.cxx.libs = [null]
...