1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-13 19:40:27 +03:00
inav/cmake/docker.sh
2020-10-02 16:21:23 +02:00

29 lines
764 B
Bash
Executable file

#!/bin/bash
set -e
LAST_CMAKE_AT_REV_FILE="docker_cmake.rev"
CURR_REV="$(git rev-parse HEAD)"
initialize_cmake() {
echo -e "*** CMake was not initialized yet, doing it now.\n"
cmake ..
echo "$CURR_REV" > "$LAST_CMAKE_AT_REV_FILE"
}
# Check if CMake has never been initialized
if [ ! -f Makefile ]; then
initialize_cmake
fi
# Check if CMake was initialized for a different Git revision (new targets may have been added)
if [ -f "$LAST_CMAKE_AT_REV_FILE" ]; then
LAST_CMAKE_AT_REV="$(cat $LAST_CMAKE_AT_REV_FILE)"
if [[ "$LAST_CMAKE_AT_REV" != "SKIP" ]] && [[ "$LAST_CMAKE_AT_REV" != "$CURR_REV" ]]; then
initialize_cmake
fi
else
initialize_cmake
fi
# Let Make handle the arguments coming from the build script
make "$@"