Revision 7965f1b4
Added by koszko over 1 year ago
write_makefile.sh | ||
---|---|---|
13 | 13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
# CC0 1.0 Universal License for more details. |
15 | 15 |
|
16 |
set -e |
|
17 |
|
|
16 | 18 |
if [ ! -e record.conf ]; then |
17 | 19 |
printf "Record of configuration 'record.conf' does not exist.\n" >&2 |
18 | 20 |
exit 1 |
19 |
elif [ "$(head -n 1 record.conf | cut -c -9)x" != "srcdir = x" ]; then
|
|
21 |
elif ! grep '^srcdir = ' record.conf >/dev/null 2>&1; then
|
|
20 | 22 |
printf "Record of configuration 'record.conf' is invalid.\n" >&2 |
21 |
exit 2
|
|
23 |
exit 1
|
|
22 | 24 |
fi |
23 | 25 |
|
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)") |
|
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") |
|
27 | 33 |
|
28 |
sed '/^# Configuration goes here$/r record.conf
|
|
34 |
sed '/^# Configuration gets included here by write_makefile\.sh$/r record.conf
|
|
29 | 35 |
s|<<VPATH>>|'"$SRCDIR"'| |
30 |
s/<<VERSION>>/'$VERSION/ < "$SRCDIR"/Makefile.in > Makefile |
|
36 |
s/<<VERSION>>/'"$VERSION"/ < "$SRCDIR"/Makefile.in > Makefile |
Also available in: Unified diff
improve the build system