summaryrefslogtreecommitdiffstats
path: root/ship
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-11-05 20:16:04 +0100
committertv <tv@nomic.retiolum>2013-11-05 20:16:04 +0100
commit01ddf924ae017b71470d1e83124f69a53566e62c (patch)
tree134b8446f6c7483c290f787edf3ef8b998397939 /ship
parent840bc4e535371865173dd31bc509314899b4b33f (diff)
ship build: add #@info directive
Diffstat (limited to 'ship')
-rwxr-xr-xship/bin/punani1
-rwxr-xr-xship/build17
2 files changed, 17 insertions, 1 deletions
diff --git a/ship/bin/punani b/ship/bin/punani
index 99a5a813..28bf7d1a 100755
--- a/ship/bin/punani
+++ b/ship/bin/punani
@@ -1,3 +1,4 @@
#!/bin/sh
+#@info
#@include punani
punani "$@"
diff --git a/ship/build b/ship/build
index 6c26e6f3..cb4c20af 100755
--- a/ship/build
+++ b/ship/build
@@ -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 ":