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