aboutsummaryrefslogtreecommitdiff
path: root/flatcc/scripts/build.sh
blob: 98cd41cc31e47ac1c6f043950a50320c01a26902 (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
#!/bin/sh

set -e

HERE=`dirname $0`
cd $HERE/..
ROOT=`pwd`

CFGFILE=${ROOT}/scripts/build.cfg

if [ -e $CFGFILE ]; then
    . $CFGFILE
fi

FLATCC_BUILD_CMD=${FLATCC_BUILD_CMD:-ninja}

mkdir -p ${ROOT}/bin
mkdir -p ${ROOT}/lib

rm -f ${ROOT}/bin/flatcc
rm -f ${ROOT}/bin/flatcc_d
rm -f ${ROOT}/libflatcc
rm -f ${ROOT}/libflatcc_d.a
rm -f ${ROOT}/libflatccrt.a
rm -f ${ROOT}/libflatccrt_d.a

if [ ! -d ${ROOT}/build/Debug ] || [ ! -d  ${ROOT}/build/Release ]; then
    ${ROOT}/scripts/initbuild.sh
fi

echo "building Debug" 1>&2
cd ${ROOT}/build/Debug && $FLATCC_BUILD_CMD

if [ "$1" != "--debug" ]; then
    echo "building Release" 1>&2
    cd ${ROOT}/build/Release && $FLATCC_BUILD_CMD
fi