From f89b3d16db90be99c3097c8dac0d95930cdd1f1d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 6 Apr 2010 10:00:30 -0700 Subject: Makefiles: Eliminate the useless quiet_* functions. With the original quiet function, there's an actual purpose (hiding excessively long compiler command lines so that warnings and errors from the compiler can be seen). But with things like quiet_symlink there's nothing quieter. In fact "SYMLINK" is longer than "ln -sf". So all this is doing is hiding the actual command from the user for no real benefit. The only actual reason we implemented the quiet_* functions was to be able to neatly right-align the command name and left-align the arguments. Let's give up on that, and just left-align everything, simplifying the Makefiles considerably. Now, the only instances of a captialized command name in the output is if there's some actually shortening of the command itself. --- Makefile.local | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'Makefile.local') diff --git a/Makefile.local b/Makefile.local index ecb9ae0..da31982 100644 --- a/Makefile.local +++ b/Makefile.local @@ -103,28 +103,20 @@ release-verify-newer: release-verify-version # user how to enable verbose compiles. ifeq ($(V),) quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n" -quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s $@\n" "$1 $2"; $($1) -quiet_args = @printf $(quiet_DOC)$(eval quiet_DOC:=)" %12s$2\n" $1; $($1) $2 +quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//')) endif # The user has explicitly enabled quiet compilation. ifeq ($(V),0) -quiet = @printf " %12s $@\n" "$1 $2"; $($1) -quiet_args = @printf " %12s$2\n" $1; $($1) $2 +quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//')) endif # Otherwise, print the full command line. -quiet ?= $($1) -quiet_args ?= $($1) $2 - -quiet_mkdir = $(call quiet_args,MKDIR,$1) -quiet_install_bin = $(call quiet_args,INSTALL-BIN,$1) -quiet_install_data = $(call quiet_args,INSTALL-DATA,$1) -quiet_symlink = $(call quiet_args,SYMLINK,$1) +quiet ?= $($(shell echo $1 | sed -e s'/ .*//')) %.o: %.cc $(global_deps) - $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@ + $(call quiet,CXX $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@ %.o: %.c $(global_deps) - $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ + $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ %.elc: %.el $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $< @@ -173,22 +165,22 @@ notmuch_client_srcs = \ notmuch_client_modules = $(notmuch_client_srcs:.c=.o) notmuch: $(notmuch_client_modules) lib/libnotmuch.a - $(call quiet,CC,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@ + $(call quiet,CC $(CFLAGS)) $^ $(FINAL_LDFLAGS) -o $@ notmuch-shared: $(notmuch_client_modules) lib/libnotmuch.so - $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(notmuch_client_modules) $(FINAL_LDFLAGS) -o $@ + $(call quiet,CC $(CFLAGS)) -Llib -lnotmuch $(notmuch_client_modules) $(FINAL_LDFLAGS) -o $@ notmuch.1.gz: notmuch.1 - $(call quiet,gzip) --stdout $^ > $@ + gzip --stdout $^ > $@ .PHONY: install install: all notmuch.1.gz - $(call quiet_mkdir, $(DESTDIR)$(prefix)/bin/) - $(call quiet_mkdir, $(DESTDIR)$(libdir)/) - $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/) - $(call quiet_mkdir, $(DESTDIR)$(prefix)/share/man/man1) - $(call quiet_install_bin, notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch) - $(call quiet_install_data, notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/) + mkdir -p $(DESTDIR)$(prefix)/bin/ + mkdir -p $(DESTDIR)$(libdir)/ + mkdir -p $(DESTDIR)$(prefix)/include/ + mkdir -p $(DESTDIR)$(prefix)/share/man/man1 + install notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch + install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ ifeq ($(MAKECMDGOALS), install) @echo "" @echo "Notmuch is now installed." @@ -204,18 +196,18 @@ endif .PHONY: install-desktop install-desktop: - $(call quiet,MKDIR) $(DESTDIR)$(desktop_dir) + mkdir -p $(DESTDIR)$(desktop_dir) desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop .PHONY: install-bash install-bash: - $(call quiet-mkdir, $(DESTDIR)$(bash_completion_dir)) - $(call quiet_install_data, contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch) + mkdir -p $(DESTDIR)$(bash_completion_dir) + install -m0644 contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch .PHONY: install-zsh install-zsh: - $(call quiet_mkdir, $(DESTDIR)$(zsh_completion_dir)) - $(call quiet_install_data, contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch) + mkdir -p $(DESTDIR)$(zsh_completion_dir) + install -m0644 contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch SRCS := $(SRCS) $(notmuch_client_srcs) CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz -- cgit v1.2.3 From a5ed8c68f6db37d3866088a9770447eba6833109 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 6 Apr 2010 10:35:20 -0700 Subject: Makefile: Eliminate the "make install-emacs" target. 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 | 12 +++++++----- configure | 12 ++++++++++++ emacs/Makefile.local | 26 +++++++++++++------------- 3 files changed, 32 insertions(+), 18 deletions(-) (limited to 'Makefile.local') diff --git a/Makefile.local b/Makefile.local index da31982..bb8ea54 100644 --- a/Makefile.local +++ b/Makefile.local @@ -118,9 +118,6 @@ quiet ?= $($(shell echo $1 | sed -e s'/ .*//')) %.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 ; \ @@ -183,12 +180,17 @@ install: all notmuch.1.gz 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 " make install-emacs" @echo " make install-bash" @echo " make install-zsh" @echo "" diff --git a/configure b/configure index d56caad..ba20576 100755 --- a/configure +++ b/configure @@ -175,6 +175,15 @@ else 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 < Date: Tue, 6 Apr 2010 10:40:45 -0700 Subject: Makefile: Eliminate the separate install-bash and install-zsh targets. Again, simplifying the interface to the Makefile. Installing these files doesn't require bash nor zsh to actually be installed, so there's little harm in just installing them unconditionally. --- Makefile.local | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'Makefile.local') diff --git a/Makefile.local b/Makefile.local index bb8ea54..5c26429 100644 --- a/Makefile.local +++ b/Makefile.local @@ -172,12 +172,14 @@ notmuch.1.gz: notmuch.1 .PHONY: install install: all notmuch.1.gz - mkdir -p $(DESTDIR)$(prefix)/bin/ - mkdir -p $(DESTDIR)$(libdir)/ - mkdir -p $(DESTDIR)$(prefix)/include/ mkdir -p $(DESTDIR)$(prefix)/share/man/man1 - install notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ + mkdir -p $(DESTDIR)$(bash_completion_dir) + install -m0644 contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch + mkdir -p $(DESTDIR)$(zsh_completion_dir) + install -m0644 contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch + mkdir -p $(DESTDIR)$(prefix)/bin/ + install notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch ifeq ($(MAKECMDGOALS), install) @echo "" @echo "Notmuch is now installed to $(DESTDIR)$(prefix)" @@ -187,13 +189,6 @@ ifeq ($(MAKECMDGOALS), install) @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 " make install-bash" - @echo " make install-zsh" - @echo "" endif .PHONY: install-desktop @@ -201,15 +196,5 @@ install-desktop: mkdir -p $(DESTDIR)$(desktop_dir) desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop -.PHONY: install-bash -install-bash: - mkdir -p $(DESTDIR)$(bash_completion_dir) - install -m0644 contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch - -.PHONY: install-zsh -install-zsh: - mkdir -p $(DESTDIR)$(zsh_completion_dir) - install -m0644 contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch - SRCS := $(SRCS) $(notmuch_client_srcs) CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules) notmuch.elc notmuch.1.gz -- cgit v1.2.3 From b5d8fe278425f7be49b6819e8187efffdffbd836 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 6 Apr 2010 11:02:09 -0700 Subject: Makefile: Move the completion-specific commands to completion/Makefile.local For much better modularity. --- Makefile | 2 +- Makefile.local | 4 ---- completion/Makefile | 7 +++++++ completion/Makefile.local | 18 ++++++++++++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 completion/Makefile create mode 100644 completion/Makefile.local (limited to 'Makefile.local') diff --git a/Makefile b/Makefile index f369786..076efc7 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ all: # List all subdirectories here. Each contains its own Makefile.local -subdirs = compat emacs lib +subdirs = compat completion emacs lib # We make all targets depend on the Makefiles themselves. global_deps = Makefile Makefile.local \ diff --git a/Makefile.local b/Makefile.local index 5c26429..16b0103 100644 --- a/Makefile.local +++ b/Makefile.local @@ -174,10 +174,6 @@ notmuch.1.gz: notmuch.1 install: all notmuch.1.gz mkdir -p $(DESTDIR)$(prefix)/share/man/man1 install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ - mkdir -p $(DESTDIR)$(bash_completion_dir) - install -m0644 contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch - mkdir -p $(DESTDIR)$(zsh_completion_dir) - install -m0644 contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch mkdir -p $(DESTDIR)$(prefix)/bin/ install notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch ifeq ($(MAKECMDGOALS), install) diff --git a/completion/Makefile b/completion/Makefile new file mode 100644 index 0000000..b6859ea --- /dev/null +++ b/completion/Makefile @@ -0,0 +1,7 @@ +# See Makfefile.local for the list of files to be compiled in this +# directory. +all: + $(MAKE) -C .. all + +.DEFAULT: + $(MAKE) -C .. $@ diff --git a/completion/Makefile.local b/completion/Makefile.local new file mode 100644 index 0000000..6a6012d --- /dev/null +++ b/completion/Makefile.local @@ -0,0 +1,18 @@ +# -*- makefile -*- + +dir := completion + +# The dir variable will be re-assigned to later, so we can't use it +# directly in any shell commands. Instead we save its value in other, +# private variables that we can use in the commands. +bash_script := $(dir)/notmuch-completion.bash +zsh_script := $(dir)/notmuch-completion.zsh + +install: install-$(dir) + +install-$(dir): + @echo $@ + mkdir -p $(DESTDIR)$(bash_completion_dir) + install -m0644 $(bash_script) $(DESTDIR)$(bash_completion_dir)/notmuch + mkdir -p $(DESTDIR)$(zsh_completion_dir) + install -m0644 $(zsh_script) $(DESTDIR)$(zsh_completion_dir)/notmuch -- cgit v1.2.3 From 1d1ad74db9b85804fdec7e3311223caa7a591c82 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 6 Apr 2010 12:47:16 -0700 Subject: configure: Add support for a --mandir option Again, nothing tricky here. --- Makefile.local | 4 ++-- configure | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'Makefile.local') diff --git a/Makefile.local b/Makefile.local index 16b0103..1c3d5f5 100644 --- a/Makefile.local +++ b/Makefile.local @@ -172,8 +172,8 @@ notmuch.1.gz: notmuch.1 .PHONY: install install: all notmuch.1.gz - mkdir -p $(DESTDIR)$(prefix)/share/man/man1 - install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ + mkdir -p $(DESTDIR)$(mandir)/man1 + install -m0644 notmuch.1.gz $(DESTDIR)$(mandir)/man1/ mkdir -p $(DESTDIR)$(prefix)/bin/ install notmuch-shared $(DESTDIR)$(prefix)/bin/notmuch ifeq ($(MAKECMDGOALS), install) diff --git a/configure b/configure index a0746df..b1e5f78 100755 --- a/configure +++ b/configure @@ -69,6 +69,7 @@ Fine tuning of some installation directories is available: --libdir=DIR Install libraries to DIR [PREFIX/lib] --includedir=DIR Install header files to DIR [PREFIX/include] + --mandir=DIR Install man pages to DIR [PREFIX/share/man] Additional options are accepted for compatibility with other configure-script calling conventions, but don't do anything yet: @@ -89,6 +90,8 @@ for option; do LIBDIR="${option#*=}" elif [ "${option%%=*}" = '--includedir' ] ; then INCLUDEDIR="${option#*=}" + elif [ "${option%%=*}" = '--mandir' ] ; then + MANDIR="${option#*=}" elif [ "${option%%=*}" = '--build' ] ; then build_option="${option#*=}" case ${build_option} in @@ -333,6 +336,9 @@ libdir = ${LIBDIR:=\$(prefix)/lib} # The directory to which header files should be installed includedir = ${INCLUDEDIR:=\$(prefix)/lib} +# The directory to which man pages should be installed +mandir = ${MANDIR:=\$(prefix)/share/man} + # The directory to which emacs lisp files should be installed emacs_lispdir=${emacs_lispdir} -- cgit v1.2.3 From 53fa1ed0a89f2965e387e41509b998dad1e7ab82 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 6 Apr 2010 14:18:05 -0700 Subject: Makefile: Add a disctclean target (simply calling clean) We currently don't distribute anything that's not already in git, so there's no difference between these two targets, (but debhelper wants to be able to call distclean). --- Makefile.local | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Makefile.local') diff --git a/Makefile.local b/Makefile.local index 1c3d5f5..bb5d676 100644 --- a/Makefile.local +++ b/Makefile.local @@ -138,6 +138,11 @@ DEPS := $(DEPS:%.cc=.deps/%.d) clean: rm -f $(CLEAN); rm -rf .deps +# We don't (yet) have any distributed files not in the upstream repository. +# So distclean is currently identical to clean. +.PHONY: distclean +distclean: clean + notmuch_client_srcs = \ $(notmuch_compat_srcs) \ debugger.c \ -- cgit v1.2.3 From ae9d67fd810e021e1d27c24c487ffd6c34b8ecdc Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 6 Apr 2010 18:20:20 -0700 Subject: Avoid needlessly linking final notmuch binary against libXapian. The libnotmuch.so library already does, so we don't need to do it again. (Thanks to a Debian debhelper warning for pointing this out.) --- Makefile.local | 7 ++++--- lib/Makefile.local | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'Makefile.local') diff --git a/Makefile.local b/Makefile.local index bb5d676..b38370c 100644 --- a/Makefile.local +++ b/Makefile.local @@ -41,7 +41,8 @@ extra_cxxflags := # Smash together user's values with our extra values FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags) FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags) -FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS) +FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch +FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS) .PHONY: all all: notmuch notmuch-shared notmuch.1.gz @@ -167,10 +168,10 @@ notmuch_client_srcs = \ notmuch_client_modules = $(notmuch_client_srcs:.c=.o) notmuch: $(notmuch_client_modules) lib/libnotmuch.a - $(call quiet,CC $(CFLAGS)) $^ $(FINAL_LDFLAGS) -o $@ + $(call quiet,CC $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@ notmuch-shared: $(notmuch_client_modules) lib/libnotmuch.so - $(call quiet,CC $(CFLAGS)) -Llib -lnotmuch $(notmuch_client_modules) $(FINAL_LDFLAGS) -o $@ + $(call quiet,CC $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@ notmuch.1.gz: notmuch.1 gzip --stdout $^ > $@ diff --git a/lib/Makefile.local b/lib/Makefile.local index ed6b25f..0e3a4d1 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -51,7 +51,7 @@ $(dir)/libnotmuch.a: $(libnotmuch_modules) $(call quiet,AR) rcs $@ $^ $(dir)/$(LIBNAME): $(libnotmuch_modules) - $(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LDFLAGS) -shared -Wl,-soname=$(SONAME) -o $@ + $(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -shared -Wl,-soname=$(SONAME) -o $@ $(dir)/$(SONAME): $(dir)/$(LIBNAME) ln -sf $(LIBNAME) $@ -- cgit v1.2.3