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."
35 include Makefile.config
37 include lib/Makefile.local
38 include compat/Makefile.local
39 include Makefile.local
41 # The user has not set any verbosity, default to quiet mode and inform the
42 # user how to enable verbose compiles.
44 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
45 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" $1 $2 $@\n"; $($1)
47 # The user has explicitly enabled quiet compilation.
49 quiet = @printf " $1 $@\n"; $($1)
51 # Otherwise, print the full command line.
55 $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
58 $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
61 $(call quiet,EMACS) -batch -f batch-byte-compile $<
63 .deps/%.d: %.c $(all_deps)
64 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
65 $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$; \
66 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
69 .deps/%.d: %.cc $(all_deps)
70 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
71 $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$; \
72 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
75 DEPS := $(SRCS:%.c=.deps/%.d)
76 DEPS := $(DEPS:%.cc=.deps/%.d)
81 rm -f $(CLEAN); rm -rf .deps