Index: Jenkinsfile
===================================================================
--- Jenkinsfile	(revision 02559df1767200115484b32e7d7706404cb6e01c)
+++ Jenkinsfile	(revision 0dc3ac36329221db84e6ca22f7037f73c2cda234)
@@ -32,4 +32,6 @@
 			prepare_build()
 
+			clean()
+
 			checkout()
 
@@ -41,6 +43,4 @@
 
 			benchmark()
-
-			clean()
 
 			build_doc()
@@ -241,4 +241,17 @@
 // Main compilation routines
 //===========================================================================================================
+def clean() {
+	build_stage('Cleanup') {
+		// clean the build by wipping the build directory
+		sh "rm -rf ${builddir}/*"
+
+		//Clean all temporary files to make sure no artifacts of the previous build remain
+		sh 'git clean -fdqx'
+
+		//Reset the git repo so no local changes persist
+		sh 'git reset --hard'
+	}
+}
+
 //Compilation script is done here but environnement set-up and error handling is done in main loop
 def checkout() {
@@ -246,10 +259,4 @@
 		//checkout the source code and clean the repo
 		checkout scm
-
-		//Clean all temporary files to make sure no artifacts of the previous build remain
-		sh 'git clean -fdqx'
-
-		//Reset the git repo so no local changes persist
-		sh 'git reset --hard'
 	}
 }
@@ -258,13 +265,13 @@
 	build_stage('Build') {
 
-		def install_dir = pwd tmp: true
+		builddir = pwd tmp: true
+		srcdir   = pwd tmp: false
 
 		// Build outside of the src tree to ease cleaning
-		sh "mkdir -p build"
-		dir ('build') {
+		dir (builddir) {
 			//Configure the conpilation (Output is not relevant)
 			//Use the current directory as the installation target so nothing escapes the sandbox
 			//Also specify the compiler by hand
-			sh "../configure CXX=${compiler.cpp_cc} ${architecture} --with-backend-compiler=${compiler.cfa_cc} --prefix=${install_dir} --enable-silent-rules --quiet"
+			sh "${srcdir}/configure CXX=${compiler.cpp_cc} ${architecture} --with-backend-compiler=${compiler.cfa_cc} --enable-silent-rules --quiet"
 
 			//Compile the project
@@ -277,11 +284,13 @@
 	build_stage('Test') {
 
-		//Run the tests from the tests directory
-		if ( do_alltests ) {
-			sh 'make -C build/src/tests all-tests debug=yes --no-print-directory'
-			sh 'make -C build/src/tests all-tests debug=no --no-print-directory'
-		}
-		else {
-			sh 'make -C build/src/tests --no-print-directory'
+		dir (builddir) {
+			//Run the tests from the tests directory
+			if ( do_alltests ) {
+				sh 'make --no-print-directory -C src/tests all-tests debug=yes'
+				sh 'make --no-print-directory -C src/tests all-tests debug=no '
+			}
+			else {
+				sh 'make --no-print-directory -C src/tests'
+			}
 		}
 	}
@@ -293,13 +302,8 @@
 		if( !do_benchmark ) return
 
-		//Append bench results
-		sh 'make -C build/src/benchmark --no-print-directory jenkins githash=' + gitRefNewValue + ' arch=' + arch_name + ' | tee bench.json'
-	}
-}
-
-def clean() {
-	build_stage('Cleanup') {
-		// clean the build by wipping the build directory
-		sh 'rm -rf build'
+		dir (builddir) {
+			//Append bench results
+			sh "make --no-print-directory -C src/benchmark jenkins githash=${gitRefNewValue} arch=${arch_name} | tee ${srcdir}/bench.json"
+		}
 	}
 }
