1# Process this file with automake to produce Makefile.in
2
3NULL =
4EXTRA_DIST =
5CLEANFILES =
6DISTCLEANFILES =
7MAINTAINERCLEANFILES =
8
9# Convenience targets:
10lib:
11	@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
12
13if HAVE_GLIB
14AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS)
15LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS)
16
17EXTRA_DIST += hb-test.h
18
19check_PROGRAMS = $(TEST_PROGS)
20noinst_PROGRAMS = $(TEST_PROGS)
21
22TEST_PROGS = \
23	test-blob \
24	test-buffer \
25	test-common \
26	test-font \
27	test-object \
28	test-set \
29	test-shape \
30	test-unicode \
31	test-version \
32	$(NULL)
33
34test_unicode_CPPFLAGS = $(AM_CPPFLAGS)
35test_unicode_LDADD = $(LDADD)
36if HAVE_GLIB
37test_unicode_CPPFLAGS += $(GLIB_CFLAGS)
38endif
39if HAVE_ICU
40test_unicode_CPPFLAGS += $(ICU_CFLAGS)
41test_unicode_LDADD += $(top_builddir)/src/libharfbuzz-icu.la $(ICU_LIBS)
42endif
43
44
45if HAVE_OT
46TEST_PROGS += \
47	test-ot-tag \
48	$(NULL)
49endif
50
51# Tests for header compilation
52TEST_PROGS += \
53	test-c \
54	test-cplusplus \
55	$(NULL)
56test_cplusplus_SOURCES = test-cplusplus.cc
57test_c_CPPFLAGS = $(AM_CPPFLAGS)
58test_cplusplus_CPPFLAGS = $(AM_CPPFLAGS)
59if HAVE_ICU
60test_c_CPPFLAGS += $(ICU_CFLAGS)
61test_cplusplus_CPPFLAGS += $(ICU_CFLAGS)
62endif
63if HAVE_FREETYPE
64test_c_CPPFLAGS += $(FREETYPE_CFLAGS)
65test_cplusplus_CPPFLAGS += $(FREETYPE_CFLAGS)
66endif
67
68# Default test running environment
69TESTS = $(TEST_PROGS)
70TESTS_ENVIRONMENT = \
71	MALLOC_CHECK_=2 \
72	MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) \
73	G_DEBUG=gc-friendly \
74	G_SLICE=always-malloc \
75	srcdir=$(srcdir) \
76	$(NULL)
77
78
79# check-tool: Run tests under $(TOOL)
80check-tool:
81	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
82	TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute \
83	env $(TOOL)'
84# check-tool-raw: Run tests under $(TOOL), but don't run under libtool
85check-tool-raw:
86	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
87	TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) \
88	env $(TOOL)'
89
90# check-gtester: Run tests under gtester
91GTESTER = gtester
92check-gtester:
93	$(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool-raw TOOL="$(GTESTER) --verbose --keep-going"
94
95
96# Check tests under valgrind.  Saves log to log-valgrind.txt
97VALGRIND_FLAGS = \
98	--tool=memcheck --suppressions=$(srcdir)/.valgrind-suppressions \
99	--track-origins=yes \
100	--leak-check=yes
101	$(EXTRA_VALGRIND_FLAGS)
102#	Can't do for now: --show-reachable=yes
103CLEANFILES +=  log-valgrind.txt
104valgrind_verbose = $(valgrind_verbose_@AM_V@)
105valgrind_verbose_ = $(valgrind_verbose_@AM_DEFAULT_V@)
106valgrind_verbose_0 = | \
107	grep '\(^[^=]\|ERROR SUMMARY\|definitely lost\|indirectly lost\)' | grep -v ': 0'
108# TODO: The following check does not fail if valgrind finds error.  It should.
109check-valgrind:
110	$(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool TOOL="valgrind $(VALGRIND_FLAGS)" \
111	2>&1 | tee log-valgrind.txt $(valgrind_verbose)
112
113
114# check-symbols: Finds untested API symbols
115symbols-tested.txt: $(TEST_PROGS)
116	$(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
117	| grep ' U hb_' | sed 's/.* U hb_/hb_/' \
118	| sort | uniq > $@.tmp && mv $@.tmp $@
119symbols-exported.txt: $(top_builddir)/src/.libs/libharfbuzz.so
120	$(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
121	| grep ' T ' | sed 's/.* T //' | grep -v '^\(_init\|_fini\)$$' \
122	| sort | uniq > $@.tmp && mv $@.tmp $@
123symbols-untested.txt: symbols-tested.txt symbols-exported.txt
124	$(AM_V_GEN)diff $^ > $@.tmp; mv $@.tmp $@
125CLEANFILES += symbols-tested.txt symbols-exported.txt symbols-untested.txt
126check-symbols: symbols-untested.txt
127	@! cat $^ | grep .
128
129
130
131else
132check-am: err-glib
133err-glib:
134	@echo "You need to have glib support enabled to run the tests"
135	@exit 77
136endif
137
138.PHONY: check-symbols check-tool check-valgrind
139
140-include $(top_srcdir)/git.mk
141