diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-13 10:06:24 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-13 10:06:24 +0800 |
commit | fd34d6446ef8706a7d9011d650fbdce45b95d7c5 (patch) | |
tree | fb1ba425a97dcaf198001c388e041158a50805f7 | |
parent | 92d014e8acf3409786c8cf1b6e196580f6eaa3a8 (diff) | |
download | mrust-fd34d6446ef8706a7d9011d650fbdce45b95d7c5.tar.gz |
Makefile+main - Fixes to allow partial compilaing of run-pass tests
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | src/main.cpp | 22 |
2 files changed, 32 insertions, 1 deletions
@@ -153,9 +153,20 @@ output/rust/%.o: $(RUST_TESTS_DIR)%.rs $(RUSTCSRC) $(BIN) output/libstd.hir outp touch $@ output/rust/run-pass/allocator-default.o: output/liballoc_jemalloc.hir output/liballocator_dummy.hir +output/rust/run-pass/allocator-system.o: output/liballoc_system.hir +output/rust/run-pass/anon-extern-mod-cross-crate-2.o: output/libanonexternmod.hir +output/rust/run-pass/anon_trait_static_method_exe.o: output/libanon_trait_static_method_lib.hir +output/rust/run-pass/associated-const-cross-crate-defaults.o: output/libassociated_const_cc_lib.hir + +output/libanonexternmod.hir: $(RUST_TESTS_DIR)run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs + $(DBG) $(BIN) $< --crate-type rlib -o $@ $(PIPECMD) output/liballocator_dummy.hir: $(RUST_TESTS_DIR)run-pass/auxiliary/allocator-dummy.rs $(DBG) $(BIN) $< -o $@ $(PIPECMD) +output/libanon_trait_static_method_lib.hir: $(RUST_TESTS_DIR)run-pass/auxiliary/anon_trait_static_method_lib.rs + $(DBG) $(BIN) $< --crate-type rlib -o $@ $(PIPECMD) +output/libassociated_const_cc_lib.hir: $(RUST_TESTS_DIR)run-pass/auxiliary/associated-const-cc-lib.rs + $(DBG) $(BIN) $< --crate-type rlib -o $@ $(PIPECMD) output/libtest.hir: $(patsubst %,output/lib%.hir, std getopts term panic_unwind) output/libgetopts.hir: output/libstd.hir 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;
|