f8cf90d07e2dc5c1acd59ad13531800a783eb7a5
[notmuch] / test / Makefile.local
1 # -*- makefile -*-
2
3 dir := test
4
5 # save against changes in $(dir)
6 test_src_dir := $(dir)
7 extra_cflags += -I$(srcdir)
8
9 smtp_dummy_srcs =               \
10         $(notmuch_compat_srcs)  \
11         $(dir)/smtp-dummy.c
12
13 smtp_dummy_modules = $(smtp_dummy_srcs:.c=.o)
14
15 $(dir)/arg-test: $(dir)/arg-test.o command-line-arguments.o util/libutil.a
16         $(call quiet,CC) $^ -o $@ $(LDFLAGS)
17
18 $(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o util/libutil.a
19         $(call quiet,CC) $^ -o $@ $(LDFLAGS) $(TALLOC_LDFLAGS)
20
21 random_corpus_deps =  $(dir)/random-corpus.o  $(dir)/database-test.o \
22                         notmuch-config.o status.o command-line-arguments.o \
23                         lib/libnotmuch.a util/libutil.a \
24                         parse-time-string/libparse-time-string.a
25
26 $(dir)/random-corpus: $(random_corpus_deps)
27         $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(CONFIGURE_LDFLAGS)
28
29 $(dir)/smtp-dummy: $(smtp_dummy_modules)
30         $(call quiet,CC) $^ -o $@ $(LDFLAGS)
31
32 $(dir)/symbol-test: $(dir)/symbol-test.o lib/$(LINKER_NAME)
33         $(call quiet,CXX) $^ -o $@ $(LDFLAGS) -Llib -lnotmuch $(XAPIAN_LDFLAGS)
34
35 $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o
36         $(call quiet,CC) $^ -o $@ $(LDFLAGS)
37
38 $(dir)/make-db-version: $(dir)/make-db-version.o
39         $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(XAPIAN_LDFLAGS)
40
41 $(dir)/ghost-report: $(dir)/ghost-report.o
42         $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(XAPIAN_LDFLAGS)
43
44 .PHONY: test check
45
46 test_main_srcs=$(dir)/arg-test.c \
47               $(dir)/hex-xcode.c \
48               $(dir)/random-corpus.c \
49               $(dir)/parse-time.c \
50               $(dir)/smtp-dummy.c \
51               $(dir)/symbol-test.cc \
52               $(dir)/make-db-version.cc \
53               $(dir)/ghost-report.cc
54
55 test_srcs=$(test_main_srcs) $(dir)/database-test.c
56
57 TEST_BINARIES := $(test_main_srcs:.c=)
58 TEST_BINARIES := $(TEST_BINARIES:.cc=)
59
60 test-binaries: $(TEST_BINARIES)
61
62 test:   all test-binaries
63 ifeq ($V,)
64         @echo 'Use "$(MAKE) V=1" to print test headings and PASSing results.'
65         @env NOTMUCH_TEST_QUIET=1 ${test_src_dir}/notmuch-test $(OPTIONS)
66 else
67 # The user has explicitly enabled quiet execution.
68 ifeq ($V,0)
69         @env NOTMUCH_TEST_QUIET=1 ${test_src_dir}/notmuch-test $(OPTIONS)
70 else
71         @${test_src_dir}/notmuch-test $(OPTIONS)
72 endif
73 endif
74
75 check: test
76
77 SRCS := $(SRCS) $(test_srcs)
78 CLEAN += $(TEST_BINARIES) $(addsuffix .o,$(TEST_BINARIES)) \
79          $(dir)/database-test.o \
80          $(dir)/corpora.mail $(dir)/test-results $(dir)/tmp.*