]> git.notmuchmail.org Git - notmuch/blob - emacs/Makefile.local
6896ff90210202a429b48311f882186f157f5eb3
[notmuch] / emacs / Makefile.local
1 # -*- makefile -*-
2
3 dir := emacs
4 emacs_sources := \
5         $(dir)/notmuch-lib.el \
6         $(dir)/notmuch-parser.el \
7         $(dir)/notmuch.el \
8         $(dir)/notmuch-query.el \
9         $(dir)/notmuch-show.el \
10         $(dir)/notmuch-tree.el \
11         $(dir)/notmuch-wash.el \
12         $(dir)/notmuch-hello.el \
13         $(dir)/notmuch-mua.el \
14         $(dir)/notmuch-address.el \
15         $(dir)/notmuch-maildir-fcc.el \
16         $(dir)/notmuch-message.el \
17         $(dir)/notmuch-crypto.el \
18         $(dir)/notmuch-tag.el \
19         $(dir)/coolj.el \
20         $(dir)/notmuch-print.el \
21         $(dir)/notmuch-version.el \
22         $(dir)/notmuch-jump.el \
23         $(dir)/notmuch-company.el \
24         $(dir)/notmuch-draft.el
25
26 $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
27 $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
28         @sed -e 's/%AG%/Generated file (from $(<F)) -- do not edit!/' \
29              -e 's/%VERSION%/"$(VERSION)"/' $< > $@
30
31
32 emacs_images := \
33         $(srcdir)/$(dir)/notmuch-logo.png
34
35 emacs_bytecode = $(emacs_sources:.el=.elc)
36
37 # Because of defmacro's and defsubst's, we have to account for load
38 # dependencies between Elisp files when byte compiling.  Otherwise,
39 # the byte compiler may load an old .elc file when processing a
40 # "require" or we may fail to rebuild a .elc that depended on a macro
41 # from an updated file.
42 ifeq ($(HAVE_EMACS),1)
43 $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
44         $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
45                 -f batch-make-deps $(emacs_sources) > $@.tmp && \
46                 mv $@.tmp $@
47 # We could include .eldeps directly, but that would cause a make
48 # restart whenever any .el file was modified, even if dependencies
49 # didn't change, because the mtime of .eldeps will change.  Instead,
50 # we include a second file, .eldeps.x, which we ensure always has the
51 # same content as .eldeps, but its mtime only changes when dependency
52 # information changes, in which case a make restart is necessary
53 # anyway.
54 $(dir)/.eldeps.x: $(dir)/.eldeps
55         @cmp -s $^ $@ || cp $^ $@
56 -include $(dir)/.eldeps.x
57
58 # Add the one dependency make-deps.el does not have visibility to.
59 $(dir)/notmuch-lib.elc: $(dir)/notmuch-version.elc
60
61 endif
62 CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x
63
64 ifeq ($(HAVE_EMACS),1)
65 %.elc: %.el $(global_deps)
66         $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
67 endif
68
69 ifeq ($(WITH_EMACS),1)
70 ifeq ($(HAVE_EMACS),1)
71 all: $(emacs_bytecode)
72 install-emacs: $(emacs_bytecode)
73 endif
74
75 install: install-emacs
76 endif
77
78 .PHONY: install-emacs
79 install-emacs: $(emacs_sources) $(emacs_images)
80         mkdir -p "$(DESTDIR)$(emacslispdir)"
81         install -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"
82 ifeq ($(HAVE_EMACS),1)
83         install -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"
84 endif
85         mkdir -p "$(DESTDIR)$(emacsetcdir)"
86         install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
87
88 CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el