diff --git a/Makefile b/Makefile
index b04a283a1..d2cd9ff64 100644
--- a/Makefile
+++ b/Makefile
@@ -85,12 +85,8 @@ ifdef PROFILE
 endif
 
 ifdef COVERAGE
-	CFLAGS  += -fprofile-arcs -ftest-coverage
-	LDFLAGS += --coverage
-	LDLIBS  += -lgcov
-
-	LIB_LDFLAGS += -coverage
-	LIB_LDLIBS += -gcov
+	CFLAGS  += --coverage
+	LDLIBS += -lgcov
 
 	VARIANTS += coverage
 endif
diff --git a/tests/Makefile.inc b/tests/Makefile.inc
index 400aeefbe..6f7c61178 100644
--- a/tests/Makefile.inc
+++ b/tests/Makefile.inc
@@ -21,6 +21,11 @@
 ###################################################################################
 
 include tests/unit/Makefile.inc
+
+ifdef COVERAGE
+	include tests/unit/Makefile.gcov.inc
+endif
+
 include tests/integration/Makefile.inc
 
 tests: unit-tests integration-tests
diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc
index 045a03e7b..2bc53e1c4 100644
--- a/tests/unit/Makefile.inc
+++ b/tests/unit/Makefile.inc
@@ -40,10 +40,6 @@ $(BUILDDIR)/tests/unit/%.o: tests/unit/%.c | $$(dir $$@)
 $(BUILDDIR)/unit-tests: $(TEST_OBJS) $(LIB)
 	$(CC) $(TEST_LDFLAGS) $^ $(TEST_LDLIBS) -o $@
 
-ifdef COVERAGE
-	include tests/unit/Makefile.gcov.inc
-endif
-
 # Tests are not installed
 install-tests: