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