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
12 all_deps = Makefile Makefile.local Makefile.config \
13 lib/Makefile lib/Makefile.local
18 # Now smash together user's values with our extra values
19 FINAL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
20 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
21 FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
23 all: notmuch notmuch.1.gz
25 # Before including any other Makefile fragments, get settings from the
27 Makefile.config: configure
29 @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
30 @echo " but if you want to specify any arguments (such as an alternate prefix"
31 @echo " into which to install), call ./configure explicitly and then make again."
32 @echo " See \"./configure --help\" for more details."
36 include Makefile.config
38 include lib/Makefile.local
39 include compat/Makefile.local
40 include Makefile.local
42 # The user has not set any verbosity, default to quiet mode and inform the
43 # user how to enable verbose compiles.
45 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
46 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" $1 $2 $@\n"; $($1)
48 # The user has explicitly enabled quiet compilation.
50 quiet = @printf " $1 $@\n"; $($1)
52 # Otherwise, print the full command line.
56 $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
59 $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
62 $(call quiet,EMACS) -batch -f batch-byte-compile $<
64 .deps/%.d: %.c $(all_deps)
65 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
66 $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
67 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
70 .deps/%.d: %.cc $(all_deps)
71 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
72 $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
73 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
76 DEPS := $(SRCS:%.c=.deps/%.d)
77 DEPS := $(DEPS:%.cc=.deps/%.d)
82 rm -f $(CLEAN); rm -rf .deps