Add -Wextra and fix warnings.
[notmuch] / Makefile
1 PROGS=notmuch
2
3 CXXWARNINGS_FLAGS=-Wall -Wextra -Wno-unused-parameter
4 CWARNINGS_FLAGS=$(CXXWARNINGS_FLAGS)
5
6 CDEPENDS_FLAGS=`pkg-config --cflags glib-2.0 talloc`
7 CXXDEPENDS_FLAGS=`pkg-config --cflags glib-2.0 talloc` `xapian-config --cxxflags`
8
9 MYCFLAGS=$(CWARNINGS_FLAGS) -O0 -g $(CDEPENDS_FLAGS)
10 MYCXXFLAGS=$(CXXWARNINGS_FLAGS) -O0 -g $(CXXDEPENDS_FLAGS)
11
12 MYLDFLAGS=`pkg-config --libs glib-2.0 talloc` `xapian-config --libs`
13
14 MODULES=                \
15         notmuch.o       \
16         database.o      \
17         date.o          \
18         message.o       \
19         message-file.o  \
20         query.o         \
21         sha1.o          \
22         libsha1.o       \
23         xutil.o
24
25 all: $(PROGS)
26
27 %.o: %.cc
28         $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(MYCXXFLAGS) $< -o $@
29
30 %.o: %.c
31         $(CC) -c $(CFLAGS) $(MYCFLAGS) $< -o $@
32
33 notmuch: $(MODULES)
34         $(CC) $(MYLDFLAGS) $^ -o $@
35
36 Makefile.dep: *.c *.cc
37         $(CC) -M $(CPPFLAGS) $(CDEPENDS_FLAGS) $^ > $@
38 -include Makefile.dep
39
40 clean:
41         rm -f $(PROGS) *.o Makefile.dep