diff options
Diffstat (limited to 'ship/build')
-rwxr-xr-x | ship/build | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -13,6 +13,7 @@ build() { } ## build directives +build_info_directive='#@info' build_include_directive='#@include \([0-9A-Za-z]\+\)' ## usage: build_compile SRCFILE DSTFILE @@ -31,7 +32,7 @@ build_compile() { ## usage: needs_compilation SRCFILE # Returns true if SRCFILE contains compilation directives. needs_compilation() { - grep -q "^$build_include_directive$" "$1" + grep -q "^\\($build_include_directive\\|$build_info_directive\\)$" "$1" } ## usage: make_sedscript_maker_shellscript SRCFILE @@ -39,18 +40,32 @@ needs_compilation() { # directives in SRCFILE. make_sedscript_maker_shellscript() { echo 'set -euf' + + echo "_build_info='$( + echo "# This file was generated by //ship/build \\" + echo "# Date: $(date -u --rfc-3339=s) \\" + echo "# Git-Commit: $(git show --pretty=oneline | awk '{print$1}')" + )'" + deps="$(build_deps "$1")" for lib in $deps; do echo "_build_include_$(basename $lib)=$lib" done + nl -b a -s ' ' "$1" | sed ' s:^ *:: + + s:^\([0-9]\+\) '"$build_info_directive"'$:\1a\\\\\ +$_build_info\ + : + s:^\([0-9]\+\) '"$build_include_directive"'$:\1a\\\\\ # BEGIN \2\ \1r\$_build_include_\2\ \1a\\\\\ # END \2: + s:^\([0-9]\+\) .*:\1p: 1s:^:echo ": |