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
12libs:
13	@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs
14
15EXTRA_DIST += CMakeLists.txt
16
17EXTRA_DIST += fonts
18
19LINK = $(CXXLINK)
20
21if HAVE_GLIB
22AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS)
23LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS)
24
25EXTRA_DIST += hb-test.h hb-subset-test.h
26
27check_PROGRAMS = $(TEST_PROGS)
28noinst_PROGRAMS = $(TEST_PROGS)
29
30TEST_PROGS = \
31	test-aat-layout \
32	test-baseline \
33	test-blob \
34	test-buffer \
35	test-collect-unicodes \
36	test-common \
37	test-font \
38	test-map \
39	test-object \
40	test-ot-face \
41	test-set \
42	test-shape \
43	test-subset \
44	test-subset-cmap \
45	test-subset-glyf \
46	test-subset-hdmx \
47	test-subset-hmtx \
48	test-subset-os2 \
49	test-subset-post \
50	test-subset-vmtx \
51	test-subset-cff1 \
52	test-subset-cff2 \
53	test-unicode \
54	test-version \
55	$(NULL)
56
57test_subset_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
58test_subset_codepoints_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
59test_subset_cmap_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
60test_subset_glyf_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
61test_subset_hdmx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
62test_subset_hmtx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
63test_subset_os2_LDADD  = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
64test_subset_post_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
65test_subset_vmtx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
66test_subset_cff1_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
67test_subset_cff2_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
68
69test_unicode_CPPFLAGS = \
70	$(AM_CPPFLAGS) \
71	$(GLIB_CFLAGS) \
72	$(NULL)
73test_unicode_LDADD = $(LDADD)
74if HAVE_ICU
75test_unicode_CPPFLAGS += $(ICU_CFLAGS)
76test_unicode_LDADD += $(top_builddir)/src/libharfbuzz-icu.la $(ICU_LIBS)
77endif
78
79
80TEST_PROGS += \
81	test-ot-color \
82	test-ot-ligature-carets \
83	test-ot-name \
84	test-ot-tag \
85	test-ot-extents-cff \
86	$(NULL)
87
88
89if HAVE_PTHREAD
90if HAVE_FREETYPE
91TEST_PROGS += test-multithread
92test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) $(FREETYPE_CFLAGS)
93test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) $(FREETYPE_LIBS)
94# The auto-generated link rule somehow includes CFLAGS as well.  Without
95# it, pthread link fails, because, who knows why, $PTHREAD_LIBS is empty.
96test_multithread_LINK = $(LINK) $(PTHREAD_CFLAGS)
97endif
98endif
99
100if HAVE_FREETYPE
101TEST_PROGS += \
102	test-ot-math \
103	$(NULL)
104test_ot_math_LDADD = $(LDADD) $(FREETYPE_LIBS)
105test_ot_math_CPPFLAGS = $(AM_CPPFLAGS) $(FREETYPE_CFLAGS)
106endif # HAVE_FREETYPE
107
108
109# Tests for header compilation
110TEST_PROGS += \
111	test-c \
112	test-cplusplus \
113	$(NULL)
114test_cplusplus_SOURCES = test-cplusplus.cc
115test_c_CPPFLAGS = $(AM_CPPFLAGS)
116test_cplusplus_CPPFLAGS = $(AM_CPPFLAGS)
117if HAVE_ICU
118test_c_CPPFLAGS += $(ICU_CFLAGS)
119test_cplusplus_CPPFLAGS += $(ICU_CFLAGS)
120endif
121if HAVE_FREETYPE
122test_c_CPPFLAGS += $(FREETYPE_CFLAGS)
123test_cplusplus_CPPFLAGS += $(FREETYPE_CFLAGS)
124endif
125
126# Default test running environment
127TESTS = $(TEST_PROGS)
128TESTS_ENVIRONMENT = \
129	MALLOC_CHECK_=2 \
130	MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) \
131	G_DEBUG=gc-friendly \
132	G_SLICE=always-malloc \
133	srcdir=$(srcdir) \
134	G_TEST_SRCDIR=$(abs_srcdir) \
135	G_TEST_BUILDDIR=$(abs_builddir) \
136	$(NULL)
137
138
139# check-tool: Run tests under $(TOOL)
140check-tool:
141	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
142	TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute \
143	env $(TOOL)'
144# check-tool-raw: Run tests under $(TOOL), but don't run under libtool
145check-tool-raw:
146	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
147	TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) \
148	env $(TOOL)'
149
150# check-gtester: Run tests under gtester
151GTESTER = gtester
152check-gtester:
153	$(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool-raw TOOL="$(GTESTER) --verbose --keep-going"
154
155
156# Check tests under valgrind.  Saves log to log-valgrind.txt
157VALGRIND_FLAGS = \
158	--tool=memcheck \
159	--track-origins=yes \
160	--leak-check=yes \
161	$(EXTRA_VALGRIND_FLAGS)
162#	Can't do for now: --show-reachable=yes
163CLEANFILES +=  log-valgrind.txt
164valgrind_verbose = $(valgrind_verbose_@AM_V@)
165valgrind_verbose_ = $(valgrind_verbose_@AM_DEFAULT_V@)
166valgrind_verbose_0 = | \
167	grep '\(^[^=]\|ERROR SUMMARY\|definitely lost\|indirectly lost\)' | grep -v ': 0'
168# TODO: The following check does not fail if valgrind finds error.  It should.
169check-valgrind:
170	$(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool TOOL="valgrind $(VALGRIND_FLAGS)" \
171	2>&1 | tee log-valgrind.txt $(valgrind_verbose)
172
173
174# check-symbols: Finds untested API symbols
175symbols-tested.txt: $(TEST_PROGS)
176	$(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
177	| grep ' U hb_' | sed 's/.* U hb_/hb_/' \
178	| sort | uniq > $@.tmp && mv $@.tmp $@
179symbols-tested-or-deprecated.txt: symbols-tested.txt $(top_builddir)/src/harfbuzz-deprecated-symbols.txt
180	$(AM_V_GEN)cat $^ | sort | uniq > $@.tmp; mv $@.tmp $@
181symbols-exported.txt: $(top_builddir)/src/.libs/libharfbuzz.so
182	$(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
183	| grep ' T ' | sed 's/.* T //' | grep -v '^\(_init\|_fini\)$$' \
184	| sort | uniq > $@.tmp && mv $@.tmp $@
185symbols-untested.txt: symbols-tested-or-deprecated.txt symbols-exported.txt
186	$(AM_V_GEN)diff $^ > $@.tmp; mv $@.tmp $@
187CLEANFILES += symbols-tested.txt \
188	symbols-exported.txt \
189	symbols-untested.txt \
190	symbols-tested-or-deprecated.txt
191check-symbols: symbols-untested.txt
192	@! cat $^ | grep .
193
194
195
196else # !HAVE_GLIB
197check-am: err-glib
198err-glib:
199	@echo "You need to have glib support enabled to run the tests"
200	@exit 77
201endif # HAVE_GLIB
202
203.PHONY: check-symbols check-tool check-valgrind
204
205-include $(top_srcdir)/git.mk
206