]> git.notmuchmail.org Git - notmuch/blob - emacs/Makefile.local
emacs: Avoid rebuilding .eldeps even when there's nothing to do
[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
22 emacs_images := \
23         $(srcdir)/$(dir)/notmuch-logo.png
24
25 emacs_bytecode = $(emacs_sources:.el=.elc)
26
27 # Because of defmacro's and defsubst's, we have to account for load
28 # dependencies between Elisp files when byte compiling.  Otherwise,
29 # the byte compiler may load an old .elc file when processing a
30 # "require" or we may fail to rebuild a .elc that depended on a macro
31 # from an updated file.
32 ifeq ($(HAVE_EMACS),1)
33 $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
34         $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
35                 -f batch-make-deps $(emacs_sources) > $@.tmp && \
36                 mv $@.tmp $@
37 # We could include .eldeps directly, but that would cause a make
38 # restart whenever any .el file was modified, even if dependencies
39 # didn't change, because the mtime of .eldeps will change.  Instead,
40 # we include a second file, .eldeps.x, which we ensure always has the
41 # same content as .eldeps, but its mtime only changes when dependency
42 # information changes, in which case a make restart is necessary
43 # anyway.
44 $(dir)/.eldeps.x: $(dir)/.eldeps
45         @cmp -s $^ $@ || cp $^ $@
46 -include $(dir)/.eldeps.x
47 endif
48 CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x
49
50 ifeq ($(HAVE_EMACS),1)
51 %.elc: %.el $(global_deps)
52         $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
53 endif
54
55 ifeq ($(WITH_EMACS),1)
56 ifeq ($(HAVE_EMACS),1)
57 all: $(emacs_bytecode)
58 install-emacs: $(emacs_bytecode)
59 endif
60
61 install: install-emacs
62 endif
63
64 .PHONY: install-emacs
65 install-emacs:
66         mkdir -p "$(DESTDIR)$(emacslispdir)"
67         install -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"
68 ifeq ($(HAVE_EMACS),1)
69         install -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"
70 endif
71         mkdir -p "$(DESTDIR)$(emacsetcdir)"
72         install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
73
74 CLEAN := $(CLEAN) $(emacs_bytecode)