]> git.notmuchmail.org Git - notmuch/blob - Makefile.local
version: bump to 0.24~rc0
[notmuch] / Makefile.local
1 # -*- makefile -*-
2
3 .PHONY: all
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
8         @echo ""
9         @echo "Compilation of notmuch is now complete. You can install notmuch with:"
10         @echo ""
11         @echo " make install"
12         @echo ""
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
17 endif
18 endif
19
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
23         echo $(VERSION) > $@
24
25 $(TAR_FILE):
26         if git tag -v $(UPSTREAM_TAG) >/dev/null 2>&1; then \
27            ref=$(UPSTREAM_TAG); \
28         else \
29            ref="HEAD" ; \
30            echo "Warning: No signed tag for $(VERSION)"; \
31         fi ; \
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
35         rm version.tmp
36         gzip < $(TAR_FILE).tmp > $(TAR_FILE)
37         @echo "Source is ready for release in $(TAR_FILE)"
38
39 $(SHA256_FILE): $(TAR_FILE)
40         sha256sum $^ > $@
41
42 $(GPG_FILE): $(SHA256_FILE)
43         gpg --armor --sign $^
44
45 .PHONY: dist
46 dist: $(TAR_FILE)
47
48 .PHONY: update-versions
49
50 update-versions:
51         sed -i -e "s/^__VERSION__[[:blank:]]*=.*$$/__VERSION__ = \'${VERSION}\'/" \
52             -e "s/^SOVERSION[[:blank:]]*=.*$$/SOVERSION = \'${LIBNOTMUCH_VERSION_MAJOR}\'/" \
53             ${PV_FILE}
54
55 # We invoke make recursively only to force ordering of our phony
56 # targets in the case of parallel invocation of make (-j).
57 #
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
61 # version file).
62 .PHONY: release
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)
72         mkdir -p releases
73         mv $(TAR_FILE) $(SHA1_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) $(SHA1_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)"
79 endif
80         @echo "Please send a release announcement using $(PACKAGE)-$(VERSION).announce as a template."
81
82 .PHONY: pre-release
83 pre-release:
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)
91         mkdir -p releases
92         mv $(TAR_FILE) $(DEB_TAR_FILE) releases
93
94 .PHONY: debian-snapshot
95 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;   \
102           debuild -us -uc;                              \
103           mv -f $${TMPFILE} debian/changelog;           \
104           echo '3.0 (quilt)' > debian/source/format
105
106 .PHONY: release-message
107 release-message:
108         @echo "To: notmuch@notmuchmail.org"
109         @echo "Subject: $(PACKAGE) release $(VERSION) now available"
110         @echo ""
111         @echo "Where to obtain notmuch $(VERSION)"
112         @echo "==========================="
113         @echo "  $(RELEASE_URL)/$(TAR_FILE)"
114         @echo ""
115         @echo "Which can be verified with:"
116         @echo ""
117         @echo "  $(RELEASE_URL)/$(SHA1_FILE)"
118         @echo -n "  "
119         @cat releases/$(SHA1_FILE)
120         @echo ""
121         @echo "  $(RELEASE_URL)/$(GPG_FILE)"
122         @echo "  (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
123         @echo ""
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
127         @echo ""
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."
134         @echo ""
135         @echo "For more about notmuch, see https://notmuchmail.org"
136
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
139 # make invocation.
140 .PHONY: verify-source-tree-and-version
141 verify-source-tree-and-version: verify-no-dirty-code
142
143 .PHONY: verify-no-dirty-code
144 verify-no-dirty-code: release-checks
145 ifeq ($(IS_GIT),yes)
146         @printf "Checking that source tree is clean..."
147 ifneq ($(shell git --git-dir=${srcdir}/.git ls-files -m),)
148         @echo "No"
149         @echo "The following files have been modified since the most recent git commit:"
150         @echo ""
151         @git --git-dir=${srcdir}/.git ls-files -m
152         @echo ""
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."
155         @false
156 else
157         @echo "Good"
158 endif
159 endif
160
161 .PHONY: release-checks
162 release-checks:
163         devel/release-checks.sh
164
165 .PHONY: verify-newer
166 verify-newer:
167         @echo -n "Checking that no $(VERSION) release already exists..."
168         @wget -q --no-check-certificate -O /dev/null $(RELEASE_URL)/$(TAR_FILE) ; \
169         case $$? in \
170           8) echo "Good." ;; \
171           0) echo "Ouch."; \
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." ; \
175              false ;; \
176           *) echo "An unexpected error occured"; \
177              false;; esac
178
179 # The user has not set any verbosity, default to quiet mode and inform the
180 # user how to enable verbose compiles.
181 ifeq ($(V),)
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'/ .*//'))
184 endif
185 # The user has explicitly enabled quiet compilation.
186 ifeq ($(V),0)
187 quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
188 endif
189 # Otherwise, print the full command line.
190 quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
191
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
195
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
199
200 .PHONY : clean
201 clean:
202         rm -rf $(CLEAN); rm -rf .deps
203
204 .PHONY: distclean
205 distclean: clean
206         rm -rf $(DISTCLEAN)
207
208 .PHONY: dataclean
209 dataclean: distclean
210         rm -rf $(DATACLEAN)
211
212 notmuch_client_srcs =           \
213         command-line-arguments.c\
214         debugger.c              \
215         status.c                \
216         gmime-filter-reply.c    \
217         hooks.c                 \
218         notmuch.c               \
219         notmuch-compact.c       \
220         notmuch-config.c        \
221         notmuch-count.c         \
222         notmuch-dump.c          \
223         notmuch-insert.c        \
224         notmuch-new.c           \
225         notmuch-reply.c         \
226         notmuch-restore.c       \
227         notmuch-search.c        \
228         notmuch-setup.c         \
229         notmuch-show.c          \
230         notmuch-tag.c           \
231         notmuch-time.c          \
232         sprinter-json.c         \
233         sprinter-sexp.c         \
234         sprinter-text.c         \
235         query-string.c          \
236         mime-node.c             \
237         crypto.c                \
238         tag-util.c
239
240 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
241
242 notmuch.o: version.stamp
243
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 $@
246
247 notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)
248         $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
249
250 .PHONY: install
251 install: all install-man
252         mkdir -p "$(DESTDIR)$(prefix)/bin/"
253         install notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"
254 ifeq ($(MAKECMDGOALS), install)
255         @echo ""
256         @echo "Notmuch is now installed to $(DESTDIR)$(prefix)"
257         @echo ""
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)
263         @echo ""
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:"
268         @echo ""
269         @echo " (require 'notmuch)"
270         @echo ""
271         @echo "And then run emacs as \"emacs -f notmuch\" or invoke"
272         @echo "the command \"M-x notmuch\" from within emacs."
273 endif
274 endif
275
276 SRCS  := $(SRCS) $(notmuch_client_srcs)
277 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
278 CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
279
280 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config sh.config
281
282 DEPS := $(SRCS:%.c=.deps/%.d)
283 DEPS := $(DEPS:%.cc=.deps/%.d)
284 -include $(DEPS)
285
286 .SUFFIXES: # Delete the default suffixes. Old-Fashioned Suffix Rules not used.