-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure
executable file
·63 lines (56 loc) · 1.89 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
#!/bin/sh
# https://stackoverflow.com/a/43919044
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a" && pwd)
# Absolute directories to allow use from subdirectories
coqproject="$BASEDIR/_CoqProject"
compcertdir="$BASEDIR/CompCert"
srcdir="$BASEDIR/src"
# Parse command-line arguments
while : ; do
case "$1" in
"") break;;
-compcertdir|--compcertdir)
compcertdir="$2"; shift;;
-prefix|--prefix)
prefix="-prefix $2"; shift;;
-bindir|--bindir)
bindir="-bindir $2"; shift;;
-libdir|--libdir)
libdir=-"libdir $2"; shift;;
-toolprefix|--toolprefix)
toolprefix=-"toolprefix $2"; shift;;
-no-runtime-lib)
runtime_lib="-no-runtime-lib";;
-no-standard-headers)
standard_headers="-no-standard-headers";;
-clightgen)
clightgen="-clightgen";;
*)
target="$1";;
esac
shift
done
# Configure CompCert and extract relevant values into Makefile.config
(cd "$compcertdir" &&
./configure $prefix $bindir $libdir $toolprefix $runtime_lib \
$standard_headers $clightgen $target)
if [ -f "$compcertdir"/Makefile.config ]; then
export "$(grep ARCH= < "$compcertdir"/Makefile.config)"
export "$(grep BITSIZE= < "$compcertdir"/Makefile.config)"
fi
printf "COMPCERTDIR=%s\\nARCH=%s\\n" "$compcertdir" "$ARCH" > Makefile.config
# Generate the _CoqProject file
{
printf -- "-R \"%s\" Velus\\n" "$srcdir";
while read -r subdir; do
printf -- "-R \"%s/%s\" compcert.%s\\n" "$compcertdir" "$subdir" "$subdir"
done <includes;
if [ "$ARCH" = x86 ]; then
printf -- "-R \"%s\" compcert.%s\\n" "$compcertdir/${ARCH}_${BITSIZE}"\
"${ARCH}_${BITSIZE}";
fi;
printf -- "-R \"%s\" compcert.%s\\n" "$compcertdir/$ARCH" "$ARCH";
printf -- "-R \"%s\" Flocq\\n" "$compcertdir/flocq";
printf -- "-R \"%s\" MenhirLib\\n" "$compcertdir/MenhirLib";
cat vfiles
} >"$coqproject"