]> git.notmuchmail.org Git - notmuch/commitdiff
Makefile: Move the completion-specific commands to completion/Makefile.local
authorCarl Worth <cworth@cworth.org>
Tue, 6 Apr 2010 18:02:09 +0000 (11:02 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 6 Apr 2010 21:36:31 +0000 (14:36 -0700)
For much better modularity.

Makefile
Makefile.local
completion/Makefile [new file with mode: 0644]
completion/Makefile.local [new file with mode: 0644]

index f3697861e75d540f20954a46589284a3db10e278..076efc79b9532c3e1b80a8ef5b9687456a2fe895 100644 (file)
--- 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 \
index 5c2642981f9f3924b8a938733a17586fa1194068..16b0103b8599f7fdedd2ca8a42fdcdd60b4e0251 100644 (file)
@@ -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 (file)
index 0000000..b6859ea
--- /dev/null
@@ -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 (file)
index 0000000..6a6012d
--- /dev/null
@@ -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