4 all: notmuch notmuch-shared build-man ruby-bindings
5 ifeq ($(MAKECMDGOALS),)
6 ifeq ($(shell cat .first-build-message 2>/dev/null),)
7 @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
9 @echo "Compilation of notmuch is now complete. You can install notmuch with:"
13 @echo "Note that depending on the prefix to which you are installing"
14 @echo "you may need root permission (such as \"sudo make install\")."
15 @echo "See \"./configure --help\" for help on setting an alternate prefix."
16 @echo Printed > .first-build-message
20 # Depend (also) on the file 'version'. In case of ifeq ($(IS_GIT),yes)
21 # this file may already have been updated.
22 version.stamp: $(srcdir)/version
26 if git tag -v $(UPSTREAM_TAG) >/dev/null 2>&1; then \
27 ref=$(UPSTREAM_TAG); \
30 echo "Warning: No signed tag for $(VERSION)"; \
32 git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ $$ref > $(TAR_FILE).tmp
33 echo $(VERSION) > version.tmp
34 tar --append -f $(TAR_FILE).tmp --transform s_^_$(PACKAGE)-$(VERSION)/_ --transform 's_.tmp$$__' version.tmp
36 gzip < $(TAR_FILE).tmp > $(TAR_FILE)
37 @echo "Source is ready for release in $(TAR_FILE)"
39 $(SHA1_FILE): $(TAR_FILE)
42 $(GPG_FILE): $(SHA1_FILE)
43 @echo "Please enter your GPG password to sign the checksum."
49 .PHONY: update-versions
52 sed -i -e "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" \
53 -e "s/^SOVERSION[[:blank:]]*=.*$$/SOVERSION = \'${LIBNOTMUCH_VERSION_MAJOR}\'/" \
56 # We invoke make recursively only to force ordering of our phony
57 # targets in the case of parallel invocation of make (-j).
59 # We carefully ensure that our VERSION variable is passed down to any
60 # sub-ordinate make invocations (which won't otherwise know that they
61 # are part of the release and need to take the version from the
64 release: verify-source-tree-and-version
65 $(MAKE) VERSION=$(VERSION) verify-newer
66 $(MAKE) VERSION=$(VERSION) clean
67 $(MAKE) VERSION=$(VERSION) test
68 git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
69 $(MAKE) VERSION=$(VERSION) $(GPG_FILE)
70 ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
71 pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
72 git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
74 mv $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) releases
75 $(MAKE) VERSION=$(VERSION) release-message > $(PACKAGE)-$(VERSION).announce
76 ifeq ($(REALLY_UPLOAD),yes)
77 git push origin $(VERSION)
78 cd releases && scp $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) $(RELEASE_HOST):$(RELEASE_DIR)
79 ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-* ; ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(TAR_FILE)"
81 @echo "Please send a release announcement using $(PACKAGE)-$(VERSION).announce as a template."
85 $(MAKE) VERSION=$(VERSION) clean
86 $(MAKE) VERSION=$(VERSION) test
87 git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
88 git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
89 $(MAKE) VERSION=$(VERSION) $(TAR_FILE)
90 ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
91 pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
93 mv $(TAR_FILE) $(DEB_TAR_FILE) releases
95 .PHONY: debian-snapshot
97 make VERSION=$(VERSION) clean
98 TMPFILE=$$(mktemp /tmp/notmuch.XXXXXX); \
99 cp debian/changelog $${TMPFILE}; \
100 EDITOR=/bin/true dch -b -v $(VERSION)+1 \
101 -D UNRELEASED 'test build, not for upload'; \
102 echo '3.0 (native)' > debian/source/format; \
104 mv -f $${TMPFILE} debian/changelog; \
105 echo '3.0 (quilt)' > debian/source/format
107 .PHONY: release-message
109 @echo "To: notmuch@notmuchmail.org"
110 @echo "Subject: $(PACKAGE) release $(VERSION) now available"
112 @echo "Where to obtain notmuch $(VERSION)"
113 @echo "==========================="
114 @echo " $(RELEASE_URL)/$(TAR_FILE)"
116 @echo "Which can be verified with:"
118 @echo " $(RELEASE_URL)/$(SHA1_FILE)"
120 @cat releases/$(SHA1_FILE)
122 @echo " $(RELEASE_URL)/$(GPG_FILE)"
123 @echo " (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
125 @echo "What's new in notmuch $(VERSION)"
126 @echo "========================="
127 @sed -ne '/^[Nn]otmuch $(VERSION)/{n;n;b NEWS}; d; :NEWS /^===/q; {p;n;b NEWS}' < NEWS | head -n -2
129 @echo "What is notmuch"
130 @echo "==============="
131 @echo "Notmuch is a system for indexing, searching, reading, and tagging"
132 @echo "large collections of email messages in maildir or mh format. It uses"
133 @echo "the Xapian library to provide fast, full-text search with a convenient"
134 @echo "search syntax."
136 @echo "For more about notmuch, see https://notmuchmail.org"
138 # This is a chain of dependencies rather than a simple list simply to
139 # avoid the messages getting interleaved in the case of a parallel
141 .PHONY: verify-source-tree-and-version
142 verify-source-tree-and-version: verify-no-dirty-code
144 .PHONY: verify-no-dirty-code
145 verify-no-dirty-code: release-checks
147 @printf "Checking that source tree is clean..."
148 ifneq ($(shell git --git-dir=${srcdir}/.git ls-files -m),)
150 @echo "The following files have been modified since the most recent git commit:"
152 @git --git-dir=${srcdir}/.git ls-files -m
154 @echo "The release will be made from the committed state, but perhaps you meant"
155 @echo "to commit this code first? Please clean this up to make it more clear."
162 .PHONY: release-checks
164 devel/release-checks.sh
168 @echo -n "Checking that no $(VERSION) release already exists..."
169 @wget -q --no-check-certificate -O /dev/null $(RELEASE_URL)/$(TAR_FILE) ; \
173 echo "Found: $(RELEASE_URL)/$(TAR_FILE)"; \
174 echo "Refusing to replace an existing release."; \
175 echo "Don't forget to update \"version\" as described in RELEASING before release." ; \
177 *) echo "An unexpected error occured"; \
180 # The user has not set any verbosity, default to quiet mode and inform the
181 # user how to enable verbose compiles.
183 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
184 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
186 # The user has explicitly enabled quiet compilation.
188 quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
190 # Otherwise, print the full command line.
191 quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
193 %.o: %.cc $(global_deps)
194 @mkdir -p $(patsubst %/.,%,.deps/$(@D))
195 $(call quiet,CXX $(CPPFLAGS) $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
197 %.o: %.c $(global_deps)
198 @mkdir -p $(patsubst %/.,%,.deps/$(@D))
199 $(call quiet,CC $(CPPFLAGS) $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
203 rm -rf $(CLEAN); rm -rf .deps
213 notmuch_client_srcs = \
214 command-line-arguments.c\
217 gmime-filter-reply.c \
241 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
243 notmuch.o: version.stamp
245 notmuch: $(notmuch_client_modules) lib/libnotmuch.a util/libutil.a parse-time-string/libparse-time-string.a
246 $(call quiet,CXX $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@
248 notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)
249 $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
252 install: all install-man
253 mkdir -p "$(DESTDIR)$(prefix)/bin/"
254 install notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"
255 ifeq ($(MAKECMDGOALS), install)
257 @echo "Notmuch is now installed to $(DESTDIR)$(prefix)"
259 @echo "New users should simply run \"notmuch\" to be guided"
260 @echo "through the process of configuring notmuch and creating"
261 @echo "a database of existing email messages. The \"notmuch\""
262 @echo "command will also offer some sample search commands."
263 ifeq ($(WITH_EMACS), 1)
265 @echo "Beyond the command-line interface, notmuch also offers"
266 @echo "a full-featured interface for reading and writing mail"
267 @echo "within emacs. To use this, each user should add the"
268 @echo "following line to the ~/.emacs file:"
270 @echo " (require 'notmuch)"
272 @echo "And then run emacs as \"emacs -f notmuch\" or invoke"
273 @echo "the command \"M-x notmuch\" from within emacs."
277 SRCS := $(SRCS) $(notmuch_client_srcs)
278 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
279 CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
281 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config sh.config
283 DEPS := $(SRCS:%.c=.deps/%.d)
284 DEPS := $(DEPS:%.cc=.deps/%.d)
287 .SUFFIXES: # Delete the default suffixes. Old-Fashioned Suffix Rules not used.