-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_lar.sh
executable file
·49 lines (38 loc) · 1.06 KB
/
run_lar.sh
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
#!/bin/bash
#
# Compiles and runs a program using the "simple" LAR representation.
#
# Reads the following environment variables:
#
# CC : the C compiler to use (default=gcc)
# GICFLAGS : flags passed on to gic
# CFLAGS2 : extra flags passed to the C compiler
#
set -e
source find-gic.sh
# USE_GMP=
USE_GMP="-DHAS_GMP -lgmp"
if [ "$CC" = "" ]; then
CC=gcc
fi
CFLAGS="-O3 -I . -ggdb3"
# CFLAGS2 are used but undefined: extra flags to be filled in from the command-line
# e.g. add -DUSE_TAGS if compiling with -tag
GC=0
if [ "$GC" = "1" ]; then
# Add -DGC to the gcc flags to use the semi-space collector.
USE_GC="-DGC"
# USE_GC="-DGC -DVERBOSE_GC"
else
USE_GC=""
fi
# if using GCC and the gold linker exists, do link-time optimization
if [ `echo "$CC" | tail -c 4 | head -c 3` = "gcc" ]; then
hash gold 2>/dev/null && { CFLAGS="${CFLAGS} -fwhole-program -fuse-ld=gold -flto"; }
fi
${GIC} -semigc $GICFLAGS $* > /dev/null
cat c/gc.c >> main.c
CMD="${CC} main.c ${CFLAGS} ${CFLAGS2} ${USE_GC} ${USE_GMP}"
# echo $CMD
$CMD
./a.out