Makefile.am 4.1 KB
Newer Older
B
Behdad Esfahbod 已提交
1 2 3 4 5 6 7 8
# Process this file with automake to produce Makefile.in

NULL =
EXTRA_DIST =
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =

B
Minor  
Behdad Esfahbod 已提交
9 10 11 12
# Convenience targets:
lib:
	@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib

B
Behdad Esfahbod 已提交
13
if HAVE_GLIB
B
Behdad Esfahbod 已提交
14 15
AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS)
LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS)
B
Behdad Esfahbod 已提交
16 17 18 19 20 21 22 23 24 25 26 27

EXTRA_DIST += hb-test.h

check_PROGRAMS = $(TEST_PROGS)
noinst_PROGRAMS = $(TEST_PROGS)

TEST_PROGS = \
	test-blob \
	test-buffer \
	test-common \
	test-font \
	test-object \
28
	test-set \
B
Behdad Esfahbod 已提交
29 30 31 32 33
	test-shape \
	test-unicode \
	test-version \
	$(NULL)

34 35 36 37
test_unicode_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	$(GLIB_CFLAGS) \
	$(NULL)
B
Behdad Esfahbod 已提交
38
test_unicode_LDADD = $(LDADD)
B
Behdad Esfahbod 已提交
39 40
if HAVE_ICU
test_unicode_CPPFLAGS += $(ICU_CFLAGS)
R
Romain Naour 已提交
41
test_unicode_LDADD += $(top_builddir)/src/libharfbuzz-icu.la $(ICU_LIBS)
B
Behdad Esfahbod 已提交
42 43 44
endif


B
Behdad Esfahbod 已提交
45
if HAVE_OT
46

B
Behdad Esfahbod 已提交
47 48 49
TEST_PROGS += \
	test-ot-tag \
	$(NULL)
50 51 52

if HAVE_FREETYPE
TEST_PROGS += \
53
	test-ot-math \
54
	$(NULL)
55 56
test_ot_math_LDADD = $(LDADD) $(FREETYPE_LIBS)
test_ot_math_CPPFLAGS = $(AM_CPPFLAGS) $(FREETYPE_CFLAGS)
B
Behdad Esfahbod 已提交
57 58 59 60 61 62 63 64 65
EXTRA_DIST += \
	fonts/MathTestFontEmpty.otf \
	fonts/MathTestFontFull.otf \
	fonts/MathTestFontNone.otf \
	fonts/MathTestFontPartial1.otf \
	fonts/MathTestFontPartial2.otf \
	fonts/MathTestFontPartial3.otf \
	fonts/MathTestFontPartial4.otf \
	$(NULL)
66 67 68
endif # HAVE_FREETYPE

endif # HAVE_OT
B
Behdad Esfahbod 已提交
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

# Tests for header compilation
TEST_PROGS += \
	test-c \
	test-cplusplus \
	$(NULL)
test_cplusplus_SOURCES = test-cplusplus.cc
test_c_CPPFLAGS = $(AM_CPPFLAGS)
test_cplusplus_CPPFLAGS = $(AM_CPPFLAGS)
if HAVE_ICU
test_c_CPPFLAGS += $(ICU_CFLAGS)
test_cplusplus_CPPFLAGS += $(ICU_CFLAGS)
endif
if HAVE_FREETYPE
test_c_CPPFLAGS += $(FREETYPE_CFLAGS)
test_cplusplus_CPPFLAGS += $(FREETYPE_CFLAGS)
endif

# Default test running environment
TESTS = $(TEST_PROGS)
TESTS_ENVIRONMENT = \
	MALLOC_CHECK_=2 \
	MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) \
	G_DEBUG=gc-friendly \
	G_SLICE=always-malloc \
	srcdir=$(srcdir) \
95 96
	G_TEST_SRCDIR=$(abs_srcdir) \
	G_TEST_BUILDDIR=$(abs_builddir) \
B
Behdad Esfahbod 已提交
97
	$(NULL)
B
Behdad Esfahbod 已提交
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124


# check-tool: Run tests under $(TOOL)
check-tool:
	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
	TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute \
	env $(TOOL)'
# check-tool-raw: Run tests under $(TOOL), but don't run under libtool
check-tool-raw:
	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
	TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) \
	env $(TOOL)'

# check-gtester: Run tests under gtester
GTESTER = gtester
check-gtester:
	$(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool-raw TOOL="$(GTESTER) --verbose --keep-going"


# Check tests under valgrind.  Saves log to log-valgrind.txt
VALGRIND_FLAGS = \
	--tool=memcheck --suppressions=$(srcdir)/.valgrind-suppressions \
	--track-origins=yes \
	--leak-check=yes
	$(EXTRA_VALGRIND_FLAGS)
#	Can't do for now: --show-reachable=yes
CLEANFILES +=  log-valgrind.txt
125 126
valgrind_verbose = $(valgrind_verbose_@AM_V@)
valgrind_verbose_ = $(valgrind_verbose_@AM_DEFAULT_V@)
B
Behdad Esfahbod 已提交
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
valgrind_verbose_0 = | \
	grep '\(^[^=]\|ERROR SUMMARY\|definitely lost\|indirectly lost\)' | grep -v ': 0'
# TODO: The following check does not fail if valgrind finds error.  It should.
check-valgrind:
	$(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool TOOL="valgrind $(VALGRIND_FLAGS)" \
	2>&1 | tee log-valgrind.txt $(valgrind_verbose)


# check-symbols: Finds untested API symbols
symbols-tested.txt: $(TEST_PROGS)
	$(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
	| grep ' U hb_' | sed 's/.* U hb_/hb_/' \
	| sort | uniq > $@.tmp && mv $@.tmp $@
symbols-exported.txt: $(top_builddir)/src/.libs/libharfbuzz.so
	$(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \
	| grep ' T ' | sed 's/.* T //' | grep -v '^\(_init\|_fini\)$$' \
	| sort | uniq > $@.tmp && mv $@.tmp $@
symbols-untested.txt: symbols-tested.txt symbols-exported.txt
	$(AM_V_GEN)diff $^ > $@.tmp; mv $@.tmp $@
CLEANFILES += symbols-tested.txt symbols-exported.txt symbols-untested.txt
check-symbols: symbols-untested.txt
	@! cat $^ | grep .



152
else # !HAVE_GLIB
B
Behdad Esfahbod 已提交
153 154 155 156
check-am: err-glib
err-glib:
	@echo "You need to have glib support enabled to run the tests"
	@exit 77
157
endif # HAVE_GLIB
B
Behdad Esfahbod 已提交
158 159 160 161

.PHONY: check-symbols check-tool check-valgrind

-include $(top_srcdir)/git.mk