summaryrefslogtreecommitdiff
path: root/tools/notsd-fixup--makefiles
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-10-27 00:07:35 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-10-27 00:07:35 -0400
commit93fd8d3a035f6acb134adff0d6b34e7fba5e72af (patch)
treec90c8871f6fcf184651c266eff8075085987977e /tools/notsd-fixup--makefiles
parent7b997776df38e196b4a779ee4e6be3acd0a363e2 (diff)
parentf0f1df7d0a18ba2db795a610f27c1922cdbf6ed6 (diff)
Merge branch 'notsystemd/postmove' into notsystemd/master
Diffstat (limited to 'tools/notsd-fixup--makefiles')
-rwxr-xr-xtools/notsd-fixup--makefiles30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/notsd-fixup--makefiles b/tools/notsd-fixup--makefiles
new file mode 100755
index 0000000000..f89e4b075b
--- /dev/null
+++ b/tools/notsd-fixup--makefiles
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+doit() {
+ local filename=$1
+ {
+ <"$filename" sed -r \
+ -e "s|(/\.\.)*/config.mk|/$(realpath -ms --relative-to="$(dirname -- "$filename")" config.mk)|" \
+ -e '/^nested\.subdirs/d' \
+ -e '/^include \$\(topsrcdir\)\/build-aux\/Makefile\.tail\.mk$/d'
+ echo
+ find "$(dirname "$filename")" -mindepth 2 -maxdepth 2 -name Makefile -print0 |
+ xargs -r0 dirname -z -- |
+ xargs -r0 basename -a -z |
+ xargs -r0 printf 'nested.subdirs += %s\n' | sort
+ echo
+ echo 'include $(topsrcdir)/build-aux/Makefile.tail.mk'
+ } | cat -s | build-aux/write-ifchanged "$filename"
+}
+
+main() {
+ set -e
+ set -o pipefail
+ local filename
+ for filename in "$@"; do
+ >&2 printf ' => %q %q\n' "$0" "$filename"
+ doit "$filename"
+ done
+}
+
+main "$@"