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