]> git.notmuchmail.org Git - notmuch/blob - Makefile.local
make release: Add "what's new" and "what is notmuch" sections to announcement
[notmuch] / Makefile.local
1 # -*- makefile -*-
2
3 # Here's the (hopefully simple) versioning scheme.
4 #
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.
8 #
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
12 # merged.
13 PACKAGE=notmuch
14 VERSION=0.1.1
15
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
22
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
29         @echo ""
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."
34         @echo ""
35         ./configure
36
37 # Sub-directory Makefile.local fragments can append to these variables
38 # to have directory-specific cflags as necessary.
39 extra_cflags :=
40 extra_cxxflags :=
41
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)
46
47 .PHONY: all
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
52         @echo ""
53         @echo "Compilation of notmuch is now complete. You can install notmuch with:"
54         @echo ""
55         @echo " make install"
56         @echo ""
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
61 endif
62 endif
63
64 $(TAR_FILE):
65         git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ HEAD | gzip > $(TAR_FILE)
66         @echo "Source is ready for release in $(TAR_FILE)"
67
68 $(SHA1_FILE): $(TAR_FILE)
69         sha1sum $^ > $@
70
71 $(GPG_FILE): $(SHA1_FILE)
72         @echo "Please enter your GPG password to sign the checksum."
73         gpg --armor --sign $^ 
74
75 .PHONY: dist
76 dist: $(TAR_FILE)
77
78 # We invoke make recursively only to force ordering of our phony
79 # targets in the case of parallel invocation of make (-j).
80 .PHONY: release
81 release: release-verify-newer
82         $(MAKE) release-upload
83         @echo "Please send a release announcement as follows:"
84         @echo ""
85         $(MAKE) release-message
86         $(MAKE) release-message > $(PACKAGE)-$(VERSION).announce
87         @echo "(This message is also available in $(PACKAGE)-$(VERSION).announce"
88
89 .PHONY: release-upload
90 release-upload: $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE)
91         mkdir -p releases
92         scp $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) $(RELEASE_HOST):$(RELEASE_DIR)
93         mv $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) releases
94         ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
95         git tag -s -m "$(PACKAGE) $(VERSION) release" $(VERSION)
96         git push origin $(VERSION)
97
98 .PHONY: release-message
99 release-message:
100         @echo "To: notmuch@notmuchmail.org"
101         @echo "Subject: $(PACKAGE) release $(VERSION) now available"
102         @echo ""
103         @echo "Where to obtain notmuch $(VERSION)"
104         @echo "==========================="
105         @echo "  $(RELEASE_URL)/$(TAR_FILE)"
106         @echo ""
107         @echo "Which can be verified with:"
108         @echo ""
109         @echo "  $(RELEASE_URL)/$(SHA1_FILE)"
110         @echo -n "  "
111         @cat releases/$(SHA1_FILE)
112         @echo ""
113         @echo "  $(RELEASE_URL)/$(GPG_FILE)"
114         @echo "  (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
115         @echo ""
116         @echo "What's new in notmuch $(VERSION)"
117         @echo "========================="
118         @sed -ne '/^[Nn]otmuch 0.1/{n;n;b NEWS}; d; :NEWS /^===/q; {p;n;b NEWS}' < NEWS | head -n -2
119         @echo ""
120         @echo "What is notmuch"
121         @echo "==============="
122         @echo "Notmuch is a system for indexing, searching, reading, and tagging"
123         @echo "large collections of email messages in maildir or mh format. It uses"
124         @echo "the Xapian library to provide fast, full-text search with a convenient"
125         @echo "search syntax."
126         @echo ""
127         @echo "For more about notmuch, see http://notmuchmail.org"
128
129
130 .PHONY: release-verify-version
131 release-verify-version:
132         @echo -n "Checking that $(VERSION) is a two-component version..."
133         @if echo $(VERSION) | grep -q -v -x '[0-9]*\.[0-9]*'; then \
134                 (echo "Ouch." && \
135                  echo "Before releasing the notmuch version should be a two-component value." && false);\
136          else :; fi
137         @echo "Good."
138
139 .PHONY: release-verify-newer
140 release-verify-newer: release-verify-version
141         @echo -n "Checking that no $(VERSION) release already exists..."
142         @ssh $(RELEASE_HOST) test ! -e $(RELEASE_DIR)/$(TAR_FILE) \
143                 || (echo "Ouch." && echo "Found: $(RELEASE_HOST):$(RELEASE_DIR)/$(TAR_FILE)" \
144                 && echo "Refusing to replace an existing release." && false)
145         @echo "Good."
146
147 # The user has not set any verbosity, default to quiet mode and inform the
148 # user how to enable verbose compiles.
149 ifeq ($(V),)
150 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
151 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"  %12s $@\n" "$1 $2"; $($1)
152 quiet_args = @printf $(quiet_DOC)$(eval quiet_DOC:=)"  %12s$2\n" $1; $($1) $2
153 endif
154 # The user has explicitly enabled quiet compilation.
155 ifeq ($(V),0)
156 quiet = @printf "  %12s $@\n" "$1 $2"; $($1)
157 quiet_args = @printf "  %12s$2\n" $1; $($1) $2
158 endif
159 # Otherwise, print the full command line.
160 quiet ?= $($1)
161 quiet_args ?= $($1) $2
162
163 quiet_mkdir = $(call quiet_args,MKDIR,$1)
164 quiet_install_bin = $(call quiet_args,INSTALL-BIN,$1)
165 quiet_install_data = $(call quiet_args,INSTALL-DATA,$1)
166 quiet_symlink = $(call quiet_args,SYMLINK,$1)
167
168 %.o: %.cc $(global_deps)
169         $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
170
171 %.o: %.c $(global_deps)
172         $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
173
174 %.elc: %.el
175         $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
176
177 .deps/%.d: %.c $(global_deps)
178         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
179         $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
180         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
181         rm -f $@.$$$$
182
183 .deps/%.d: %.cc $(global_deps)
184         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
185         $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
186         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
187         rm -f $@.$$$$
188
189 DEPS := $(SRCS:%.c=.deps/%.d)
190 DEPS := $(DEPS:%.cc=.deps/%.d)
191 -include $(DEPS)
192
193 .PHONY : clean
194 clean:
195         rm -f $(CLEAN); rm -rf .deps
196
197 notmuch_client_srcs =           \
198         $(notmuch_compat_srcs)  \
199         debugger.c              \
200         gmime-filter-reply.c    \
201         notmuch.c               \
202         notmuch-config.c        \
203         notmuch-count.c         \
204         notmuch-dump.c          \
205         notmuch-new.c           \
206         notmuch-reply.c         \
207         notmuch-restore.c       \
208         notmuch-search.c        \
209         notmuch-search-tags.c   \
210         notmuch-setup.c         \
211         notmuch-show.c          \
212         notmuch-tag.c           \
213         notmuch-time.c          \
214         query-string.c          \
215         show-message.c          \
216         json.c
217
218 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
219
220 notmuch: $(notmuch_client_modules) lib/libnotmuch.a
221         $(call quiet,CC,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@
222
223 notmuch-shared: $(notmuch_client_modules) lib/libnotmuch.so
224         $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(notmuch_client_modules) $(FINAL_LDFLAGS) -o $@
225
226 notmuch.1.gz: notmuch.1
227         $(call quiet,gzip) --stdout $^ > $@
228
229 .PHONY: install
230 install: all notmuch.1.gz
231         $(call quiet_mkdir, $(DESTDIR)$(prefix)/bin/)
232         $(call quiet_mkdir, $(DESTDIR)$(libdir)/)
233         $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
234         $(call quiet_mkdir, $(DESTDIR)$(prefix)/share/man/man1)
235         $(call quiet_install_bin, notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch)
236         $(call quiet_install_data, notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/)
237 ifeq ($(MAKECMDGOALS), install)
238         @echo ""
239         @echo "Notmuch is now installed."
240         @echo ""
241         @echo "You may now want to install additional components to support using notmuch"
242         @echo "together with other software packages:"
243         @echo ""
244         @echo " make install-emacs"
245         @echo " make install-bash"
246         @echo " make install-zsh"
247         @echo ""
248 endif
249
250 .PHONY: install-desktop
251 install-desktop:
252         $(call quiet,MKDIR) $(DESTDIR)$(desktop_dir)
253         desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop
254
255 .PHONY: install-bash
256 install-bash:
257         $(call quiet-mkdir, $(DESTDIR)$(bash_completion_dir))
258         $(call quiet_install_data, contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch)
259
260 .PHONY: install-zsh
261 install-zsh:
262         $(call quiet_mkdir, $(DESTDIR)$(zsh_completion_dir))
263         $(call quiet_install_data, contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch)
264
265 SRCS  := $(SRCS) $(notmuch_client_srcs)
266 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz