]> git.notmuchmail.org Git - notmuch/blob - emacs/Makefile.local
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / emacs / Makefile.local
1 # -*- makefile-gmake -*-
2
3 dir := emacs
4 emacs_sources := \
5         $(dir)/notmuch-lib.el \
6         $(dir)/notmuch-compat.el \
7         $(dir)/notmuch-parser.el \
8         $(dir)/notmuch.el \
9         $(dir)/notmuch-query.el \
10         $(dir)/notmuch-show.el \
11         $(dir)/notmuch-tree.el \
12         $(dir)/notmuch-wash.el \
13         $(dir)/notmuch-hello.el \
14         $(dir)/notmuch-mua.el \
15         $(dir)/notmuch-address.el \
16         $(dir)/notmuch-maildir-fcc.el \
17         $(dir)/notmuch-message.el \
18         $(dir)/notmuch-crypto.el \
19         $(dir)/notmuch-tag.el \
20         $(dir)/coolj.el \
21         $(dir)/notmuch-print.el \
22         $(dir)/notmuch-version.el \
23         $(dir)/notmuch-jump.el \
24         $(dir)/notmuch-company.el \
25         $(dir)/notmuch-draft.el
26
27 elpa_sources := ${emacs_sources} $(dir)/notmuch-pkg.el
28
29 $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
30 $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
31         @sed -e 's/%AG%/Generated file (from $(<F)) -- do not edit!/' \
32              -e 's/%VERSION%/"$(VERSION)"/' $< > $@
33
34 $(dir)/notmuch-pkg.el: $(srcdir)/$(dir)/notmuch-pkg.el.tmpl
35         @sed -e 's/%AG%/Generated file (from $(<F)) -- do not edit!/' \
36              -e 's/%VERSION%/"$(ELPA_VERSION)"/' $< > $@
37
38 all: $(dir)/notmuch-pkg.el
39 install-emacs: $(dir)/notmuch-pkg.el
40
41 emacs_mua := $(dir)/notmuch-emacs-mua
42 emacs_mua_desktop := $(dir)/notmuch-emacs-mua.desktop
43
44 emacs_images := \
45         $(srcdir)/$(dir)/notmuch-logo.svg
46
47 emacs_bytecode = $(emacs_sources:.el=.elc)
48 emacs_docstrings = $(emacs_sources:.el=.rsti)
49
50 ifneq ($(HAVE_SPHINX)$(WITH_EMACS),11)
51 docstring.stamp:
52         @echo "Missing prerequisites, not collecting docstrings"
53 else
54 docstring.stamp: ${emacs_docstrings}
55         touch $@
56 endif
57
58 # Because of defmacro's and defsubst's, we have to account for load
59 # dependencies between Elisp files when byte compiling.  Otherwise,
60 # the byte compiler may load an old .elc file when processing a
61 # "require" or we may fail to rebuild a .elc that depended on a macro
62 # from an updated file.
63 ifeq ($(WITH_EMACS),1)
64 $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
65         $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
66                 -f batch-make-deps $(emacs_sources) > $@.tmp && \
67                 mv $@.tmp $@
68 # We could include .eldeps directly, but that would cause a make
69 # restart whenever any .el file was modified, even if dependencies
70 # didn't change, because the mtime of .eldeps will change.  Instead,
71 # we include a second file, .eldeps.x, which we ensure always has the
72 # same content as .eldeps, but its mtime only changes when dependency
73 # information changes, in which case a make restart is necessary
74 # anyway.
75 $(dir)/.eldeps.x: $(dir)/.eldeps
76         @cmp -s $^ $@ || cp $^ $@
77 -include $(dir)/.eldeps.x
78
79 # Add the one dependency make-deps.el does not have visibility to.
80 $(dir)/notmuch-lib.elc: $(dir)/notmuch-version.elc
81
82 endif
83 CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x
84
85 ifeq ($(WITH_EMACS),1)
86 %.elc: %.el $(global_deps)
87         $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
88 %.rsti: %.el
89         $(call quiet,EMACS) -batch -L emacs -l rstdoc -f rstdoc-batch-extract $< $@
90 endif
91
92 elpa: $(ELPA_FILE)
93
94 ELPA_DIR=.elpa-build/notmuch-${ELPA_VERSION}
95 notmuch-emacs-%.tar: ${elpa_sources} build-info
96         mkdir -p .elpa-build/notmuch-${ELPA_VERSION}
97         cp ${elpa_sources} ${ELPA_DIR}
98 ifeq ($(HAVE_SPHINX)$(HAVE_MAKEINFO)$(HAVE_INSTALL_INFO),111)
99         cp ${INFO_INFO_FILES} ${ELPA_DIR}
100         for file in ${INFO_INFO_FILES}; do install-info $$file ${ELPA_DIR}/dir; done
101 endif
102         tar -C .elpa-build -cf $@ notmuch-${ELPA_VERSION}
103         rm -r .elpa-build
104
105 ifeq ($(WITH_EMACS),1)
106 all: $(emacs_bytecode) $(emacs_docstrings)
107 install-emacs: $(emacs_bytecode)
108
109 install: install-emacs
110 endif
111
112 .PHONY: install-emacs
113 install-emacs: $(emacs_sources) $(emacs_images)
114         mkdir -p "$(DESTDIR)$(emacslispdir)"
115         install -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"
116 ifeq ($(WITH_EMACS),1)
117         install -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"
118 endif
119         mkdir -p "$(DESTDIR)$(emacsetcdir)"
120         install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
121         mkdir -p "$(DESTDIR)$(prefix)/bin/"
122 ifeq ($(HAVE_BASH),1)
123         sed "1s|^#!.*|#! $(BASH_ABSOLUTE)|" < $(emacs_mua) > $(DESTDIR)$(prefix)/bin/notmuch-emacs-mua
124         chmod 755 $(DESTDIR)$(prefix)/bin/notmuch-emacs-mua
125 endif
126 ifeq ($(WITH_DESKTOP),1)
127         mkdir -p "$(DESTDIR)$(desktop_dir)"
128         desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" $(emacs_mua_desktop)
129         -update-desktop-database "$(DESTDIR)$(desktop_dir)"
130 endif
131
132 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el $(dir)/notmuch-pkg.el \
133         $(emacs_docstrings) docstring.stamp