-
Notifications
You must be signed in to change notification settings - Fork 19
/
build-common
89 lines (70 loc) · 2.09 KB
/
build-common
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# allow to specify target from command line
if [ "$1" == "--help" ] || [ "$1" == "/?" ] || [ "$1" == "-?" ]; then
echo "Usage: $0 [target]"
echo " default target is $TARGET"
exit 1
fi
[ $1 ] && TARGET=$1
TIMEFORMAT="Build time: %1R sec"
#?? TODO:
#?? - add function "build" with args (one of them - work dir)
#?? - check ".project is newer than makefile" here (or in makefile?)
thisfile=$BASH_SOURCE #!! check!
# get $rootdir var
dir="${thisfile%/*}"
if [ $dir == $thisfile ]; then
dir="."
fi
rootdir=$dir
tools=$rootdir/Tools #?? review: not working for SymInfoBuilder, may be should remove from all locations
# default output directory
[ "$OUT" ] || OUT="Release"
#----------------------------------------------------------
# set default platform
#----------------------------------------------------------
[ "$PLATFORM" ] || PLATFORM="vc-win32"
# force PLATFORM=linux under Linux OS
[ "$OSTYPE" == "linux-gnu" ] && PLATFORM="linux"
#----------------------------------------------------------
# configure build tools
#----------------------------------------------------------
[ "$PLATFORM" == "mingw32" ] || [ "$PLATFORM" == "cygwin" ] &&
export PATH=/bin:/usr/bin:$PATH
case "$PLATFORM" in
"vc-win32")
build="vc32tools --make"
maptype="vc"
libext="lib"
;;
"linux"|"mingw32"|"cygwin")
build="$tools/gccfilt make -f" # logging + colorizing
maptype="gcc"
libext="a"
;;
"")
echo "PLATFORM is not specified"
exit 1
;;
*)
echo "Unknown PLATFORM=\"$PLATFORM\""
exit 1
esac
#----------------------------------------------------------
# make libs
#----------------------------------------------------------
if ! [ -f "$rootdir/lib/libs-$PLATFORM.$libext" ]; then
pushd $rootdir/lib >/dev/null
$build libs-$PLATFORM
popd >/dev/null
fi
#----------------------------------------------------------
# helper functions
#----------------------------------------------------------
function BuildTarget()
{
time $build makefile-$PLATFORM $TARGET || exit 1
# generate symbols.dbg
echo "$tools/SymInfoBuilder/work.pl $OUT $maptype"
Tools/SymInfoBuilder/work.pl $OUT $maptype
}