348d8772d7842e07171b8bc5904800d67b4d1ae4
[notmuch] / Makefile
1 PROGS=notmuch
2
3 WARN_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum
4
5 NOTMUCH_DEPENDS_FLAGS=`pkg-config --cflags glib-2.0 gmime-2.4 talloc`
6 NOTMUCH_CXX_DEPENDS_FLAGS=$(NOTMUCH_DEPENDS_FLAGS) `xapian-config --cxxflags`
7
8 NOTMUCH_CFLAGS=$(WARN_FLAGS) -O0 -g $(NOTMUCH_DEPENDS_FLAGS)
9 NOTMUCH_CXXFLAGS=$(WARN_FLAGS) -O0 -g $(NOTMUCH_CXX_DEPENDS_FLAGS)
10
11 NOTMUCH_LDFLAGS=`pkg-config --libs glib-2.0 gmime-2.4 talloc` \
12                 `xapian-config --libs`
13
14 LIBRARY=                \
15         database.o      \
16         date.o          \
17         index.o         \
18         libsha1.o       \
19         message.o       \
20         message-file.o  \
21         query.o         \
22         sha1.o          \
23         tags.o          \
24         thread.o        \
25         xutil.o
26
27 MAIN=                   \
28         notmuch.o
29
30 all: $(PROGS)
31
32 %.o: %.cc
33         $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(NOTMUCH_CXXFLAGS) $< -o $@
34
35 %.o: %.c
36         $(CC) -c $(CFLAGS) $(NOTMUCH_CFLAGS) $< -o $@
37
38 notmuch: $(MAIN) $(LIBRARY)
39         $(CC) $(NOTMUCH_LDFLAGS) $^ -o $@
40
41 Makefile.dep: *.c *.cc
42         $(CXX) -M $(CPPFLAGS) $(NOTMUCH_DEPENDS_FLAGS) \
43         $(NOTMUCH_CXX_DEPENDS_FLAGS) $^ > $@
44 -include Makefile.dep
45
46 notmuch.1.gz:
47         gzip --stdout notmuch.1 > notmuch.1.gz
48
49 install: notmuch.1.gz
50         install -C -D notmuch $(DESTDIR)/usr/bin/notmuch
51         install -C -D notmuch.1.gz $(DESTDIR)/usr/share/man/man1
52         install -C -D notmuch-completion.bash \
53                 $(DESTDIR)/etc/bash_completion.d/notmuch
54
55 clean:
56         rm -f $(PROGS) *.o Makefile.dep