summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-11-06 14:15:08 +0100
committertv <tv@nomic.retiolum>2013-11-06 14:15:08 +0100
commit212e9dcb7b9ed3fd7f09f6b69b0b39e7aff2d84f (patch)
treee8662587219e5f83c9255f768ad6faab47e13766
parenta55f7d7593c54eb67c4e703fab42b65273cf9b3f (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-xship/build18
1 files 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