summaryrefslogtreecommitdiff
path: root/src/tools.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2023-01-14 12:05:23 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2023-01-14 12:10:58 +0100
commit321f25af1ba33d8409cd294b4f50d0d3e79cf3bd (patch)
tree586c8297ca89e477ae8dfc228dd71f0b15f96faa /src/tools.cc
parentd5c88fedf517e738490c32fa95097e03178903fe (diff)
Add ar_flag support for ar tool, replacing hardcoded values.HEADmaster
Diffstat (limited to 'src/tools.cc')
-rw-r--r--src/tools.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools.cc b/src/tools.cc
index 476386b..28d3903 100644
--- a/src/tools.cc
+++ b/src/tools.cc
@@ -80,6 +80,10 @@ std::ostream& operator<<(std::ostream& stream, const ctor::ar_opt& opt)
// Adding to this enum should also imply adding to the unit-tests below
switch(opt)
{
+ case ctor::ar_opt::replace: stream << "ctor::ar_opt::replace"; break;
+ case ctor::ar_opt::add_index: stream << "ctor::ar_opt::add_index"; break;
+ case ctor::ar_opt::create: stream << "ctor::ar_opt::create"; break;
+ case ctor::ar_opt::output: stream << "ctor::ar_opt::output"; break;
case ctor::ar_opt::custom: stream << "ctor::ar_opt::custom"; break;
}
@@ -174,6 +178,11 @@ ctor::ld_flag ld_option(const std::string& flag)
return { ctor::ld_opt::custom, flag };
}
+ctor::ar_flag ar_option(const std::string& flag)
+{
+ return { ctor::ar_opt::custom, flag };
+}
+
std::vector<std::string> cxx_option(ctor::cxx_opt opt, const std::string& arg)
{
switch(opt)
@@ -280,6 +289,14 @@ std::vector<std::string> ar_option(ctor::ar_opt opt, const std::string& arg)
{
switch(opt)
{
+ case ctor::ar_opt::replace:
+ return {"-r"};
+ case ctor::ar_opt::add_index:
+ return {"-s"};
+ case ctor::ar_opt::create:
+ return {"-c"};
+ case ctor::ar_opt::output:
+ return {arg};
case ctor::ar_opt::custom:
return {arg};
}
@@ -494,6 +511,7 @@ ctor::ar_flag ar_option(const std::string& flag, ctor::toolchain toolchain)
{
case ctor::toolchain::gcc:
case ctor::toolchain::clang:
+ return gcc::ar_option(flag);
case ctor::toolchain::any:
case ctor::toolchain::none:
break;