aboutsummaryrefslogtreecommitdiff
path: root/write_makefile.sh
diff options
context:
space:
mode:
Diffstat (limited to 'write_makefile.sh')
-rwxr-xr-xwrite_makefile.sh20
1 files changed, 13 insertions, 7 deletions
diff --git a/write_makefile.sh b/write_makefile.sh
index 4011fe8..c9b107b 100755
--- a/write_makefile.sh
+++ b/write_makefile.sh
@@ -13,18 +13,24 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# CC0 1.0 Universal License for more details.
+set -e
+
if [ ! -e record.conf ]; then
printf "Record of configuration 'record.conf' does not exist.\n" >&2
exit 1
-elif [ "$(head -n 1 record.conf | cut -c -9)x" != "srcdir = x" ]; then
+elif ! grep '^srcdir = ' record.conf >/dev/null 2>&1; then
printf "Record of configuration 'record.conf' is invalid.\n" >&2
- exit 2
+ exit 1
fi
-SRCDIR="$(head -n 1 record.conf | cut -c 10-)"
-. "$SRCDIR"/shell_utils.sh
-VERSION=$(get_json_key version "$(cat "$SRCDIR"/manifest.json)")
+SRCDIR="$(grep '^srcdir = ' record.conf)"
+SRCDIR="${SRCDIR#'srcdir = '}"
+
+DEFAULT_TARGET="$(grep '^default_target = ' record.conf)"
+DEFAULT_TARGET="${DEFAULT_TARGET#'default_target = '}"
+
+eval VERSION=$(cat "$SRCDIR/version")
-sed '/^# Configuration goes here$/r record.conf
+sed '/^# Configuration gets included here by write_makefile\.sh$/r record.conf
s|<<VPATH>>|'"$SRCDIR"'|
-s/<<VERSION>>/'$VERSION/ < "$SRCDIR"/Makefile.in > Makefile
+s/<<VERSION>>/'"$VERSION"/ < "$SRCDIR"/Makefile.in > Makefile