Project

General

Profile

Download (1.01 KB) Statistics
| Branch: | Tag: | Revision:

haketilo / write_makefile.sh @ c39c6b9e

1
#!/bin/sh
2

    
3
# This file is part of Haketilo
4
#
5
# Copyright (C) 2021, jahoti
6
#
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the CC0 1.0 Universal License as published by
9
# the Creative Commons Corporation.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# CC0 1.0 Universal License for more details.
15

    
16
if [ ! -e record.conf ]; then
17
    printf "Record of configuration 'record.conf' does not exist.\n" >&2
18
    exit 1
19
elif [ "$(head -n 1 record.conf | cut -c -9)x" != "srcdir = x" ]; then
20
    printf "Record of configuration 'record.conf' is invalid.\n" >&2
21
    exit 2
22
fi
23

    
24
SRCDIR="$(head -n 1 record.conf | cut -c 10-)"
25
. "$SRCDIR"/shell_utils.sh
26
VERSION=$(get_json_key version "$(cat "$SRCDIR"/manifest.json)")
27

    
28
sed '/^# Configuration goes here$/r record.conf
29
s|<<VPATH>>|'"$SRCDIR"'|
30
s/<<VERSION>>/'$VERSION/ < "$SRCDIR"/Makefile.in > Makefile
(16-16/16)