]> git.notmuchmail.org Git - notmuch/commitdiff
Makefile: Eliminate the "make install-emacs" target.
authorCarl Worth <cworth@cworth.org>
Tue, 6 Apr 2010 17:35:20 +0000 (10:35 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 6 Apr 2010 21:36:31 +0000 (14:36 -0700)
Instead, simply byte-compile the emacs source files as part of "make"
and install them as part of "make install". The byte compilation is
made conditional on the configure script finding the emacs binary.
That way, "make; make install" will still work for someone that doesn't
have emacs installed, (which was the only reason we had made a separate
"make install-emacs" target in the first place).

Makefile.local
configure
emacs/Makefile.local

index da31982c42dc73ef0de59df4c5f5a92b737b4042..bb8ea543d01a283c08031961e72c13af86855f0f 100644 (file)
@@ -118,9 +118,6 @@ quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
 %.o: %.c $(global_deps)
        $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
 
 %.o: %.c $(global_deps)
        $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
 
-%.elc: %.el
-       $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
-
 .deps/%.d: %.c $(global_deps)
        @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
        $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
 .deps/%.d: %.c $(global_deps)
        @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
        $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
@@ -183,12 +180,17 @@ install: all notmuch.1.gz
        install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/
 ifeq ($(MAKECMDGOALS), install)
        @echo ""
        install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/
 ifeq ($(MAKECMDGOALS), install)
        @echo ""
-       @echo "Notmuch is now installed."
+       @echo "Notmuch is now installed to $(DESTDIR)$(prefix)"
+       @echo ""
+       @echo "To run notmuch from emacs, each user should add the following line to ~/.emacs:"
+       @echo ""
+       @echo " (require 'notmuch)"
+       @echo ""
+       @echo "And should then run \"M-x notmuch\" from within emacs or run \"emacs -f notmuch\""
        @echo ""
        @echo "You may now want to install additional components to support using notmuch"
        @echo "together with other software packages:"
        @echo ""
        @echo ""
        @echo "You may now want to install additional components to support using notmuch"
        @echo "together with other software packages:"
        @echo ""
-       @echo " make install-emacs"
        @echo " make install-bash"
        @echo " make install-zsh"
        @echo ""
        @echo " make install-bash"
        @echo " make install-zsh"
        @echo ""
index d56caaddd91cb2db29d92744f1977d232955feda..ba2057643edea9a37823c9c9ffe3671bd5ad9380 100755 (executable)
--- a/configure
+++ b/configure
@@ -175,6 +175,15 @@ else
     emacs_lispdir='$(prefix)/share/emacs/site-lisp'
 fi
 
     emacs_lispdir='$(prefix)/share/emacs/site-lisp'
 fi
 
+printf "Checking if emacs is available... "
+if emacs --quick --batch > /dev/null 2>&1; then
+    printf "Yes.\n"
+    have_emacs=1
+else
+    printf "No (so will not byte-compile emacs code)\n"
+    have_emacs=0
+fi
+
 if [ $errors -gt 0 ]; then
     cat <<EOF
 
 if [ $errors -gt 0 ]; then
     cat <<EOF
 
@@ -300,6 +309,9 @@ libdir = ${LIBDIR:=\$(prefix)/lib}
 # The directory to which emacs lisp files should be installed
 emacs_lispdir=${emacs_lispdir}
 
 # The directory to which emacs lisp files should be installed
 emacs_lispdir=${emacs_lispdir}
 
+# Whether there's an emacs binary available for byte-compiling
+HAVE_EMACS = ${have_emacs}
+
 # The directory to which desktop files should be installed
 desktop_dir = \$(prefix)/share/applications
 
 # The directory to which desktop files should be installed
 desktop_dir = \$(prefix)/share/applications
 
index 51d045c3e108a0478fc9ca908b9eb96633a41227..52aca4efa89ac832838d6ac125f9ca0e71c22a97 100644 (file)
@@ -9,21 +9,21 @@ emacs_sources := \
 
 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))
 
 
 emacs_bytecode := $(subst .el,.elc,$(emacs_sources))
 
-.PHONY: emacs
-emacs: $(emacs_bytecode)
+%.elc: %.el
+       $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
+
+ifeq ($(HAVE_EMACS),1)
+all: $(emacs_bytecode)
+endif
+
+install: install-emacs
 
 .PHONY: install-emacs
 
 .PHONY: install-emacs
-install-emacs: install emacs
+install-emacs:
        mkdir -p $(DESTDIR)/$(emacs_lispdir)
        mkdir -p $(DESTDIR)/$(emacs_lispdir)
-       install -m0644 $(emacs_sources) $(emacs_bytecode) $(DESTDIR)$(emacs_lispdir)
-       @echo ""
-       @echo "The notmuch emacs client is now installed."
-       @echo ""
-       @echo "To run this, each user should add the following line to the ~/.emacs file:"
-       @echo ""
-       @echo " (require 'notmuch)"
-       @echo ""
-       @echo "And should then run \"M-x notmuch\" from within emacs or run \"emacs -f notmuch\""
-       @echo ""
+       install -m0644 $(emacs_sources) $(DESTDIR)$(emacs_lispdir)
+ifeq ($(HAVE_EMACS),1)
+       install -m0644 $(emacs_bytecode) $(DESTDIR)$(emacs_lispdir)
+endif
 
 CLEAN := $(CLEAN) $(emacs_bytecode)
 
 CLEAN := $(CLEAN) $(emacs_bytecode)