blob: e81c6b6888906d752778e52bdeb8dcb4538cf368 (
plain)
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
|
#!/bin/sh
echorun()
{
echo $1
$1
}
compile()
{
echorun "$cc $cflags $include $lflags -o $1.o $1.c $libs"
}
check_commands()
{
for cmd in $@ ; do
if [ ! `which $cmd` ] ; then
echo "command $cmd didn't exist"
exit
fi
done
}
cc='gcc'
os=`uname`
if [ "$os" = "FreeBSD" ] ; then
cc="clang"
fi
check_commands pwd realpath dirname $cc
start=`pwd`
dir=`realpath $0`
dir=`dirname $dir`
echorun "cd $dir"
if [ "$1" = 'clean' ] ; then
echorun "rm -f *.o libprb.a"
echorun "cd $start"
exit
fi
debug='-g'
release='-O2'
cflags="-c"
if [ "`echo \"$*\" | grep debug -`" ] ; then
cflags="$debug $cflags"
else
cflags="$release $cflags"
fi
srcs='
prbm
arena
prbs
linux
'
for src in $srcs ; do
compile $src
done
echorun "ar rcs libprb.a \
prbm \
arena \
prbs \
linux"
echorun "cd $start"
|