summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-13 10:06:24 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-13 10:06:24 +0800
commitfd34d6446ef8706a7d9011d650fbdce45b95d7c5 (patch)
treefb1ba425a97dcaf198001c388e041158a50805f7 /src
parent92d014e8acf3409786c8cf1b6e196580f6eaa3a8 (diff)
downloadmrust-fd34d6446ef8706a7d9011d650fbdce45b95d7c5.tar.gz
Makefile+main - Fixes to allow partial compilaing of run-pass tests
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3a5d4247..148faf6e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -113,6 +113,8 @@ struct ProgramParams
::std::string outfile;
const char *crate_path = ".";
+ ::AST::Crate::Type crate_type = ::AST::Crate::Type::Unknown;
+
::std::set< ::std::string> features;
ProgramParams(int argc, char *argv[]);
@@ -225,7 +227,10 @@ int main(int argc, char *argv[])
}
// Extract the crate type and name from the crate attributes
- auto crate_type = crate.m_crate_type;
+ auto crate_type = params.crate_type;
+ if( crate_type == ::AST::Crate::Type::Unknown ) {
+ crate_type = crate.m_crate_type;
+ }
if( crate_type == ::AST::Crate::Type::Unknown ) {
// Assume to be executable
crate_type = ::AST::Crate::Type::Executable;
@@ -422,6 +427,21 @@ ProgramParams::ProgramParams(int argc, char *argv[])
}
this->crate_path = argv[++i];
}
+ else if( strcmp(arg, "--crate-type") == 0 ) {
+ if( i == argc - 1 ) {
+ ::std::cerr << "Flag --crate-type requires an argument" << ::std::endl;
+ exit(1);
+ }
+ const char* type_str = argv[++i];
+
+ if( strcmp(type_str, "rlib") == 0 ) {
+ this->crate_type = ::AST::Crate::Type::RustLib;
+ }
+ else {
+ ::std::cerr << "Unknown value for --crate-type" << ::std::endl;
+ exit(1);
+ }
+ }
else if( strcmp(arg, "--cfg") == 0 ) {
if( i == argc - 1 ) {
::std::cerr << "Flag --cfg requires an argument" << ::std::endl;