1 # Here's the (hopefully simple) versioning scheme.
3 # Releases of notmuch have a two-digit version (0.1, 0.2, etc.). We
4 # increment the second digit for each release and increment the first
5 # digit when we reach particularly major milestones of usability.
7 # Between releases, (such as when compiling notmuch from the git
8 # repository), we add a third digit, (0.1.1, 0.1.2, etc.), and
9 # increment it occasionally, (such as after a big batch of commits are
13 # Get settings from the output of configure by running it to generate
14 # Makefile.config if it doesn't exist yet. And add Makefile.config to
15 # our global dependency list.
16 include Makefile.config
17 global_deps += Makefile.config
18 Makefile.config: configure
20 @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
21 @echo " but if you want to specify any arguments (such as an alternate prefix"
22 @echo " into which to install), call ./configure explicitly and then make again."
23 @echo " See \"./configure --help\" for more details."
27 # Sub-directory Makefile.local fragments can append to these variables
28 # to have directory-specific cflags as necessary.
32 # Smash together user's values with our extra values
33 FINAL_CFLAGS = -DNOTMUCH_VERSION=$(NOTMUCH_VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
34 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
35 FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
37 all: notmuch notmuch-shared notmuch.1.gz
38 ifeq ($(MAKECMDGOALS),)
39 ifeq ($(shell cat .first-build-message),)
40 @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
42 @echo "Compilation of notmuch is now complete. You can install notmuch with:"
46 @echo "Note that depending on the prefix to which you are installing"
47 @echo "you may need root permission (such as \"sudo make install\")."
48 @echo "See \"./configure --help\" for help on setting an alternate prefix."
49 @echo Printed > .first-build-message
53 # The user has not set any verbosity, default to quiet mode and inform the
54 # user how to enable verbose compiles.
56 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
57 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s $@\n" "$1 $2"; $($1)
58 quiet_args = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s$2\n" $1; $($1) $2
60 # The user has explicitly enabled quiet compilation.
62 quiet = @printf " %12s $@\n" "$1 $2"; $($1)
63 quiet_args = @printf " %12s$2\n" $1; $($1) $2
65 # Otherwise, print the full command line.
67 quiet_args ?= $($1) $2
69 quiet_mkdir = $(call quiet_args,MKDIR,$1)
70 quiet_install_bin = $(call quiet_args,INSTALL-BIN,$1)
71 quiet_install_data = $(call quiet_args,INSTALL-DATA,$1)
72 quiet_symlink = $(call quiet_args,SYMLINK,$1)
74 %.o: %.cc $(global_deps)
75 $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
77 %.o: %.c $(global_deps)
78 $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
81 $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
83 .deps/%.d: %.c $(global_deps)
84 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
85 $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
86 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
89 .deps/%.d: %.cc $(global_deps)
90 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
91 $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
92 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
95 DEPS := $(SRCS:%.c=.deps/%.d)
96 DEPS := $(DEPS:%.cc=.deps/%.d)
101 rm -f $(CLEAN); rm -rf .deps
103 notmuch_client_srcs = \
104 $(notmuch_compat_srcs) \
106 gmime-filter-reply.c \
115 notmuch-search-tags.c \
124 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
126 notmuch: $(notmuch_client_modules) lib/libnotmuch.a
127 $(call quiet,CC,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@
129 notmuch-shared: $(notmuch_client_modules) lib/libnotmuch.so
130 $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(notmuch_client_modules) $(FINAL_LDFLAGS) -o $@
132 notmuch.1.gz: notmuch.1
133 $(call quiet,gzip) --stdout $^ > $@
135 install: all notmuch.1.gz
136 $(call quiet_mkdir, $(DESTDIR)$(prefix)/bin/)
137 $(call quiet_mkdir, $(DESTDIR)$(libdir)/)
138 $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
139 $(call quiet_mkdir, $(DESTDIR)$(prefix)/share/man/man1)
140 $(call quiet_install_bin, notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch)
141 $(call quiet_install_data, notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/)
142 ifeq ($(MAKECMDGOALS), install)
144 @echo "Notmuch is now installed."
146 @echo "You may now want to install additional components to support using notmuch"
147 @echo "together with other software packages:"
149 @echo " make install-emacs"
150 @echo " make install-bash"
151 @echo " make install-zsh"
156 $(call quiet,MKDIR) $(DESTDIR)$(desktop_dir)
157 desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop
160 $(call quiet-mkdir, $(DESTDIR)$(bash_completion_dir))
161 $(call quiet_install_data, contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch)
164 $(call quiet_mkdir, $(DESTDIR)$(zsh_completion_dir))
165 $(call quiet_install_data, contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch)
167 SRCS := $(SRCS) $(notmuch_client_srcs)
168 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz