1 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
2 WARN_CFLAGS=$(WARN_CXXFLAGS) -Wmissing-declarations
4 # Additional programs that are used during the compilation process.
6 # Lowercase to avoid clash with GZIP environment variable for passing
10 bash_completion_dir = /etc/bash_completion.d
11 zsh_completion_dir = /usr/share/zsh/functions/Completion/Unix
16 # Now smash together user's values with our extra values
17 FINAL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
18 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
19 FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
21 all: notmuch notmuch.1.gz
22 ifeq ($(MAKECMDGOALS),)
24 @echo "Compilation of notmuch is now complete. You can install notmuch with:"
28 @echo "Note that depending on the prefix to which you are installing"
29 @echo "you may need root permission (such as \"sudo make install\")."
30 @echo "See \"./configure --help\" for help on setting an alternate prefix."
33 # Before including any other Makefile fragments, get settings from the
35 Makefile.config: configure
37 @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
38 @echo " but if you want to specify any arguments (such as an alternate prefix"
39 @echo " into which to install), call ./configure explicitly and then make again."
40 @echo " See \"./configure --help\" for more details."
44 subdirs = compat emacs lib
46 global_deps = Makefile Makefile.config Makefile.local \
47 $(subdirs:%=%/Makefile) $(subdirs:%=%/Makefile.local)
49 include Makefile.config Makefile.local $(subdirs:%=%/Makefile.local)
51 # The user has not set any verbosity, default to quiet mode and inform the
52 # user how to enable verbose compiles.
54 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
55 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" $1 $2 $@\n"; $($1)
57 # The user has explicitly enabled quiet compilation.
59 quiet = @printf " $1 $@\n"; $($1)
61 # Otherwise, print the full command line.
64 %.o: %.cc $(global_deps)
65 $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
67 %.o: %.c $(global_deps)
68 $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
71 $(call quiet,EMACS) -batch -f batch-byte-compile $<
73 .deps/%.d: %.c $(global_deps)
74 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
75 $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
76 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
79 .deps/%.d: %.cc $(global_deps)
80 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
81 $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
82 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
85 DEPS := $(SRCS:%.c=.deps/%.d)
86 DEPS := $(DEPS:%.cc=.deps/%.d)
91 rm -f $(CLEAN); rm -rf .deps