From 212e9dcb7b9ed3fd7f09f6b69b0b39e7aff2d84f Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Nov 2013 14:15:08 +0100 Subject: ship build: load directives before build_deps Because build_deps requires #@include. This is required because build_deps requires the #@include directive. --- ship/build | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ship/build b/ship/build index a0b9220a..10fc4345 100755 --- a/ship/build +++ b/ship/build @@ -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 -- cgit v1.2.3