1 # Get settings from the output of configure by running it to generate
2 # Makefile.config if it doesn't exist yet. And add Makefile.config to
3 # our global dependency list.
4 include Makefile.config
5 global_deps += Makefile.config
6 Makefile.config: configure
8 @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
9 @echo " but if you want to specify any arguments (such as an alternate prefix"
10 @echo " into which to install), call ./configure explicitly and then make again."
11 @echo " See \"./configure --help\" for more details."
15 # Sub-directory Makefile.local fragments can append to these variables
16 # to have directory-specific cflags as necessary.
20 # Smash together user's values with our extra values
21 FINAL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
22 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
23 FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
25 all: notmuch notmuch.1.gz
26 ifeq ($(MAKECMDGOALS),)
28 @echo "Compilation of notmuch is now complete. You can install notmuch with:"
32 @echo "Note that depending on the prefix to which you are installing"
33 @echo "you may need root permission (such as \"sudo make install\")."
34 @echo "See \"./configure --help\" for help on setting an alternate prefix."
37 # The user has not set any verbosity, default to quiet mode and inform the
38 # user how to enable verbose compiles.
40 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
41 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s $@\n" "$1 $2"; $($1)
42 quiet_args = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s$2\n" $1; $($1) $2
44 # The user has explicitly enabled quiet compilation.
46 quiet = @printf " %12s $@\n" "$1 $2"; $($1)
47 quiet_args = @printf " %12s$2\n" $1; $($1) $2
49 # Otherwise, print the full command line.
51 quiet_args ?= $($1) $2
53 quiet_mkdir = $(call quiet_args,MKDIR,$1)
54 quiet_install_bin = $(call quiet_args,INSTALL-BIN,$1)
55 quiet_install_data = $(call quiet_args,INSTALL-DATA,$1)
56 quiet_symlink = $(call quiet_args,SYMLINK,$1)
58 %.o: %.cc $(global_deps)
59 $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
61 %.o: %.c $(global_deps)
62 $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
65 $(call quiet,EMACS) -batch -f batch-byte-compile $<
67 .deps/%.d: %.c $(global_deps)
68 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
69 $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
70 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
73 .deps/%.d: %.cc $(global_deps)
74 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
75 $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
76 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
79 DEPS := $(SRCS:%.c=.deps/%.d)
80 DEPS := $(DEPS:%.cc=.deps/%.d)
85 rm -f $(CLEAN); rm -rf .deps
87 notmuch_client_srcs = \
88 $(notmuch_compat_srcs) \
90 gmime-filter-reply.c \
99 notmuch-search-tags.c \
108 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
109 notmuch: $(notmuch_client_modules) lib/libnotmuch.so
110 $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(notmuch_client_modules) $(FINAL_LDFLAGS) -o $@
112 notmuch.1.gz: notmuch.1
113 $(call quiet,gzip) --stdout $^ > $@
115 install: all notmuch.1.gz
116 $(call quiet_mkdir, $(DESTDIR)$(prefix)/bin/)
117 $(call quiet_mkdir, $(DESTDIR)$(libdir)/)
118 $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
119 $(call quiet_mkdir, $(DESTDIR)$(prefix)/share/man/man1)
120 $(call quiet_install_bin, notmuch $(DESTDIR)$(prefix)/bin/)
121 $(call quiet_install_data, notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/)
122 ifeq ($(MAKECMDGOALS), install)
124 @echo "Notmuch is now installed."
126 @echo "You may now want to install additional components to support using notmuch"
127 @echo "together with other software packages:"
129 @echo " make install-emacs"
130 @echo " make install-bash"
131 @echo " make install-zsh"
136 $(call quiet,MKDIR) $(DESTDIR)$(desktop_dir)
137 desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop
140 $(call quiet-mkdir, $(DESTDIR)$(bash_completion_dir))
141 $(call quiet_install_data, contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch)
144 $(call quiet_mkdir, $(DESTDIR)$(zsh_completion_dir))
145 $(call quiet_install_data, contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch)
147 SRCS := $(SRCS) $(notmuch_client_srcs)
148 CLEAN := $(CLEAN) notmuch $(notmuch_client_modules) notmuch.elc notmuch.1.gz