]> git.notmuchmail.org Git - notmuch/blob - Makefile
Fix "too many open files" bug by closing message files when done with them.
[notmuch] / Makefile
1 # Default FLAGS, (can be overriden by user such as "make CFLAGS=-O2")
2 WARN_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum
3 CFLAGS=-O2
4
5 # Additional flags that we will append to whatever the user set.
6 # These aren't intended for the user to manipulate.
7 extra_cflags = `pkg-config --cflags glib-2.0 gmime-2.4 talloc`
8 extra_cxxflags = `xapian-config --cxxflags`
9
10 # Now smash together user's values with our extra values
11 override CFLAGS += $(WARN_FLAGS) $(extra_cflags)
12 override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags)
13
14 override LDFLAGS += `pkg-config --libs glib-2.0 gmime-2.4 talloc` \
15                         `xapian-config --libs`
16
17 # Include our local Makfile.local first so that its first target is default
18 include Makefile.local
19 include lib/Makefile.local
20
21 # And get user settings from the output of configure
22 include Makefile.config
23
24 %.o: %.cc
25         $(CXX) -c $(CFLAGS) $(CXXFLAGS) $< -o $@
26
27 %.o: %.c
28         $(CC) -c $(CFLAGS) $< -o $@
29
30 .deps/%.d: %.c
31         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
32         $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
33         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
34         rm -f $@.$$$$
35
36 .deps/%.d: %.cc
37         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
38         $(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
39         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
40         rm -f $@.$$$$
41
42 DEPS := $(SRCS:%.c=.deps/%.d)
43 DEPS := $(DEPS:%.cc=.deps/%.d)
44 -include $(DEPS)
45
46 clean:
47         rm -f $(CLEAN); rm -rf .deps