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