Compilar programes a la carpeta p*/out

Change-Id: I8e33aa1ea123b0500af1336185d2c8460fefb153
diff --git a/quad10/fenomens/lab/p2/Makefile b/quad10/fenomens/lab/p2/Makefile
index 1849ab9..e015968 100644
--- a/quad10/fenomens/lab/p2/Makefile
+++ b/quad10/fenomens/lab/p2/Makefile
@@ -1,10 +1,14 @@
+.PHONY: all make_out_folder
+
 all: P2-exercici-1.o MC-1.o
-P2-exercici-1.o: mt19937ar.o writeconfig.o magne.o energ.o P2-exercici-1.f90
+make_out_folder:
+	mkdir -p out
+P2-exercici-1.o: make_out_folder mt19937ar.o writeconfig.o magne.o energ.o P2-exercici-1.f90
 	gfortran -c P2-exercici-1.f90
-	gfortran P2-exercici-1.o writeconfig.o mt19937ar.o magne.o energ.o -o e1
-MC-1.o: mt19937ar.o writeconfig.o magne.o energ.o MC-1.f90
+	gfortran P2-exercici-1.o writeconfig.o mt19937ar.o magne.o energ.o -o out/e1
+MC-1.o: make_out_folder mt19937ar.o writeconfig.o magne.o energ.o MC-1.f90
 	gfortran -c MC-1.f90
-	gfortran MC-1.o writeconfig.o mt19937ar.o magne.o energ.o -o mc1
+	gfortran MC-1.o writeconfig.o mt19937ar.o magne.o energ.o -o out/mc1
 mt19937ar.o: mt19937ar.f
 	f77 -c mt19937ar.f
 writeconfig.o: writeconfig.f90
@@ -15,4 +19,4 @@
 	gfortran -c energ.f90
 
 clean:
-	rm -f configuration.eps configuration.tex configuration.svg configuration.conf e1 mc1 *.o
+	rm -rf out *.o