-
Notifications
You must be signed in to change notification settings - Fork 0
/
pcomp.sh
executable file
·49 lines (41 loc) · 1.22 KB
/
pcomp.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
#
# Test the separate compilation features using the simple LAR representation.
#
set -e
# Use the built-in type checker.
export TC="-gic-tc"
# Semi-space GC
GC="-semigc"
CFLAGS="-I . -I ./c"
# CFLAGS="-DGC -I . -I ./c"
source find-gic.sh
echo "Using GIC=${GIC}"
function compileLink {
for module in $1 $2
do
echo Compiling module: ${module} --
${GIC} ${TC} -cmod -debug ${GC} ${module}.hs
gcc -c ${CFLAGS} ${module}.c -o ${module}.o
done
echo Creating linker...
${GIC} ${GC} -link $1 $2
echo Adding GC...
cat c/gc.c >> main-link.c
echo Linking with gcc...
gcc ${CFLAGS} dfmod.c main-link.c $1.o $2.o -o a.out -ggdb3 -Wall
echo -n LAR\ \ result:\
./a.out
# GHCi test
echo -n GHCi result:\
echo "Main.result" | ghci -v0 $1.hs $2.hs
}
echo --- Separate compilation tests [lar, simple] ---
echo -- [Example1] --
compileLink Examples/Modules/Example1/ModuleA Examples/Modules/Example1/Main
echo -- [Example2] --
compileLink Examples/Modules/Example2/Lib Examples/Modules/Example2/Main
echo -- [Example2] --
compileLink Examples/Modules/Example3/Lib Examples/Modules/Example3/Main
echo -- [Example4] --
compileLink Examples/Modules/Example4/Lib Examples/Modules/Example4/Main