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
16 RELEASE_HOST=notmuchmail.org
17 RELEASE_DIR=/srv/notmuchmail.org/www/releases
18 RELEASE_URL=http://notmuchmail.org/releases
19 TAR_FILE=$(PACKAGE)-$(VERSION).tar.gz
20 SHA1_FILE=$(TAR_FILE).sha1
21 GPG_FILE=$(SHA1_FILE).asc
23 # Get settings from the output of configure by running it to generate
24 # Makefile.config if it doesn't exist yet. And add Makefile.config to
25 # our global dependency list.
26 include Makefile.config
27 global_deps += Makefile.config
28 Makefile.config: configure
30 @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
31 @echo " but if you want to specify any arguments (such as an alternate prefix"
32 @echo " into which to install), call ./configure explicitly and then make again."
33 @echo " See \"./configure --help\" for more details."
37 # Sub-directory Makefile.local fragments can append to these variables
38 # to have directory-specific cflags as necessary.
42 # Smash together user's values with our extra values
43 FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
44 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
45 FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
48 all: notmuch notmuch-shared notmuch.1.gz
49 ifeq ($(MAKECMDGOALS),)
50 ifeq ($(shell cat .first-build-message),)
51 @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
53 @echo "Compilation of notmuch is now complete. You can install notmuch with:"
57 @echo "Note that depending on the prefix to which you are installing"
58 @echo "you may need root permission (such as \"sudo make install\")."
59 @echo "See \"./configure --help\" for help on setting an alternate prefix."
60 @echo Printed > .first-build-message
65 git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ HEAD | gzip > $(TAR_FILE)
66 @echo "Source is ready for release in $(TAR_FILE)"
68 $(SHA1_FILE): $(TAR_FILE)
71 $(GPG_FILE): $(SHA1_FILE)
72 @echo "Please enter your GPG password to sign the checksum."
78 # We invoke make recursively only to force ordering of our phony
79 # targets in the case of parallel invocation of make (-j).
81 release: release-verify-newer
82 $(MAKE) release-upload
83 $(MAKE) release-message
85 .PHONY: release-upload
86 release-upload: $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE)
88 scp $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) $(RELEASE_HOST):$(RELEASE_DIR)
89 mv $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) releases
90 ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
91 git tag -s -m "$(PACKAGE) $(VERSION) release" $(VERSION)
92 git push origin $(VERSION)
94 .PHONY: release-message
96 @echo "Please send a release announcement as follows:"
98 @echo "To: notmuch@notmuchmail.org"
99 @echo "Subject: $(PACKAGE) release $(VERSION) now available"
101 @echo "Where to obtain $(PACKAGE) $(VERSION)"
102 @echo "==========================="
103 @echo " $(RELEASE_URL)/$(TAR_FILE)"
105 @echo "Which can be verified with:"
107 @echo " $(RELEASE_URL)/$(SHA1_FILE)"
109 @cat releases/$(SHA1_FILE)
111 @echo " $(RELEASE_URL)/$(GPG_FILE)"
112 @echo " (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
114 .PHONY: release-verify-version
115 release-verify-version:
116 @echo -n "Checking that $(VERSION) is a two-component version..."
117 @if echo $(VERSION) | grep -q -v -x '[0-9]*\.[0-9]*'; then \
119 echo "Before releasing the notmuch version should be a two-component value." && false);\
123 .PHONY: release-verify-newer
124 release-verify-newer: release-verify-version
125 @echo -n "Checking that no $(VERSION) release already exists..."
126 @ssh $(RELEASE_HOST) test ! -e $(RELEASE_DIR)/$(TAR_FILE) \
127 || (echo "Ouch." && echo "Found: $(RELEASE_HOST):$(RELEASE_DIR)/$(TAR_FILE)" \
128 && echo "Refusing to replace an existing release." && false)
131 # The user has not set any verbosity, default to quiet mode and inform the
132 # user how to enable verbose compiles.
134 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
135 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s $@\n" "$1 $2"; $($1)
136 quiet_args = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s$2\n" $1; $($1) $2
138 # The user has explicitly enabled quiet compilation.
140 quiet = @printf " %12s $@\n" "$1 $2"; $($1)
141 quiet_args = @printf " %12s$2\n" $1; $($1) $2
143 # Otherwise, print the full command line.
145 quiet_args ?= $($1) $2
147 quiet_mkdir = $(call quiet_args,MKDIR,$1)
148 quiet_install_bin = $(call quiet_args,INSTALL-BIN,$1)
149 quiet_install_data = $(call quiet_args,INSTALL-DATA,$1)
150 quiet_symlink = $(call quiet_args,SYMLINK,$1)
152 %.o: %.cc $(global_deps)
153 $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
155 %.o: %.c $(global_deps)
156 $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
159 $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
161 .deps/%.d: %.c $(global_deps)
162 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
163 $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
164 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
167 .deps/%.d: %.cc $(global_deps)
168 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
169 $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
170 sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
173 DEPS := $(SRCS:%.c=.deps/%.d)
174 DEPS := $(DEPS:%.cc=.deps/%.d)
179 rm -f $(CLEAN); rm -rf .deps
181 notmuch_client_srcs = \
182 $(notmuch_compat_srcs) \
184 gmime-filter-reply.c \
193 notmuch-search-tags.c \
202 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
204 notmuch: $(notmuch_client_modules) lib/libnotmuch.a
205 $(call quiet,CC,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@
207 notmuch-shared: $(notmuch_client_modules) lib/libnotmuch.so
208 $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(notmuch_client_modules) $(FINAL_LDFLAGS) -o $@
210 notmuch.1.gz: notmuch.1
211 $(call quiet,gzip) --stdout $^ > $@
214 install: all notmuch.1.gz
215 $(call quiet_mkdir, $(DESTDIR)$(prefix)/bin/)
216 $(call quiet_mkdir, $(DESTDIR)$(libdir)/)
217 $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
218 $(call quiet_mkdir, $(DESTDIR)$(prefix)/share/man/man1)
219 $(call quiet_install_bin, notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch)
220 $(call quiet_install_data, notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/)
221 ifeq ($(MAKECMDGOALS), install)
223 @echo "Notmuch is now installed."
225 @echo "You may now want to install additional components to support using notmuch"
226 @echo "together with other software packages:"
228 @echo " make install-emacs"
229 @echo " make install-bash"
230 @echo " make install-zsh"
234 .PHONY: install-desktop
236 $(call quiet,MKDIR) $(DESTDIR)$(desktop_dir)
237 desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop
241 $(call quiet-mkdir, $(DESTDIR)$(bash_completion_dir))
242 $(call quiet_install_data, contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch)
246 $(call quiet_mkdir, $(DESTDIR)$(zsh_completion_dir))
247 $(call quiet_install_data, contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch)
249 SRCS := $(SRCS) $(notmuch_client_srcs)
250 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz