better report genration target (lcov needs a patch)
[platform/upstream/gstreamer.git] / Makefile.am
1 PACKAGE = @PACKAGE@
2 VERSION = @VERSION@
3
4 if BUILD_DOCS
5 SUBDIRS_DOCS = docs
6 else
7 SUBDIRS_DOCS =
8 endif
9
10 if BUILD_TESTS
11 ## SUBDIRS_TESTS = tests testsuite
12 ## FIXME: write tests from scratch
13 SUBDIRS_TESTS =
14 if HAVE_CHECK
15 SUBDIRS_CHECK = check
16 else
17 SUBDIRS_CHECK =
18 endif
19 else
20 SUBDIRS_TESTS =
21 SUBDIRS_CHECK =
22 endif
23
24 if BUILD_EXAMPLES
25 ## FIXME: write examples from scratch
26 # SUBDIRS_EXAMPLES = examples
27 SUBDIRS_EXAMPLES =
28 else
29 SUBDIRS_EXAMPLES =
30 endif
31
32 all-local: gst-element-check-@GST_MAJORMINOR@.m4
33
34 gst-element-check-@GST_MAJORMINOR@.m4: gst-element-check.m4
35         cp $(srcdir)/gst-element-check.m4 gst-element-check-@GST_MAJORMINOR@.m4
36
37 ACLOCAL_AMFLAGS = -I common/m4
38
39 aclocaldir = $(datadir)/aclocal
40 aclocal_DATA = gst-element-check-@GST_MAJORMINOR@.m4
41
42 SUBDIRS = \
43         include gst libs tools \
44         $(SUBDIRS_CHECK) \
45         $(SUBDIRS_TESTS) \
46         $(SUBDIRS_EXAMPLES) \
47         pkgconfig po \
48         common \
49         $(SUBDIRS_DOCS)
50
51 # These are all the possible subdirs
52 DIST_SUBDIRS = \
53         include libs gst \
54         tools \
55         check \
56         tests testsuite \
57         examples \
58         pkgconfig \
59         po \
60         common \
61         docs
62
63 win32 = $(shell cat $(top_srcdir)/win32/MANIFEST)
64
65 debug:
66         echo $(win32)
67 EXTRA_DIST = \
68         gstreamer.spec gstreamer.spec.in gst-element-check.m4 \
69         configure.ac autogen.sh depcomp \
70         REQUIREMENTS ABOUT-NLS DOCBUILDING DEVEL RELEASE \
71         $(win32) \
72         idiottest.mak
73
74 CLEANFILES = gst-element-check-@GST_MAJORMINOR@.m4
75
76 include $(top_srcdir)/idiottest.mak
77 include $(top_srcdir)/common/release.mak
78 include $(top_srcdir)/common/po.mak
79
80
81 if GST_GCOV_ENABLED
82 clean-gcov:
83         find -name "*.da" -o -name "*.gcov" | xargs rm || true
84
85 clean-bbg:
86         find -name "*.bbg" -o -name "*.bb" | xargs rm || true
87
88 GCOV_DIRS=gst libs
89
90 ## .PHONY so it always rebuilds it
91 .PHONY: coverage-report.txt test-coverage-report.html
92
93 coverage-report.txt:
94         BBG_FILES=`find $(GCOV_DIRS) -name "*.bbg"` ;                     \
95         C_FILES= ;                                                        \
96         for F in $$BBG_FILES ; do                                         \
97                 F_nolibs=`echo $$F | sed -e 's/.libs\///g'` ;             \
98                 C=`echo $$F_nolibs | sed -e 's/.bbg/.c/g'` ;              \
99                 B=`basename $$F .bbg` ;                                   \
100                 D=`dirname $$F` ;                                         \
101                 DA=`echo $$F | sed -e 's/.bbg/.da/g'` ;                   \
102                 DA_libs=`echo $$D/.libs/$$B/.da` ;                        \
103                 if test -e $$DA || test -e $$DA_libs; then                \
104                         C_FILES="$$C_FILES $$C" ;                         \
105                 fi ;                                                      \
106         done ;                                                            \
107         echo $$C_FILES ;                                                  \
108         $(top_builddir)/testsuite/decode-gcov --report $$C_FILES > coverage-report.txt
109
110 test-coverage-report.html:
111         mkdir -p ./coverage
112         lcov --directory . --zerocounters
113         -$(MAKE) check
114         lcov --directory . --capture --output-file ./coverage/$(PACKAGE).info
115         genhtml -o ./coverage --num-spaces 2 ./coverage/$(PACKAGE).info
116         
117 check-coverage: clean-gcov all check coverage-report.txt
118         cat coverage-report.txt
119
120 else
121 coverage-report.txt:
122         echo "Need to reconfigure with --enable-gcov"
123         
124 test-coverage-report.html:
125         echo "Need to reconfigure with --enable-gcov"
126
127 check-coverage:
128         echo "Need to reconfigure with --enable-gcov"
129 endif