]> git.notmuchmail.org Git - notmuch/blob - emacs/Makefile.local
build: install notmuch-emacs-mua with notmuch-emacs
[notmuch] / emacs / Makefile.local
1 # -*- makefile -*-
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
43 emacs_images := \
44         $(srcdir)/$(dir)/notmuch-logo.png
45
46 emacs_bytecode = $(emacs_sources:.el=.elc)
47
48 # Because of defmacro's and defsubst's, we have to account for load
49 # dependencies between Elisp files when byte compiling.  Otherwise,
50 # the byte compiler may load an old .elc file when processing a
51 # "require" or we may fail to rebuild a .elc that depended on a macro
52 # from an updated file.
53 ifeq ($(HAVE_EMACS),1)
54 $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
55         $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
56                 -f batch-make-deps $(emacs_sources) > $@.tmp && \
57                 mv $@.tmp $@
58 # We could include .eldeps directly, but that would cause a make
59 # restart whenever any .el file was modified, even if dependencies
60 # didn't change, because the mtime of .eldeps will change.  Instead,
61 # we include a second file, .eldeps.x, which we ensure always has the
62 # same content as .eldeps, but its mtime only changes when dependency
63 # information changes, in which case a make restart is necessary
64 # anyway.
65 $(dir)/.eldeps.x: $(dir)/.eldeps
66         @cmp -s $^ $@ || cp $^ $@
67 -include $(dir)/.eldeps.x
68
69 # Add the one dependency make-deps.el does not have visibility to.
70 $(dir)/notmuch-lib.elc: $(dir)/notmuch-version.elc
71
72 endif
73 CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x
74
75 ifeq ($(HAVE_EMACS),1)
76 %.elc: %.el $(global_deps)
77         $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
78 endif
79
80 elpa: $(ELPA_FILE)
81
82 notmuch-emacs-%.tar: ${elpa_sources}
83         mkdir -p .elpa-build/notmuch-${ELPA_VERSION}
84         cp ${elpa_sources} .elpa-build/notmuch-${ELPA_VERSION}
85         tar -C .elpa-build -cf $@ notmuch-${ELPA_VERSION}
86         rm -r .elpa-build
87
88 ifeq ($(WITH_EMACS),1)
89 ifeq ($(HAVE_EMACS),1)
90 all: $(emacs_bytecode)
91 install-emacs: $(emacs_bytecode)
92 endif
93
94 install: install-emacs
95 endif
96
97 .PHONY: install-emacs
98 install-emacs: $(emacs_sources) $(emacs_images)
99         mkdir -p "$(DESTDIR)$(emacslispdir)"
100         install -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"
101 ifeq ($(HAVE_EMACS),1)
102         install -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"
103 endif
104         mkdir -p "$(DESTDIR)$(emacsetcdir)"
105         install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
106         mkdir -p "$(DESTDIR)$(prefix)/bin/"
107         install $(emacs_mua) "$(DESTDIR)$(prefix)/bin"
108
109 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el $(dir)/notmuch-pkg.el