Commit the vanila glib 2.27.5 with old debian directory
[external/glib2.0.git] / Makefile.decl
1 # GLIB - Library of useful C routines
2
3 #GTESTER = gtester                      # for non-GLIB packages
4 GTESTER = $(top_builddir)/glib/gtester                  # for the GLIB package
5 GTESTER_REPORT = $(top_builddir)/glib/gtester-report    # for the GLIB package
6
7 # initialize variables for unconditional += appending
8 EXTRA_DIST =
9 TEST_PROGS =
10
11 ### testing rules
12
13 # test: run all tests in cwd and subdirs
14 test: test-nonrecursive
15 if OS_UNIX
16         @ for subdir in $(SUBDIRS) . ; do \
17             test "$$subdir" = "." -o "$$subdir" = "po" || \
18             ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
19           done
20 endif
21
22 # test-nonrecursive: run tests only in cwd
23 test-nonrecursive: ${TEST_PROGS}
24 if OS_UNIX
25         @test -z "${TEST_PROGS}" || MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
26 endif
27
28 # test-report: run tests in subdirs and generate report
29 # perf-report: run tests in subdirs with -m perf and generate report
30 # full-report: like test-report: with -m perf and -m slow
31 test-report perf-report full-report:    ${TEST_PROGS}
32         @test -z "${TEST_PROGS}" || { \
33           case $@ in \
34           test-report) test_options="-k";; \
35           perf-report) test_options="-k -m=perf";; \
36           full-report) test_options="-k -m=perf -m=slow";; \
37           esac ; \
38           if test -z "$$GTESTER_LOGDIR" ; then  \
39             ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
40           elif test -n "${TEST_PROGS}" ; then \
41             ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
42           fi ; \
43         }
44         @ ignore_logdir=true ; \
45           if test -z "$$GTESTER_LOGDIR" ; then \
46             GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
47             ignore_logdir=false ; \
48           fi ; \
49           for subdir in $(SUBDIRS) . ; do \
50             test "$$subdir" = "." -o "$$subdir" = "po" || \
51             ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
52           done ; \
53           $$ignore_logdir || { \
54             echo '<?xml version="1.0"?>'            > $@.xml ; \
55             echo '<report-collection>'             >> $@.xml ; \
56             echo '<info>'                          >> $@.xml ; \
57             echo '  <package>$(PACKAGE)</package>' >> $@.xml ; \
58             echo '  <version>$(VERSION)</version>' >> $@.xml ; \
59             echo '</info>'                         >> $@.xml ; \
60             for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
61               sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
62             done ; \
63             echo >> $@.xml ; \
64             echo '</report-collection>' >> $@.xml ; \
65             rm -rf "$$GTESTER_LOGDIR"/ ; \
66             ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
67           }
68 .PHONY: test test-report perf-report full-report test-nonrecursive
69
70 .PHONY: lcov genlcov lcov-clean
71 # use recursive makes in order to ignore errors during check
72 lcov:
73         -$(MAKE) $(AM_MAKEFLAGS) -k check
74         $(MAKE) $(AM_MAKEFLAGS) genlcov
75
76 # we have to massage the lcov.info file slightly to hide the effect of libtool
77 # placing the objects files in the .libs/ directory separate from the *.c
78 # we also have to delete tests/.libs/libmoduletestplugin_*.gcda
79 genlcov:
80         rm -f $(top_builddir)/tests/.libs/libmoduletestplugin_*.gcda
81         $(LTP) --directory $(top_builddir) --capture --output-file glib-lcov.info --test-name GLIB_PERF --no-checksum --compat-libtool
82         LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory glib-lcov --title "GLib Code Coverage" --legend --show-details glib-lcov.info
83
84 lcov-clean:
85         -$(LTP) --directory $(top_builddir) -z
86         -rm -rf glib-lcov.info glib-lcov
87         -find -name '*.gcda' -print | xargs rm
88
89 # run tests in cwd as part of make check
90 check-local: test-nonrecursive