]> git.notmuchmail.org Git - notmuch/blob - Makefile
9e44d90a3a35134cd7beb6d92b775fe0f77fb2e4
[notmuch] / Makefile
1 # Default FLAGS, (can be overridden 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 := $(shell pkg-config --cflags glib-2.0 gmime-2.4 talloc)
8 extra_cxxflags := $(shell xapian-config --cxxflags)
9
10 emacs_lispdir := $(shell pkg-config emacs --variable sitepkglispdir)
11
12 # Now smash together user's values with our extra values
13 override CFLAGS += $(WARN_FLAGS) $(extra_cflags)
14 override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags)
15
16 override LDFLAGS += \
17         $(shell pkg-config --libs glib-2.0 gmime-2.4 talloc) \
18         $(shell xapian-config --libs)
19
20 # Include our local Makefile.local first so that its first target is default
21 include Makefile.local
22 include lib/Makefile.local
23
24 # And get user settings from the output of configure
25 include Makefile.config
26
27 %.o: %.cc
28         $(CXX) -c $(CFLAGS) $(CXXFLAGS) $< -o $@
29
30 %.o: %.c
31         $(CC) -c $(CFLAGS) $< -o $@
32
33 %.elc: %.el
34         emacs -batch -f batch-byte-compile $<
35
36 .deps/%.d: %.c
37         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
38         $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
39         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
40         rm -f $@.$$$$
41
42 .deps/%.d: %.cc
43         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
44         $(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
45         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
46         rm -f $@.$$$$
47
48 DEPS := $(SRCS:%.c=.deps/%.d)
49 DEPS := $(DEPS:%.cc=.deps/%.d)
50 -include $(DEPS)
51
52 clean:
53         rm -f $(CLEAN); rm -rf .deps