diff --git a/tests/Makefile.am b/tests/Makefile.am
index d0c132ad1b6dadd749a389fb71b873120b48139a..163a9ad096ddc2a79489de2930bb1d4288d1eb3e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Add the source directory and debug to CFLAGS
-AM_CFLAGS = -I../src $(HDF5_CPPFLAGS) -DTIMER
+AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) -DTIMER
 
 
 AM_LDFLAGS = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS)