diff options
author | John Hodge <tpg@mutabah.net> | 2018-05-20 12:11:32 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-05-20 12:11:32 +0800 |
commit | 7a4733c76c0391578fe04fde9cfa19698878c81e (patch) | |
tree | ce7c10b66c2e58bbddfa6f389dab8ab29c362c23 | |
parent | aa4d3c5fc5f45891411eb72188c5383a23683495 (diff) | |
download | mrust-7a4733c76c0391578fe04fde9cfa19698878c81e.tar.gz |
Minicargo - Quieten build output
-rw-r--r-- | minicargo.mk | 14 | ||||
-rw-r--r-- | tools/common/debug.cpp | 8 | ||||
-rw-r--r-- | tools/common/debug.h | 1 | ||||
-rw-r--r-- | tools/minicargo/Makefile | 2 | ||||
-rw-r--r-- | tools/minicargo/main.cpp | 28 |
5 files changed, 40 insertions, 13 deletions
diff --git a/minicargo.mk b/minicargo.mk index 0d2d4fb1..db19eab9 100644 --- a/minicargo.mk +++ b/minicargo.mk @@ -45,31 +45,31 @@ LIBS: $(OUTDIR)libstd.hir $(OUTDIR)libtest.hir $(OUTDIR)libpanic_unwind.hir $(OU $(MRUSTC): $(MAKE) -f Makefile all - test -e $@ + @test -e $@ $(MINICARGO): $(MAKE) -C tools/minicargo/ - test -e $@ + @test -e $@ # Standard library crates # - libstd, libpanic_unwind, libtest and libgetopts # - libproc_macro (mrustc) $(OUTDIR)libstd.hir: $(MRUSTC) $(MINICARGO) $(MINICARGO) $(RUSTCSRC)src/libstd --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) - test -e $@ + @test -e $@ $(OUTDIR)libpanic_unwind.hir: $(MRUSTC) $(MINICARGO) $(OUTDIR)libstd.hir $(MINICARGO) $(RUSTCSRC)src/libpanic_unwind --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) - test -e $@ + @test -e $@ $(OUTDIR)libtest.hir: $(MRUSTC) $(MINICARGO) $(OUTDIR)libstd.hir $(OUTDIR)libpanic_unwind.hir $(MINICARGO) $(RUSTCSRC)src/libtest --vendor-dir $(RUSTCSRC)src/vendor --output-dir $(OUTDIR) $(MINICARGO_FLAGS) - test -e $@ + @test -e $@ $(OUTDIR)libgetopts.hir: $(MRUSTC) $(MINICARGO) $(OUTDIR)libstd.hir $(MINICARGO) $(RUSTCSRC)src/libgetopts --script-overrides $(OVERRIDE_DIR) --output-dir $(OUTDIR) $(MINICARGO_FLAGS) - test -e $@ + @test -e $@ # MRustC custom version of libproc_macro $(OUTDIR)libproc_macro.hir: $(MRUSTC) $(MINICARGO) $(OUTDIR)libstd.hir $(MINICARGO) lib/libproc_macro --output-dir $(OUTDIR) $(MINICARGO_FLAGS) - test -e $@ + @test -e $@ RUSTC_ENV_VARS := CFG_COMPILER_HOST_TRIPLE=$(RUSTC_TARGET) RUSTC_ENV_VARS += LLVM_CONFIG=$(abspath $(LLVM_CONFIG)) diff --git a/tools/common/debug.cpp b/tools/common/debug.cpp index a3fb9956..94d8ed99 100644 --- a/tools/common/debug.cpp +++ b/tools/common/debug.cpp @@ -34,6 +34,14 @@ void Debug_DisablePhase(const char* phase_name) { gmDisabledDebug.insert( ::std::string(phase_name) ); } +void Debug_EnablePhase(const char* phase_name) +{ + auto it = gmDisabledDebug.find(phase_name); + if( it != gmDisabledDebug.end() ) + { + gmDisabledDebug.erase(it); + } +} void Debug_Print(::std::function<void(::std::ostream& os)> cb) { if( !Debug_IsEnabled() ) diff --git a/tools/common/debug.h b/tools/common/debug.h index ace00876..86c88de9 100644 --- a/tools/common/debug.h +++ b/tools/common/debug.h @@ -7,6 +7,7 @@ typedef ::std::function<void(::std::ostream& os)> dbg_cb_t; extern void Debug_SetPhase(const char* phase_name); extern void Debug_DisablePhase(const char* phase_name); +extern void Debug_EnablePhase(const char* phase_name); extern bool Debug_IsEnabled(); extern void Debug_EnterScope(const char* name, dbg_cb_t ); extern void Debug_LeaveScope(const char* name, dbg_cb_t ); diff --git a/tools/minicargo/Makefile b/tools/minicargo/Makefile index 01010fb5..363ef4b9 100644 --- a/tools/minicargo/Makefile +++ b/tools/minicargo/Makefile @@ -38,7 +38,7 @@ $(OBJDIR)%.o: %.cpp @echo [CXX] $< $V$(CXX) -o $@ -c $< $(CXXFLAGS) -MMD -MP -MF $@.dep -../bin/common_lib.a: +../bin/common_lib.a: $(wildcard ../common/*.* ../common/Makefile) make -C ../common -include $(OBJS:%.o=%.o.dep) diff --git a/tools/minicargo/main.cpp b/tools/minicargo/main.cpp index 50e08619..b185881b 100644 --- a/tools/minicargo/main.cpp +++ b/tools/minicargo/main.cpp @@ -54,11 +54,29 @@ int main(int argc, const char* argv[]) return 1; } - Debug_DisablePhase("Load Repository"); - Debug_DisablePhase("Load Root"); - Debug_DisablePhase("Load Dependencies"); - Debug_DisablePhase("Enumerate Build"); - //Debug_DisablePhase("Run Build"); + { + Debug_DisablePhase("Load Repository"); + Debug_DisablePhase("Load Root"); + Debug_DisablePhase("Load Dependencies"); + Debug_DisablePhase("Enumerate Build"); + Debug_DisablePhase("Run Build"); + + if( const char* e = getenv("MINICARGO_DEBUG") ) + { + while( *e ) + { + const char* colon = ::std::strchr(e, ':'); + size_t len = colon ? colon - e : ::std::strlen(e); + + Debug_EnablePhase(::std::string(e, len).c_str()); + + if( colon ) + e = colon + 1; + else + e = e + len; + } + } + } try { |