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),)
40 @echo "Compilation of notmuch is now complete. You can install notmuch with:"
44 @echo "Note that depending on the prefix to which you are installing"
45 @echo "you may need root permission (such as \"sudo make install\")."
46 @echo "See \"./configure --help\" for help on setting an alternate prefix."
49 # The user has not set any verbosity, default to quiet mode and inform the
50 # user how to enable verbose compiles.
52 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
53 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s $@\n" "$1 $2"; $($1)
54 quiet_args = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s$2\n" $1; $($1) $2
56 # The user has explicitly enabled quiet compilation.
58 quiet = @printf " %12s $@\n" "$1 $2"; $($1)
59 quiet_args = @printf " %12s$2\n" $1; $($1) $2
61 # Otherwise, print the full command line.
63 quiet_args ?= $($1) $2
65 quiet_mkdir = $(call quiet_args,MKDIR,$1)
66 quiet_install_bin = $(call quiet_args,INSTALL-BIN,$1)
67 quiet_install_data = $(call quiet_args,INSTALL-DATA,$1)
68 quiet_symlink = $(call quiet_args,SYMLINK,$1)
70 %.o: %.cc $(global_deps)
71 $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
73 %.o: %.c $(global_deps)
74 $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
77 $(call quiet,EMACS) -batch -f batch-byte-compile $<
79 .deps/%.d: %.c $(global_deps)
80 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
81 $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
82 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
85 .deps/%.d: %.cc $(global_deps)
86 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
87 $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
88 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
91 DEPS := $(SRCS:%.c=.deps/%.d)
92 DEPS := $(DEPS:%.cc=.deps/%.d)
97 rm -f $(CLEAN); rm -rf .deps
99 notmuch_client_srcs = \
100 $(notmuch_compat_srcs) \
102 gmime-filter-reply.c \
111 notmuch-search-tags.c \
120 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
122 notmuch: $(notmuch_client_modules) lib/libnotmuch.a
123 $(call quiet,CC,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@
125 notmuch-shared: $(notmuch_client_modules) lib/libnotmuch.so
126 $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(notmuch_client_modules) $(FINAL_LDFLAGS) -o $@
128 notmuch.1.gz: notmuch.1
129 $(call quiet,gzip) --stdout $^ > $@
131 install: all notmuch.1.gz
132 $(call quiet_mkdir, $(DESTDIR)$(prefix)/bin/)
133 $(call quiet_mkdir, $(DESTDIR)$(libdir)/)
134 $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
135 $(call quiet_mkdir, $(DESTDIR)$(prefix)/share/man/man1)
136 $(call quiet_install_bin, notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch)
137 $(call quiet_install_data, notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/)
138 ifeq ($(MAKECMDGOALS), install)
140 @echo "Notmuch is now installed."
142 @echo "You may now want to install additional components to support using notmuch"
143 @echo "together with other software packages:"
145 @echo " make install-emacs"
146 @echo " make install-bash"
147 @echo " make install-zsh"
152 $(call quiet,MKDIR) $(DESTDIR)$(desktop_dir)
153 desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop
156 $(call quiet-mkdir, $(DESTDIR)$(bash_completion_dir))
157 $(call quiet_install_data, contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch)
160 $(call quiet_mkdir, $(DESTDIR)$(zsh_completion_dir))
161 $(call quiet_install_data, contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch)
163 SRCS := $(SRCS) $(notmuch_client_srcs)
164 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz