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 $(SHA256_FILE): $(TAR_FILE)
42 $(GPG_FILE): $(SHA256_FILE)
48 .PHONY: update-versions
51 sed -i -e "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" \
52 -e "s/^SOVERSION[[:blank:]]*=.*$$/SOVERSION = \'${LIBNOTMUCH_VERSION_MAJOR}\'/" \
55 # We invoke make recursively only to force ordering of our phony
56 # targets in the case of parallel invocation of make (-j).
58 # We carefully ensure that our VERSION variable is passed down to any
59 # sub-ordinate make invocations (which won't otherwise know that they
60 # are part of the release and need to take the version from the
63 release: verify-source-tree-and-version
64 $(MAKE) VERSION=$(VERSION) verify-newer
65 $(MAKE) VERSION=$(VERSION) clean
66 $(MAKE) VERSION=$(VERSION) test
67 git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
68 $(MAKE) VERSION=$(VERSION) $(GPG_FILE)
69 ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
70 pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
71 git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
73 mv $(TAR_FILE) $(SHA256_FILE) $(GPG_FILE) releases
74 $(MAKE) VERSION=$(VERSION) release-message > $(PACKAGE)-$(VERSION).announce
75 ifeq ($(REALLY_UPLOAD),yes)
76 git push origin $(VERSION)
77 cd releases && scp $(TAR_FILE) $(SHA256_FILE) $(GPG_FILE) $(RELEASE_HOST):$(RELEASE_DIR)
78 ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-* ; ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(TAR_FILE)"
80 @echo "Please send a release announcement using $(PACKAGE)-$(VERSION).announce as a template."
84 $(MAKE) VERSION=$(VERSION) clean
85 $(MAKE) VERSION=$(VERSION) test
86 git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
87 git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
88 $(MAKE) VERSION=$(VERSION) $(TAR_FILE)
89 ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
90 pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
92 mv $(TAR_FILE) $(DEB_TAR_FILE) releases
94 .PHONY: debian-snapshot
96 make VERSION=$(VERSION) clean
97 TMPFILE=$$(mktemp /tmp/notmuch.XXXXXX); \
98 cp debian/changelog $${TMPFILE}; \
99 EDITOR=/bin/true dch -b -v $(VERSION)+1 \
100 -D UNRELEASED 'test build, not for upload'; \
101 echo '3.0 (native)' > debian/source/format; \
103 mv -f $${TMPFILE} debian/changelog; \
104 echo '3.0 (quilt)' > debian/source/format
106 .PHONY: release-message
108 @echo "To: notmuch@notmuchmail.org"
109 @echo "Subject: $(PACKAGE) release $(VERSION) now available"
111 @echo "Where to obtain notmuch $(VERSION)"
112 @echo "==========================="
113 @echo " $(RELEASE_URL)/$(TAR_FILE)"
115 @echo "Which can be verified with:"
117 @echo " $(RELEASE_URL)/$(SHA256_FILE)"
119 @cat releases/$(SHA256_FILE)
121 @echo " $(RELEASE_URL)/$(GPG_FILE)"
122 @echo " (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
124 @echo "What's new in notmuch $(VERSION)"
125 @echo "========================="
126 @sed -ne '/^[Nn]otmuch $(VERSION)/{n;n;b NEWS}; d; :NEWS /^===/q; {p;n;b NEWS}' < NEWS | head -n -2
128 @echo "What is notmuch"
129 @echo "==============="
130 @echo "Notmuch is a system for indexing, searching, reading, and tagging"
131 @echo "large collections of email messages in maildir or mh format. It uses"
132 @echo "the Xapian library to provide fast, full-text search with a convenient"
133 @echo "search syntax."
135 @echo "For more about notmuch, see https://notmuchmail.org"
137 # This is a chain of dependencies rather than a simple list simply to
138 # avoid the messages getting interleaved in the case of a parallel
140 .PHONY: verify-source-tree-and-version
141 verify-source-tree-and-version: verify-no-dirty-code
143 .PHONY: verify-no-dirty-code
144 verify-no-dirty-code: release-checks
146 @printf "Checking that source tree is clean..."
147 ifneq ($(shell git --git-dir=${srcdir}/.git ls-files -m),)
149 @echo "The following files have been modified since the most recent git commit:"
151 @git --git-dir=${srcdir}/.git ls-files -m
153 @echo "The release will be made from the committed state, but perhaps you meant"
154 @echo "to commit this code first? Please clean this up to make it more clear."
161 .PHONY: release-checks
163 devel/release-checks.sh
167 @echo -n "Checking that no $(VERSION) release already exists..."
168 @wget -q --no-check-certificate -O /dev/null $(RELEASE_URL)/$(TAR_FILE) ; \
172 echo "Found: $(RELEASE_URL)/$(TAR_FILE)"; \
173 echo "Refusing to replace an existing release."; \
174 echo "Don't forget to update \"version\" as described in RELEASING before release." ; \
176 *) echo "An unexpected error occured"; \
179 # The user has not set any verbosity, default to quiet mode and inform the
180 # user how to enable verbose compiles.
182 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
183 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
185 # The user has explicitly enabled quiet compilation.
187 quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
189 # Otherwise, print the full command line.
190 quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
192 %.o: %.cc $(global_deps)
193 @mkdir -p $(patsubst %/.,%,.deps/$(@D))
194 $(call quiet,CXX $(CPPFLAGS) $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
196 %.o: %.c $(global_deps)
197 @mkdir -p $(patsubst %/.,%,.deps/$(@D))
198 $(call quiet,CC $(CPPFLAGS) $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
202 rm -rf $(CLEAN); rm -rf .deps
212 notmuch_client_srcs = \
213 command-line-arguments.c\
216 gmime-filter-reply.c \
240 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
242 notmuch.o: version.stamp
244 notmuch: $(notmuch_client_modules) lib/libnotmuch.a util/libutil.a parse-time-string/libparse-time-string.a
245 $(call quiet,CXX $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@
247 notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)
248 $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
251 install: all install-man
252 mkdir -p "$(DESTDIR)$(prefix)/bin/"
253 install notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"
254 ifeq ($(MAKECMDGOALS), install)
256 @echo "Notmuch is now installed to $(DESTDIR)$(prefix)"
258 @echo "New users should simply run \"notmuch\" to be guided"
259 @echo "through the process of configuring notmuch and creating"
260 @echo "a database of existing email messages. The \"notmuch\""
261 @echo "command will also offer some sample search commands."
262 ifeq ($(WITH_EMACS), 1)
264 @echo "Beyond the command-line interface, notmuch also offers"
265 @echo "a full-featured interface for reading and writing mail"
266 @echo "within emacs. To use this, each user should add the"
267 @echo "following line to the ~/.emacs file:"
269 @echo " (require 'notmuch)"
271 @echo "And then run emacs as \"emacs -f notmuch\" or invoke"
272 @echo "the command \"M-x notmuch\" from within emacs."
276 SRCS := $(SRCS) $(notmuch_client_srcs)
277 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
278 CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
280 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config sh.config
282 DEPS := $(SRCS:%.c=.deps/%.d)
283 DEPS := $(DEPS:%.cc=.deps/%.d)
286 .SUFFIXES: # Delete the default suffixes. Old-Fashioned Suffix Rules not used.