diff --git a/Makefile b/Makefile
index 546890212173e075f2eb022b13362ae929224892..cf0ccce026ec5937e7a71dadf4bb8541861d1554 100644
--- a/Makefile
+++ b/Makefile
@@ -3,13 +3,13 @@ CFLAGS = -g -O0 -Wall
 all: swiftmpistepsim swiftmpiproxies exchange-test
 
 swiftmpistepsim: swiftmpistepsim.c mpiuse.c mpiuse.h atomic.h cycle.h clocks.h clocks.c
-	$(CC) $(CFLAGS) -o swiftmpistepsim swiftmpistepsim.c mpiuse.c clocks.c -I/usr/include/mpi -lmpi -lpthread
+	mpicc $(CFLAGS) -o swiftmpistepsim swiftmpistepsim.c mpiuse.c clocks.c
 
 swiftmpiproxies: swiftmpiproxies.c mpiuse.c mpiuse.h atomic.h cycle.h clocks.h clocks.c
-	$(CC) $(CFLAGS) -o swiftmpiproxies swiftmpiproxies.c mpiuse.c clocks.c -I/usr/include/mpi -lmpi -lpthread
+	mpicc $(CFLAGS) -o swiftmpiproxies swiftmpiproxies.c mpiuse.c clocks.c
 
 exchange-test: exchange-test.c
-	$(CC) $(CFLAGS) -o exchange-test exchange-test.c -I/usr/include/mpi -lmpi -lpthread
+	mpicc $(CFLAGS) -o exchange-test exchange-test.c
 
 clean:
 	rm -f swiftmpistepsim