From 49f81ddb85a4460ae69569a87a0ea1ae264e3019 Mon Sep 17 00:00:00 2001
From: Matt Jordan <mjordan@digium.com>
Date: Sat, 27 Jun 2015 18:47:19 -0500
Subject: [PATCH] Makefile: Remove coverage files on 'make clean'

This patch updates a variety of Makefiles in Asterisk's build system to
remove .gcda and .gcno files when 'make clean' is executed. These files
are generated when '--enable-coverage' is passed to the Asterisk
configure script.

Change-Id: Ib70b41eea2ee2908885bff02e80faf9f40c84602
---
 Makefile.moddir_rules   | 1 +
 apps/Makefile           | 2 +-
 channels/Makefile       | 8 ++++----
 channels/misdn/Makefile | 2 +-
 pbx/Makefile            | 2 +-
 res/Makefile            | 8 +++++---
 6 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules
index 8d8351678c..7f1c8c843e 100644
--- a/Makefile.moddir_rules
+++ b/Makefile.moddir_rules
@@ -118,6 +118,7 @@ clean::
 	rm -f *.so *.o *.oo *.eo *.i *.ii
 	rm -f .*.d
 	rm -f *.s *.i
+	rm -f *.gcda *.gcno
 	rm -f modules.link
 
 install:: all
diff --git a/apps/Makefile b/apps/Makefile
index 1dfe8c8385..1e8be04d4c 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -28,7 +28,7 @@ all: _all
 include $(ASTTOPDIR)/Makefile.moddir_rules
 
 clean::
-	rm -f confbridge/*.o confbridge/*.i
+	rm -f confbridge/*.o confbridge/*.i confbridge/*.gcda confbridge/*.gcno
 
 $(if $(filter app_confbridge,$(EMBEDDED_MODS)),modules.link,app_confbridge.so): $(subst .c,.o,$(wildcard confbridge/*.c))
 $(subst .c,.o,$(wildcard confbridge/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,app_confbridge)
diff --git a/channels/Makefile b/channels/Makefile
index 1f4cff4c76..d1b895edde 100644
--- a/channels/Makefile
+++ b/channels/Makefile
@@ -25,10 +25,10 @@ endif
 
 clean::
 	$(MAKE) -C misdn clean
-	rm -f dahdi/*.o dahdi/*.i
-	rm -f sip/*.o sip/*.i
-	rm -f iax2/*.o iax2/*.i
-	rm -f pjsip/*.o pjsip/*.i
+	rm -f dahdi/*.o dahdi/*.i dahdi/*.gcda dahdi/*.gcno
+	rm -f sip/*.o sip/*.i sip/*.gcda sip/*.gcno
+	rm -f iax2/*.o iax2/*.i iax2/*.gcda iax2/*.gcno
+	rm -f pjsip/*.o pjsip/*.i pjsip/*.gcda pjsip/*.gcno
 
 $(if $(filter chan_iax2,$(EMBEDDED_MODS)),modules.link,chan_iax2.so): $(subst .c,.o,$(wildcard iax2/*.c))
 $(subst .c,.o,$(wildcard iax2/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_iax2)
diff --git a/channels/misdn/Makefile b/channels/misdn/Makefile
index 194bef5aea..96d5a2a3d2 100644
--- a/channels/misdn/Makefile
+++ b/channels/misdn/Makefile
@@ -14,4 +14,4 @@ portinfo: portinfo.o
 	$(CC) -o $@ $^ -lisdnnet -lmISDN -lpthread
 
 clean:
-	rm -rf *.a *.o *.so portinfo *.i
+	rm -rf *.a *.o *.so portinfo *.i *.gcda *.gcno
diff --git a/pbx/Makefile b/pbx/Makefile
index 0afc4bcad2..a031cdfa5f 100644
--- a/pbx/Makefile
+++ b/pbx/Makefile
@@ -24,7 +24,7 @@ ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
 endif
 
 clean::
-	rm -f ael/*.o ael/*.i
+	rm -f ael/*.o ael/*.i ael/*.gcda ael/*.gcno
 
 dundi-parser.o: dundi-parser.h
 dundi-parser.o: _ASTCFLAGS+=-I.
diff --git a/res/Makefile b/res/Makefile
index b98fb8e425..dbab9990c0 100644
--- a/res/Makefile
+++ b/res/Makefile
@@ -76,9 +76,11 @@ endif
 ael/pval.o: ael/pval.c
 
 clean::
-	rm -f snmp/*.[oi] ael/*.[oi] ais/*.[oi] ari/*.[oi]
-	rm -f res_pjsip/*.[oi] stasis/*.[oi]
-	rm -f parking/*.o parking/*.i stasis_recording/*.[oi]
+	rm -f snmp/*.o snmp/*.i ael/*.o ael/*.i ais/*.o ais/*.i snmp/*.gcda snmp/*.gcno ael/*.gcda ael/*.gcno
+	rm -f res_pjsip/*.[oi] res_pjsip/*.gcda res_pjsip/*.gcno
+	rm -f stasis/*.[oi] stasis/*.gcda stasis/*.gcno
+	rm -f parking/*.[oi] parking/*.gcda parking/*.gcno
+	rm -f stasis_recording/*.[oi] stasis_recording/*.gcda stasis_recording/*.gcno
 
 $(if $(filter res_parking,$(EMBEDDED_MODS)),modules.link,res_parking.so): $(subst .c,.o,$(wildcard parking/*.c))
 $(subst .c,.o,$(wildcard parking/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_parking)
-- 
GitLab