Compilar programes a la carpeta p*/out

Change-Id: I8e33aa1ea123b0500af1336185d2c8460fefb153
diff --git a/quad10/fenomens/lab/p1/Makefile b/quad10/fenomens/lab/p1/Makefile
index 1f95dc8..b02418a 100644
--- a/quad10/fenomens/lab/p1/Makefile
+++ b/quad10/fenomens/lab/p1/Makefile
@@ -1,13 +1,17 @@
+.PHONY: all make_out_folder
+
 all: P1-exercici-1.o P1-exercici-2.o P1-exercici-3.o
-P1-exercici-1.o: mt19937ar.o P1-exercici-1.f90
+make_out_folder:
+	mkdir -p out
+P1-exercici-1.o: make_out_folder mt19937ar.o P1-exercici-1.f90
 	gfortran -c P1-exercici-1.f90
-	gfortran P1-exercici-1.o mt19937ar.o -o P1-exercici-1
-P1-exercici-2.o: mt19937ar.o writeconfig.o P1-exercici-2.f90
+	gfortran P1-exercici-1.o mt19937ar.o -o out/P1-exercici-1
+P1-exercici-2.o: make_out_folder mt19937ar.o writeconfig.o P1-exercici-2.f90
 	gfortran -c P1-exercici-2.f90
-	gfortran P1-exercici-2.o writeconfig.o mt19937ar.o -o P1-exercici-2
-P1-exercici-3.o: mt19937ar.o writeconfig.o magne.o P1-exercici-3.f90
+	gfortran P1-exercici-2.o writeconfig.o mt19937ar.o -o out/P1-exercici-2
+P1-exercici-3.o: make_out_folder mt19937ar.o writeconfig.o magne.o P1-exercici-3.f90
 	gfortran -c P1-exercici-3.f90
-	gfortran P1-exercici-3.o writeconfig.o mt19937ar.o magne.o -o P1-exercici-3
+	gfortran P1-exercici-3.o writeconfig.o mt19937ar.o magne.o -o out/P1-exercici-3
 mt19937ar.o: mt19937ar.f
 	f77 -c mt19937ar.f
 writeconfig.o: writeconfig.f90
@@ -16,4 +20,4 @@
 	gfortran -c magne.f90
 
 clean:
-	rm -f configuration.eps configuration.tex configuration.svg P1-exercici-1 P1-exercici-2 P1-exercici-3 *.o
+	rm -rf configuration.eps configuration.tex configuration.svg *.o out