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