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:=)" $1 $2 $@\n"; $($1)
43 # The user has explicitly enabled quiet compilation.
45 quiet = @printf " $1 $@\n"; $($1)
47 # Otherwise, print the full command line.
50 %.o: %.cc $(global_deps)
51 $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
53 %.o: %.c $(global_deps)
54 $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
57 $(call quiet,EMACS) -batch -f batch-byte-compile $<
59 .deps/%.d: %.c $(global_deps)
60 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
61 $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
62 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
65 .deps/%.d: %.cc $(global_deps)
66 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
67 $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
68 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
71 DEPS := $(SRCS:%.c=.deps/%.d)
72 DEPS := $(DEPS:%.cc=.deps/%.d)
77 rm -f $(CLEAN); rm -rf .deps
79 notmuch_client_srcs = \
80 $(notmuch_compat_srcs) \
82 gmime-filter-reply.c \
91 notmuch-search-tags.c \
100 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
101 notmuch: $(notmuch_client_modules) lib/libnotmuch.so
102 $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(filter-out lib/libnotmuch.so,$^) $(FINAL_LDFLAGS) -o $@
104 notmuch.1.gz: notmuch.1
105 $(call quiet,gzip) --stdout $^ > $@
107 SONAME = libnotmuch.so.1
109 install: all notmuch.1.gz
110 for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(libdir)/ \
111 $(DESTDIR)$(prefix)/include/ $(DESTDIR)$(prefix)/share/man/man1 ; \
115 install notmuch $(DESTDIR)$(prefix)/bin/
116 install lib/$(SONAME) $(DESTDIR)$(libdir)/
117 install lib/notmuch.h $(DESTDIR)$(prefix)/include/
118 ln -sf $(SONAME) $(DESTDIR)$(libdir)/libnotmuch.so
119 install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/
120 ifeq ($(MAKECMDGOALS), install)
122 @echo "Notmuch is now installed."
124 @echo "You may now want to install additional components to support using notmuch"
125 @echo "together with other software packages:"
127 @echo " make install-emacs"
128 @echo " make install-bash"
129 @echo " make install-zsh"
134 install -d $(DESTDIR)$(desktop_dir)
135 desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop
138 install -d $(DESTDIR)$(bash_completion_dir)
139 install -m0644 contrib/notmuch-completion.bash \
140 $(DESTDIR)$(bash_completion_dir)/notmuch
143 install -d $(DESTDIR)$(zsh_completion_dir)
144 install -m0644 contrib/notmuch-completion.zsh \
145 $(DESTDIR)$(zsh_completion_dir)/notmuch
147 SRCS := $(SRCS) $(notmuch_client_srcs)
148 CLEAN := $(CLEAN) notmuch $(notmuch_client_modules) notmuch.elc notmuch.1.gz