Project

General

Profile

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

hachette / write_makefile.sh @ master

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
    echo "Record of configuration 'record.conf' does not exist." >&2
18
    exit 1
19
elif [ "$(head -n 1 record.conf | cut -c -9)x" != "srcdir = x" ]; then
20
    echo "Record of configuration 'record.conf' is invalid." >&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
(13-13/13)