]> git.notmuchmail.org Git - notmuch/blob - Makefile
Add a --libdir option to ./configure
[notmuch] / Makefile
1 SONAME = libnotmuch.so.1
2 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
3 WARN_CFLAGS=$(WARN_CXXFLAGS) -Wmissing-declarations
4
5 # Additional programs that are used during the compilation process.
6 EMACS ?= emacs --quick
7 # Lowercase to avoid clash with GZIP environment variable for passing
8 # arguments to gzip.
9 gzip = gzip
10
11 bash_completion_dir = /etc/bash_completion.d
12 zsh_completion_dir = /usr/share/zsh/functions/Completion/Unix
13
14 extra_cflags :=
15 extra_cxxflags :=
16
17 # Now smash together user's values with our extra values
18 FINAL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
19 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
20 FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
21
22 all: notmuch notmuch.1.gz
23 ifeq ($(MAKECMDGOALS),)
24         @echo ""
25         @echo "Compilation of notmuch is now complete. You can install notmuch with:"
26         @echo ""
27         @echo " make install"
28         @echo ""
29         @echo "Note that depending on the prefix to which you are installing"
30         @echo "you may need root permission (such as \"sudo make install\")."
31         @echo "See \"./configure --help\" for help on setting an alternate prefix."
32 endif
33
34 # Before including any other Makefile fragments, get settings from the
35 # output of configure
36 Makefile.config: configure
37         @echo ""
38         @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
39         @echo "      but if you want to specify any arguments (such as an alternate prefix"
40         @echo "      into which to install), call ./configure explicitly and then make again."
41         @echo "      See \"./configure --help\" for more details."
42         @echo ""
43         ./configure
44
45 subdirs = compat emacs lib
46
47 global_deps = Makefile Makefile.config Makefile.local \
48         $(subdirs:%=%/Makefile) $(subdirs:%=%/Makefile.local)
49
50 include Makefile.config Makefile.local $(subdirs:%=%/Makefile.local)
51
52 # The user has not set any verbosity, default to quiet mode and inform the
53 # user how to enable verbose compiles.
54 ifeq ($(V),)
55 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
56 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"  $1 $2 $@\n"; $($1)
57 endif
58 # The user has explicitly enabled quiet compilation.
59 ifeq ($(V),0)
60 quiet = @printf "  $1   $@\n"; $($1)
61 endif
62 # Otherwise, print the full command line.
63 quiet ?= $($1)
64
65 %.o: %.cc $(global_deps)
66         $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
67
68 %.o: %.c $(global_deps)
69         $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
70
71 %.elc: %.el
72         $(call quiet,EMACS) -batch -f batch-byte-compile $<
73
74 .deps/%.d: %.c $(global_deps)
75         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
76         $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
77         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
78         rm -f $@.$$$$
79
80 .deps/%.d: %.cc $(global_deps)
81         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
82         $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
83         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
84         rm -f $@.$$$$
85
86 DEPS := $(SRCS:%.c=.deps/%.d)
87 DEPS := $(DEPS:%.cc=.deps/%.d)
88 -include $(DEPS)
89
90 .PHONY : clean
91 clean:
92         rm -f $(CLEAN); rm -rf .deps