From 96588a669cbc722fba86ea6508acdd1ba7fa869b Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 28 May 2015 11:08:46 -0400 Subject: [PATCH] compiler: remove the compilation directory unless explicitely set Signed-off-by: Jean Privat --- src/compiler/abstract_compiler.nit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index 02bdade..b7625bb 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -169,6 +169,9 @@ class MakefileToolchain do var compile_dir = compile_dir + # Remove the compilation directory unless explicitly set + var auto_remove = toolcontext.opt_compile_dir.value == null + # Generate the .h and .c files # A single C file regroups many compiled rumtime functions # Note that we do not try to be clever an a small change in a Nit source file may change the content of all the generated .c files @@ -197,6 +200,10 @@ class MakefileToolchain compile_c_code(compile_dir) + if auto_remove then + sys.system("rm -r -- '{root_compile_dir.escape_to_sh}/'") + end + time1 = get_time self.toolcontext.info("*** END COMPILING C: {time1-time0} ***", 2) end -- 1.7.9.5