diff --git a/src/Makefile.am b/src/Makefile.am
index db4334ceb35f93d5663b2d54e0c4d714fd8fdfee..0eba1530737b270206329c33d14dee30c5a27500 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
 
 SUBDIRS =
 
-noinst_PROGRAMS = \
+check_PROGRAMS = \
 	test-gradient-method
 
 test_gradient_method_SOURCES = \
@@ -10,8 +10,7 @@ test_gradient_method_SOURCES = \
 	nicefunction.hh \
 	samplefunctional.hh
 
-check-am:
-	./test-gradient-method
+TESTS= test-gradient-method
 
 AM_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter