-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·124 lines (115 loc) · 3.25 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
check_cmd() {
echo -n "$1 = "
if [ "$3" ]; then
echo "$3"
echo "$1=$3" >> build/conf.mk
else
if [ -z "`command -v $2`" ]; then
echo "\033[0;31m$2 is missing\033[0m"
rm build/conf.mk include/osver.*
exit 1
fi
echo "`command -v $2`"
echo "$1=`command -v $2`" >> build/conf.mk
fi
}
check_var() {
echo -n "$1 = "
if [ "$3" ]; then
echo "$3"
echo "$1=$3" >> build/conf.mk
else
echo "$2"
echo "$1=$2" >> build/conf.mk
fi
}
check_txt() {
echo -n "$1 = "
if [ "$3" ]; then
echo "$3"
echo "$1=$3" >> build/conf.mk
else
if [ -z "`cat $2`" ]; then
echo "\033[0;31m$2 is missing\033[0m"
rm build/conf.mk include/osver.*
exit 1
fi
echo "`cat $2`"
echo "$1=`cat $2`" >> build/conf.mk
fi
}
check_ver() {
echo -n "$1 = "
if [ "$3" ]; then
echo "$3"
echo "$1=$3" >> build/conf.mk
echo "#define $1 $3" >> include/osver.h
echo "$1 equ $3" >> include/osver.s
else
if [ -z "`cat $2`" ]; then
echo "\033[0;31m$2 is missing\033[0m"
rm build/conf.mk include/osver.*
exit 1
fi
echo "`cat $2`"
echo "$1=`cat $2`" >> build/conf.mk
echo "#define $1 `cat $2`" >> include/osver.h
echo "$1: equ `cat $2`" >> include/osver.s
fi
}
check_vch() {
echo -n "$1 = "
if [ "$3" ]; then
echo "$3"
echo "$1=$3" >> build/conf.mk
echo "#define $1 '$3'" >> include/osver.h
echo "$1 equ '$3'" >> include/osver.s
else
if [ -z "`cat $2`" ]; then
echo "\033[0;31m$2 is missing\033[0m"
rm build/conf.mk include/osver.*
exit 1
fi
echo "`cat $2`"
echo "$1=`cat $2`" >> build/conf.mk
echo "#define $1 '`cat $2`'" >> include/osver.h
echo "$1: equ '`cat $2`'" >> include/osver.s
fi
}
check_vhx() {
echo -n "$1 = "
if [ "$3" ]; then
echo "$3"
echo "$1=$3" >> build/conf.mk
echo "#define $1 0x$3" >> include/osver.h
echo "$1 equ 0x$3" >> include/osver.s
else
if [ -z "`cat $2`" ]; then
echo "\033[0;31m$2 is missing\033[0m"
rm build/conf.mk include/osver.*
exit 1
fi
echo "`cat $2`"
echo "$1=`cat $2`" >> build/conf.mk
echo "#define $1 0x`cat $2`" >> include/osver.h
echo "$1: equ 0x`cat $2`" >> include/osver.s
fi
}
mkdir -p include
mkdir -p output
echo "#Generated by configure" > build/conf.mk
echo "//Generated by configure" > include/osver.h
echo ";Generated by configure" > include/osver.s
check_var "GENFS" "python3 `pwd`/tools/brfs/genbrfs.py" "$GENFS"
check_var "ASZ80" "`pwd`/bin/gasm80" "$ASZ80"
check_cmd "CC" "cc" "$CC"
check_var "CFLAGS" "-c " "$CFLAGS"
check_var "CCFLAGS" " " "$CCFLAGS"
check_var "MAKE" "make --no-print-directory" "$MAKE"
check_ver "VERSION" "build/version" "$VERSION"
check_vch "EDITION" "build/edition" "$EDITION"
check_ver "SUB_VERSION" "build/sub_version" "$SUB_VERSION"
check_vhx "REVISION" "build/revision" "$REVISION"
echo "" >> build/conf.mk
cat build/base.mk >> build/conf.mk