diff options
Diffstat (limited to 'write_makefile.sh')
-rwxr-xr-x | write_makefile.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/write_makefile.sh b/write_makefile.sh index 118635b..6aca660 100755 --- a/write_makefile.sh +++ b/write_makefile.sh @@ -14,8 +14,17 @@ # CC0 1.0 Universal License for more details. if [ ! -e record.conf ]; then - echo "Record of configuration 'record.conf' does not exist." >&2 + echo Record of configuration "'record.conf'" does not exist. >&2 exit 1 +elif [ "$(head -n 1 record.conf | cut -c -9)x" != "srcdir = x" ]; then + echo Record of configuration "'record.conf'" is invalid. >&2 + exit 2 fi -sed '/^# Configuration goes here$/r record.conf' < Makefile.in > Makefile +SRCDIR="$(head -n 1 record.conf | cut -c 10-)" +. "$SRCDIR"/shell_utils.sh +VERSION=$(get_json_key version "$(cat "$SRCDIR"/manifest.json)") + +sed '/^# Configuration goes here$/r record.conf +s|<<VPATH>>|'"$SRCDIR"'| +s/<<VERSION>>/'$VERSION/ < "$SRCDIR"/Makefile.in > Makefile |