From: Jean Privat Date: Thu, 28 May 2015 15:08:46 +0000 (-0400) Subject: compiler: remove the compilation directory unless explicitely set X-Git-Tag: v0.7.5~3^2~5 X-Git-Url: http://nitlanguage.org compiler: remove the compilation directory unless explicitely set Signed-off-by: Jean Privat --- 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