Project

General

Profile

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

haketilo / write_makefile.sh @ 7965f1b4

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
set -e
17

    
18
if [ ! -e record.conf ]; then
19
    printf "Record of configuration 'record.conf' does not exist.\n" >&2
20
    exit 1
21
elif ! grep '^srcdir = ' record.conf >/dev/null 2>&1; then
22
    printf "Record of configuration 'record.conf' is invalid.\n" >&2
23
    exit 1
24
fi
25

    
26
SRCDIR="$(grep '^srcdir = ' record.conf)"
27
SRCDIR="${SRCDIR#'srcdir = '}"
28

    
29
DEFAULT_TARGET="$(grep '^default_target = ' record.conf)"
30
DEFAULT_TARGET="${DEFAULT_TARGET#'default_target = '}"
31

    
32
eval VERSION=$(cat "$SRCDIR/version")
33

    
34
sed '/^# Configuration gets included here by write_makefile\.sh$/r record.conf
35
s|<<VPATH>>|'"$SRCDIR"'|
36
s/<<VERSION>>/'"$VERSION"/ < "$SRCDIR"/Makefile.in > Makefile
(18-18/18)