[PATCH 1/3] build: compute subdirectories from the presence of Makefile.local

David Bremner david at tethera.net
Wed Mar 19 17:48:02 PDT 2014


This allows the fragile sed command in configure to be replaced with a somewhat
less fragile find command.
---
 Makefile  | 3 +--
 configure | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 061c55a..74b476c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,7 @@ all:
 # List all subdirectories here. Each contains its own Makefile.local.
 # Use of '=', without '+=', seems to be required for out-of-tree
 # builds to work.
-subdirs = compat completion doc emacs lib parse-time-string	\
-	performance-test util test test/test-databases
+subdirs = $(dir $(shell find . -mindepth 2 -name Makefile.local))
 
 # We make all targets depend on the Makefiles themselves.
 global_deps = Makefile Makefile.config Makefile.local \
diff --git a/configure b/configure
index fb276f1..b3b1b44 100755
--- a/configure
+++ b/configure
@@ -23,7 +23,7 @@ srcdir=$(dirname "$0")
 # the directory structure and copy Makefiles.
 if [ "$srcdir" != "." ]; then
 
-    for dir in . $(grep "^subdirs *=" "$srcdir"/Makefile | sed -e "s/subdirs *= *//"); do
+    for dir in $(cd $srcdir && find . -name Makefile.local -exec dirname {} \;); do
 	mkdir -p "$dir"
 	cp "$srcdir"/"$dir"/Makefile.local "$dir"
 	cp "$srcdir"/"$dir"/Makefile "$dir"
-- 
1.9.0



More information about the notmuch mailing list