Streamline clean and build_db
Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
parent
83113757c7
commit
44fdd62942
@ -15,6 +15,7 @@ _error_no_option="\nYou have to indicate a valid option"
|
|||||||
_platform_linux="linux"
|
_platform_linux="linux"
|
||||||
_platform_windows="windows"
|
_platform_windows="windows"
|
||||||
_platform_android="android"
|
_platform_android="android"
|
||||||
|
_default_platform="$_platform_linux"
|
||||||
|
|
||||||
# Clean variables and exit
|
# Clean variables and exit
|
||||||
function clean_exit() {
|
function clean_exit() {
|
||||||
@ -24,6 +25,7 @@ function clean_exit() {
|
|||||||
unset 2
|
unset 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset _default_platform
|
||||||
unset _platform_android
|
unset _platform_android
|
||||||
unset _platform_windows
|
unset _platform_windows
|
||||||
unset _platform_linux
|
unset _platform_linux
|
||||||
@ -42,10 +44,15 @@ function clean_exit() {
|
|||||||
# Clean compilations
|
# Clean compilations
|
||||||
function clean() {
|
function clean() {
|
||||||
cd "$_build_folder" || clean_exit 1 "$_error_build_folder"
|
cd "$_build_folder" || clean_exit 1 "$_error_build_folder"
|
||||||
scons "platform=$_platform_linux" --clean
|
scons "platform=${1}" --clean
|
||||||
scons "platform=$_platform_windows" --clean
|
|
||||||
scons "platform=$_platform_android" --clean
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
for object in build/*."$1".*.*.*; do
|
||||||
|
rm --force "$object"
|
||||||
|
done
|
||||||
|
|
||||||
|
unset object
|
||||||
|
unset 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build by passing the platform as a variable
|
# Build by passing the platform as a variable
|
||||||
@ -66,16 +73,14 @@ function build() {
|
|||||||
|
|
||||||
# Analize build process to create compile_commands.json
|
# Analize build process to create compile_commands.json
|
||||||
function build_db() {
|
function build_db() {
|
||||||
clean
|
clean "$_default_platform"
|
||||||
cd "$_build_folder" || clean_exit 1 "$_error_build_folder"
|
cd "$_build_folder" || clean_exit 1 "$_error_build_folder"
|
||||||
bear -- scons
|
bear -- scons platform="$_default_platform"
|
||||||
|
|
||||||
if [ -f ../build/compile_commands.json ]; then
|
if [ ! -f "../{$_bin_folder}/compile_commands.json" ]; then
|
||||||
rm ../build/compile_commands.json
|
ln -s compile_commands.json "../${_bin_folder}/compile_commands.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp compile_commands.json ../build/
|
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +128,9 @@ while getopts "bdchawlA" flag; do
|
|||||||
clean_exit 0
|
clean_exit 0
|
||||||
;;
|
;;
|
||||||
c) # Clean compilations
|
c) # Clean compilations
|
||||||
clean
|
clean "$_platform_linux"
|
||||||
|
clean "$_platform_windows"
|
||||||
|
clean "$_platform_android"
|
||||||
clean_exit 0
|
clean_exit 0
|
||||||
;;
|
;;
|
||||||
h) # Invoque help
|
h) # Invoque help
|
||||||
|
Loading…
x
Reference in New Issue
Block a user