Makefile.am: Add check-exports target and run it as part of 'make check' (see #499140...
[platform/upstream/gstreamer.git] / Makefile.am
1 DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --enable-docbook
2
3 all-local: gst-element-check-@GST_MAJORMINOR@.m4
4
5 gst-element-check-@GST_MAJORMINOR@.m4: gst-element-check.m4
6         cp gst-element-check.m4 gst-element-check-@GST_MAJORMINOR@.m4
7
8 ACLOCAL_AMFLAGS = -I common/m4
9
10 aclocaldir = $(datadir)/aclocal
11 aclocal_DATA = gst-element-check-@GST_MAJORMINOR@.m4
12
13 SUBDIRS = \
14         gst libs plugins tools tests \
15         docs \
16         pkgconfig po \
17         common
18
19 # These are all the possible subdirs
20 DIST_SUBDIRS = \
21         gst libs plugins tools tests \
22         docs \
23         pkgconfig po \
24         common
25
26 win32 = $(shell cat $(top_srcdir)/win32/MANIFEST)
27
28 debug:
29         echo $(win32)
30
31 EXTRA_DIST = \
32         gstreamer.spec gstreamer.spec.in \
33         gst-element-check.m4.in \
34         configure.ac autogen.sh depcomp \
35         MAINTAINERS ABOUT-NLS RELEASE gstreamer.doap \
36         $(win32)
37
38 CLEANFILES = gst-element-check-@GST_MAJORMINOR@.m4
39
40 include $(top_srcdir)/common/release.mak
41 include $(top_srcdir)/common/po.mak
42
43 if GST_GCOV_ENABLED
44 clean-gcov:
45         find -name "*.da" -o -name "*.gcov" | xargs rm || true
46
47 clean-bbg:
48         find -name "*.bbg" -o -name "*.bb" | xargs rm || true
49
50 GCOV_DIRS=gst libs
51
52 ## .PHONY so it always rebuilds it
53 .PHONY: coverage-report.txt test-coverage-report.html lcov
54
55 coverage-report.txt:
56         BBG_FILES=`find $(GCOV_DIRS) -name "*.bbg"` ;                     \
57         C_FILES= ;                                                        \
58         for F in $$BBG_FILES ; do                                         \
59                 F_nolibs=`echo $$F | sed -e 's/.libs\///g'` ;             \
60                 C=`echo $$F_nolibs | sed -e 's/.bbg/.c/g'` ;              \
61                 B=`basename $$F .bbg` ;                                   \
62                 D=`dirname $$F` ;                                         \
63                 DA=`echo $$F | sed -e 's/.bbg/.da/g'` ;                   \
64                 DA_libs=`echo $$D/.libs/$$B/.da` ;                        \
65                 if test -e $$DA || test -e $$DA_libs; then                \
66                         C_FILES="$$C_FILES $$C" ;                         \
67                 fi ;                                                      \
68         done ;                                                            \
69         echo $$C_FILES ;                                                  \
70         $(top_builddir)/testsuite/decode-gcov --report $$C_FILES > coverage-report.txt
71
72 test-coverage-report.html:
73         mkdir -p ./coverage
74         lcov --directory . --zerocounters
75         -$(MAKE) check
76         lcov --directory . --capture --output-file ./coverage/$(PACKAGE).info
77         genhtml -o ./coverage --num-spaces 2 ./coverage/$(PACKAGE).info
78         
79 check-coverage: clean-gcov all check coverage-report.txt
80         cat coverage-report.txt
81
82 else
83 coverage-report.txt:
84         echo "Need to reconfigure with --enable-gcov"
85         
86 test-coverage-report.html:
87         echo "Need to reconfigure with --enable-gcov"
88
89 check-coverage:
90         echo "Need to reconfigure with --enable-gcov"
91 endif
92
93 if HAVE_CHECK
94 check-valgrind:
95         cd tests/check && make check-valgrind
96
97 check-torture:
98         cd tests/check && make torture
99 else
100 check-valgrind:
101         echo "'check' library not installed, skipping"
102
103 check-torture:
104         echo "'check' library not installed, skipping"
105 endif
106
107 # FIXME: this target should be run every time we do "make release"
108 # find a way of automating that
109 win32-update:
110         for f in gstversion.h gstenumtypes.c gstenumtypes.h; do \
111                 cp $(top_builddir)/gst/$$f win32/common; done
112         $(top_srcdir)/tools/gst-indent win32/common/gstenumtypes.c
113
114 include $(top_srcdir)/common/coverage/lcov.mak
115
116 # make sure all symbols we export on linux are defined in the win32 .def too
117 # (don't care about other unixes for now, it's enough if it works on one of
118 # the linux build bots; we assume .so )
119 corelibs='libgstreamer libgstbase libgstcontroller libgstdataprotocol libgstnet'
120 check-exports:
121         for l in `eval echo $(corelibs)`; do \
122           libso=`find "$(top_builddir)" -name "$$l-0.10.so"`; \
123           libdef="$(top_srcdir)/win32/common/$$l.def"; \
124           if test "x$$libso" != "x"; then \
125             echo Checking symbols in $$libso; \
126             $(top_srcdir)/common/check-exports $$libdef $$libso || exit 1; \
127           fi; \
128         done
129
130 check: check-exports
131
132