summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/m4/check_cc.m42
-rw-r--r--source4/build/smb_build/makefile.pm5
-rw-r--r--source4/main.mk1
-rw-r--r--source4/torture/config.mk12
4 files changed, 18 insertions, 2 deletions
diff --git a/source4/build/m4/check_cc.m4 b/source4/build/m4/check_cc.m4
index 8e402f102c..eaf40f1b53 100644
--- a/source4/build/m4/check_cc.m4
+++ b/source4/build/m4/check_cc.m4
@@ -127,3 +127,5 @@ fi
# allow for --with-hostcc=gcc
AC_ARG_WITH(hostcc,[ --with-hostcc=compiler choose host compiler],[HOSTCC=$withval],[HOSTCC=$CC])
AC_SUBST(HOSTCC)
+
+AC_PATH_PROG(GCOV,gcov)
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 82bcd90b22..f6619416ab 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -77,13 +77,14 @@ CC=$config{CC}
CFLAGS=-I\$(srcdir)/include -I\$(srcdir) -D_SAMBA_BUILD_ -DHAVE_CONFIG_H -I\$(srcdir)/lib $config{CFLAGS} $config{CPPFLAGS}
LD=$config{LD}
-LD_FLAGS=$config{LDFLAGS} -Lbin
+GCOV=$config{GCOV}
+LD_FLAGS=$config{LDFLAGS}
STLD=$config{AR}
STLD_FLAGS=-rc
SHLD=$config{CC}
-SHLD_FLAGS=$config{LDSHFLAGS} -Lbin
+SHLD_FLAGS=$config{LDSHFLAGS}
XSLTPROC=$config{XSLTPROC}
diff --git a/source4/main.mk b/source4/main.mk
index fae77d4953..b87d875ce1 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -78,6 +78,7 @@ showflags:
@echo " LD_FLAGS = $(LD_FLAGS)"
@echo " STLD_FLAGS = $(STLD_FLAGS)"
@echo " SHLD_FLAGS = $(SHLD_FLAGS)"
+ @echo " LIBS = $(LIBS)"
install: showlayout installbin installdat installswat installmisc
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index c0ce3dacd3..a1fa5278b1 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -281,3 +281,15 @@ REQUIRED_SUBSYSTEMS = \
MANPAGE = torture/man/locktest.1
# End BINARY locktest
#################################
+
+GCOV_FLAGS = -ftest-coverage -fprofile-arcs
+GCOV_LIBS = -lgcov
+
+gcov:
+ @$(MAKE) test \
+ CFLAGS="$(CFLAGS) $(GCOV_FLAGS)" \
+ LD_FLAGS="$(LD_FLAGS) $(GCOV_FLAGS)" \
+ LIBS="$(LIBS) $(GCOV_LIBS)"
+ for I in $(sort $(dir $(_ALL_OBJS_OBJS))); \
+ do $(GCOV) -p -o $$I $$I/*.c; \
+ done