build: always check the BUILD_TYPE within the entrypoint

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato 2019-07-17 15:33:36 +02:00 committed by Leo Di Donato
parent ebcb133f00
commit c61c0e7020
2 changed files with 16 additions and 11 deletions

View File

@ -18,8 +18,8 @@
language: cpp
compiler: gcc
env:
- BUILD_TYPE=Debug
- BUILD_TYPE=Release
- BUILD_TYPE=debug
- BUILD_TYPE=release
sudo: required
services:
- docker

View File

@ -7,6 +7,16 @@ BUILD_DIR=/build
CMD=${1:-usage}
shift
# Build type can be "debug" or "release", fallbacks to "release" by default
BUILD_TYPE=$(echo "$BUILD_TYPE" | tr "[:upper:]" "[:lower:]")
case "$BUILD_TYPE" in
"debug")
;;
*)
BUILD_TYPE="release"
;;
esac
case "$CMD" in
"cmake")
# Check that source directory contains Falco and Sysdig
@ -18,15 +28,6 @@ case "$CMD" in
echo "Missing falco source." >&2
exit 1
fi
# Build type can be "debug" or "release", fallbacks to "release" by default
BUILD_TYPE=$(echo "$BUILD_TYPE" | tr "[:upper:]" "[:lower:]")
case "$BUILD_TYPE" in
"debug")
;;
*)
BUILD_TYPE="release"
;;
esac
# Prepare build directory
mkdir -p "$BUILD_DIR/$BUILD_TYPE"
cd "$BUILD_DIR/$BUILD_TYPE"
@ -48,6 +49,10 @@ case "$CMD" in
exec "$CMD" "$@"
;;
*)
if [ ! -d "$BUILD_DIR/$BUILD_TYPE" ]; then
echo "Missing $BUILD_DIR/$BUILD_TYPE directory: run cmake."
exit 1
fi
cd "$BUILD_DIR/$BUILD_TYPE"
make -j"$MAKE_JOBS" "$CMD"
;;