diff options
author | tv <tv@nomic.retiolum> | 2013-11-06 01:03:16 +0100 |
---|---|---|
committer | tv <tv@nomic.retiolum> | 2013-11-06 01:03:16 +0100 |
commit | 7d6b65a71a3a18bb50c699e57738723d2056f436 (patch) | |
tree | 180da5c6e74e31ea956c590e0e28dab0d1d065d7 /ship | |
parent | 00c0f7dee4811a4df04a5f89e68fd7cada541765 (diff) |
ship build: recursive deps resolver
Diffstat (limited to 'ship')
-rwxr-xr-x | ship/build | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -3,11 +3,11 @@ set -euf ## SYNOPSIS # [debug=true] build compile SRCFILE DSTFILE -# [debug=true] build deps SRCFILE +# [debug=true] build deps SRCFILE... build() { case "$1" in compile) build_compile "$2" "$3";; - deps) build_deps "$2";; + deps) shift; build_deps "$@";; *) echo "build: $1: bad command" >&2; return 23;; esac } @@ -87,11 +87,22 @@ make_sedscript_maker_shellscript() { echo "$sedscript" } -## usage: build_deps SRCFILE +## usage: build_deps SRCFILE... +# Print all the dependencies of SRCFILE... (in alphabetic order) to stdout. build_deps() { - for libname in $(sed -n 's:^'"$build_include_directive"'$:\1:p' "$1"); do - build_resolve "$libname" - done + while test $# -gt 0; do + deps="$( + for f; do + for d in $(sed -n 's:^'"$build_include_directive"'$:\1:p' "$f"); do + build_resolve $d + done + done + )" + set -- $deps + if test $# -gt 0; then + echo "$deps" + fi + done | sort | uniq } ## usage: build_resolve LIBNAME |