diff --git a/src/Makefile.am b/src/Makefile.am
index 72e6772002bf55762d6da9547cebb0f7cbc1739b..d8c0c7da372f75c9b38a0ddc72280f4c3ffc9366 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,6 +21,9 @@
 ###########################################################################
 AUTOMAKE_OPTIONS = foreign nostdinc
 
+# remove targets if the command fails
+.DELETE_ON_ERROR:
+
 # Specify our include paths here, and do it relative to $(top_srcdir) and
 # $(top_builddir), to ensure that these paths which belong to the library
 # being currently built and tested are searched before the library which