diff options
author | tv <tv@nomic.retiolum> | 2013-11-06 14:15:08 +0100 |
---|---|---|
committer | tv <tv@nomic.retiolum> | 2013-11-06 14:15:08 +0100 |
commit | 212e9dcb7b9ed3fd7f09f6b69b0b39e7aff2d84f (patch) | |
tree | e8662587219e5f83c9255f768ad6faab47e13766 | |
parent | a55f7d7593c54eb67c4e703fab42b65273cf9b3f (diff) |
ship build: load directives before build_deps
Because build_deps requires #@include.
This is required because build_deps requires the #@include directive.
-rwxr-xr-x | ship/build | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -5,6 +5,14 @@ set -euf # [debug=true] build compile SRCFILE DSTFILE # [debug=true] build deps SRCFILE... build() { + + # usage_pattern is used to extract build directive declarations. + usage_pattern='## usage: \(.*\) -> \([^ ]\+\) \(.*\)' + + script='s/^'"$usage_pattern"'$/\2_directive='"'"'\1'"'"'/p' \ + setf build_x_directive_loader '$(sed -n "$script" "$%s")' 0 + eval "$build_x_directive_loader" + case "$1" in compile) build_compile "$2" "$3";; deps) shift; build_deps "$@";; @@ -34,17 +42,9 @@ EOF ## usage: build_compile SRCFILE DSTFILE build_compile() { - usage_pattern='## usage: \(.*\) -> \([^ ]\+\) \(.*\)' - script='s/^'"$usage_pattern"'$/\2_directive/p' \ setf build_directives '$(sed -n "$script" "$%s")' 0 - script='s/^'"$usage_pattern"'$/\2_directive='"'"'\1'"'"'/p' \ - setf build_x_directive_loader '$(sed -n "$script" "$%s")' 0 - eval "$build_x_directive_loader" - - setf incomplete_pattern '$(make_incomplete_pattern $%s)' build_directives - script=' s/^'"$usage_pattern"'$/s:^ *\\([0-9]\\+\\) \1$:\2 \3:/p $a\ @@ -53,6 +53,8 @@ build_compile() { ' \ setf input_parser '$(sed -n "$script" "$%s")' 0 + setf incomplete_pattern '$(make_incomplete_pattern $%s)' build_directives + SRCFILE="$1" setf src '$(cat "$%s")' SRCFILE while needs_compilation "$src" "$incomplete_pattern"; do |