forked from Jonathan2251/lbd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex-chapters-build-test.sh
48 lines (42 loc) · 1.08 KB
/
ex-chapters-build-test.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
#!/usr/bin/env bash
OS=`uname -s`
echo "OS =" ${OS}
PWD=`pwd`
TOOLDIR=~/llvm/test
if [ -e /proc/cpuinfo ]; then
procs=`cat /proc/cpuinfo | grep processor | wc -l`
else
procs=1
fi
rm -rf ${TOOLDIR}/build/* ${TOOLDIR}/llvm/lib/Target/Cpu0/*
pushd ./lbdex
bash gen-chapters.sh
popd
# Chapter 2
cp -rf lbdex/chapters/Chapter2/* ${TOOLDIR}/llvm/lib/Target/Cpu0/.
pushd ${TOOLDIR}/build
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_FLAGS=-std=c++11 -DCMAKE_BUILD_TYPE=Debug \
-DLLVM_TARGETS_TO_BUILD=Cpu0 -G "Unix Makefiles" ../llvm
result=`make -j$procs`
echo "result: ${result}"
if [ ${result} ]; then
exit 1;
fi
popd
allch="3_1 3_2 3_3 3_4 3_5 4_1 4_2 5_1 6_1 7_1 8_1 8_2 9_1 9_2 9_3 10_1 \
11_1 11_2 12_1"
# All other Chapters
for ch in $allch
do
rm -rf ${TOOLDIR}/llvm/lib/Target/Cpu0/*
cp -rf lbdex/chapters/Chapter$ch/* ${TOOLDIR}/llvm/lib/Target/Cpu0/.
echo "cp -rf lbdex/Chapter$ch/* ${TOOLDIR}/llvm/lib/Target/Cpu0/."
pushd ${TOOLDIR}/build
result=`make -j$procs`
echo "result: ${result}"
popd
if [ ${result} ]; then
exit 1;
fi
done