]> git.notmuchmail.org Git - notmuch/blob - Makefile.local
notmuch.el: Allow citation suffixes to be shown as well as prefixes.
[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_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch
46 FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
47
48 .PHONY: all
49 all: notmuch notmuch-shared notmuch.1.gz
50 ifeq ($(MAKECMDGOALS),)
51 ifeq ($(shell cat .first-build-message),)
52         @NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
53         @echo ""
54         @echo "Compilation of notmuch is now complete. You can install notmuch with:"
55         @echo ""
56         @echo " make install"
57         @echo ""
58         @echo "Note that depending on the prefix to which you are installing"
59         @echo "you may need root permission (such as \"sudo make install\")."
60         @echo "See \"./configure --help\" for help on setting an alternate prefix."
61         @echo Printed > .first-build-message
62 endif
63 endif
64
65 $(TAR_FILE):
66         git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ HEAD | gzip > $(TAR_FILE)
67         @echo "Source is ready for release in $(TAR_FILE)"
68
69 $(SHA1_FILE): $(TAR_FILE)
70         sha1sum $^ > $@
71
72 $(GPG_FILE): $(SHA1_FILE)
73         @echo "Please enter your GPG password to sign the checksum."
74         gpg --armor --sign $^ 
75
76 .PHONY: dist
77 dist: $(TAR_FILE)
78
79 # We invoke make recursively only to force ordering of our phony
80 # targets in the case of parallel invocation of make (-j).
81 .PHONY: release
82 release: release-verify-newer
83         $(MAKE) release-upload
84         @echo "Please send a release announcement as follows:"
85         @echo ""
86         $(MAKE) release-message
87         $(MAKE) release-message > $(PACKAGE)-$(VERSION).announce
88         @echo "(This message is also available in $(PACKAGE)-$(VERSION).announce"
89
90 .PHONY: release-upload
91 release-upload: $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE)
92         mkdir -p releases
93         scp $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) $(RELEASE_HOST):$(RELEASE_DIR)
94         mv $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) releases
95         ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
96         git tag -s -m "$(PACKAGE) $(VERSION) release" $(VERSION)
97         git push origin $(VERSION)
98
99 .PHONY: release-message
100 release-message:
101         @echo "To: notmuch@notmuchmail.org"
102         @echo "Subject: $(PACKAGE) release $(VERSION) now available"
103         @echo ""
104         @echo "Where to obtain notmuch $(VERSION)"
105         @echo "==========================="
106         @echo "  $(RELEASE_URL)/$(TAR_FILE)"
107         @echo ""
108         @echo "Which can be verified with:"
109         @echo ""
110         @echo "  $(RELEASE_URL)/$(SHA1_FILE)"
111         @echo -n "  "
112         @cat releases/$(SHA1_FILE)
113         @echo ""
114         @echo "  $(RELEASE_URL)/$(GPG_FILE)"
115         @echo "  (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
116         @echo ""
117         @echo "What's new in notmuch $(VERSION)"
118         @echo "========================="
119         @sed -ne '/^[Nn]otmuch 0.1/{n;n;b NEWS}; d; :NEWS /^===/q; {p;n;b NEWS}' < NEWS | head -n -2
120         @echo ""
121         @echo "What is notmuch"
122         @echo "==============="
123         @echo "Notmuch is a system for indexing, searching, reading, and tagging"
124         @echo "large collections of email messages in maildir or mh format. It uses"
125         @echo "the Xapian library to provide fast, full-text search with a convenient"
126         @echo "search syntax."
127         @echo ""
128         @echo "For more about notmuch, see http://notmuchmail.org"
129
130
131 .PHONY: release-verify-version
132 release-verify-version:
133         @echo -n "Checking that $(VERSION) is a two-component version..."
134         @if echo $(VERSION) | grep -q -v -x '[0-9]*\.[0-9]*'; then \
135                 (echo "Ouch." && \
136                  echo "Before releasing the notmuch version should be a two-component value." && false);\
137          else :; fi
138         @echo "Good."
139
140 .PHONY: release-verify-newer
141 release-verify-newer: release-verify-version
142         @echo -n "Checking that no $(VERSION) release already exists..."
143         @ssh $(RELEASE_HOST) test ! -e $(RELEASE_DIR)/$(TAR_FILE) \
144                 || (echo "Ouch." && echo "Found: $(RELEASE_HOST):$(RELEASE_DIR)/$(TAR_FILE)" \
145                 && echo "Refusing to replace an existing release." && false)
146         @echo "Good."
147
148 # The user has not set any verbosity, default to quiet mode and inform the
149 # user how to enable verbose compiles.
150 ifeq ($(V),)
151 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
152 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
153 endif
154 # The user has explicitly enabled quiet compilation.
155 ifeq ($(V),0)
156 quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
157 endif
158 # Otherwise, print the full command line.
159 quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
160
161 %.o: %.cc $(global_deps)
162         $(call quiet,CXX $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
163
164 %.o: %.c $(global_deps)
165         $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
166
167 .deps/%.d: %.c $(global_deps)
168         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
169         $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
170         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
171         rm -f $@.$$$$
172
173 .deps/%.d: %.cc $(global_deps)
174         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
175         $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
176         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
177         rm -f $@.$$$$
178
179 DEPS := $(SRCS:%.c=.deps/%.d)
180 DEPS := $(DEPS:%.cc=.deps/%.d)
181 -include $(DEPS)
182
183 .PHONY : clean
184 clean:
185         rm -f $(CLEAN); rm -rf .deps
186
187 # We don't (yet) have any distributed files not in the upstream repository.
188 # So distclean is currently identical to clean.
189 .PHONY: distclean
190 distclean: clean
191
192 notmuch_client_srcs =           \
193         $(notmuch_compat_srcs)  \
194         debugger.c              \
195         gmime-filter-reply.c    \
196         notmuch.c               \
197         notmuch-config.c        \
198         notmuch-count.c         \
199         notmuch-dump.c          \
200         notmuch-new.c           \
201         notmuch-reply.c         \
202         notmuch-restore.c       \
203         notmuch-search.c        \
204         notmuch-search-tags.c   \
205         notmuch-setup.c         \
206         notmuch-show.c          \
207         notmuch-tag.c           \
208         notmuch-time.c          \
209         query-string.c          \
210         show-message.c          \
211         json.c
212
213 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
214
215 notmuch: $(notmuch_client_modules) lib/libnotmuch.a
216         $(call quiet,CC $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@
217
218 notmuch-shared: $(notmuch_client_modules) lib/libnotmuch.so
219         $(call quiet,CC $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
220
221 notmuch.1.gz: notmuch.1
222         gzip --stdout $^ > $@
223
224 .PHONY: install
225 install: all notmuch.1.gz
226         mkdir -p $(DESTDIR)$(mandir)/man1
227         install -m0644 notmuch.1.gz $(DESTDIR)$(mandir)/man1/
228         mkdir -p $(DESTDIR)$(prefix)/bin/
229         install notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch
230 ifeq ($(MAKECMDGOALS), install)
231         @echo ""
232         @echo "Notmuch is now installed to $(DESTDIR)$(prefix)"
233         @echo ""
234         @echo "To run notmuch from emacs, each user should add the following line to ~/.emacs:"
235         @echo ""
236         @echo " (require 'notmuch)"
237         @echo ""
238         @echo "And should then run \"M-x notmuch\" from within emacs or run \"emacs -f notmuch\""
239 endif
240
241 .PHONY: install-desktop
242 install-desktop:
243         mkdir -p $(DESTDIR)$(desktop_dir)
244         desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop
245
246 SRCS  := $(SRCS) $(notmuch_client_srcs)
247 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz