]> git.notmuchmail.org Git - notmuch/blob - Makefile
vim: preserve the 'show everything' flag when finding next/prev buffer
[notmuch] / Makefile
1 # Default FLAGS, (can be overridden by user such as "make CFLAGS=-g")
2 CFLAGS=-O2
3
4 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum
5 WARN_CFLAGS=$(WARN_CXXFLAGS) -Wmissing-declarations
6
7 # Additional programs that are used during the compilation process.
8 EMACS ?= emacs
9 # Lowercase to avoid clash with GZIP environment variable for passing
10 # arguments to gzip.
11 gzip = gzip
12
13 bash_completion_dir = /etc/bash_completion.d
14
15 all_deps = Makefile Makefile.local Makefile.config \
16                    lib/Makefile lib/Makefile.local
17
18 extra_cflags :=
19 extra_cxxflags :=
20
21 # Now smash together user's values with our extra values
22 override CFLAGS += $(WARN_CFLAGS) $(extra_cflags)
23 override CXXFLAGS += $(WARN_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
24
25 all: notmuch notmuch.1.gz
26
27 # Before including any other Makefile fragments, get settings from the
28 # output of configure
29 Makefile.config: configure
30         ./configure
31
32 include Makefile.config
33
34 include lib/Makefile.local
35 include compat/Makefile.local
36 include Makefile.local
37
38 # The user has not set any verbosity, default to quiet mode and inform the
39 # user how to enable verbose compiles.
40 ifeq ($(V),)
41 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
42 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"  $1    $@\n"; $($1)
43 endif
44 # The user has explicitly enabled quiet compilation.
45 ifeq ($(V),0)
46 quiet = @printf "  $1   $@\n"; $($1)
47 endif
48 # Otherwise, print the full command line.
49 quiet ?= $($1)
50
51 %.o: %.cc $(all_deps)
52         $(call quiet,CXX) -c $(CXXFLAGS) $< -o $@
53
54 %.o: %.c $(all_deps)
55         $(call quiet,CC) -c $(CFLAGS) $< -o $@
56
57 %.elc: %.el
58         $(call quiet,EMACS) -batch -f batch-byte-compile $<
59
60 .deps/%.d: %.c $(all_deps)
61         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
62         $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
63         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
64         rm -f $@.$$$$
65
66 .deps/%.d: %.cc $(all_deps)
67         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
68         $(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
69         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
70         rm -f $@.$$$$
71
72 DEPS := $(SRCS:%.c=.deps/%.d)
73 DEPS := $(DEPS:%.cc=.deps/%.d)
74 -include $(DEPS)
75
76 .PHONY : clean
77 clean:
78         rm -f $(CLEAN); rm -rf .deps