#!/bin/bash
# Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved
-
+#
+# Build script utilities
+# Usage:
+# 1) in your build script, define the function
+#
+# vg_command(){
+#
+# }
+#
+# it should handle $1 as the switch for different commands
+# if you want to run an existing command, use run_command <x> to do it.
+#
+#
+# 2) at the end of the build script, include:
+#
+# source vg/vg_build.sh
+#
+# this runs the triggers that are passed in from the invoker
+#
+#
+# 3) targets with standard tool support should run the command:
+#
+# vg_compile_tools
+#
+# make sure _compiler _options, and _ext are setup for that target
+# these will only invoke the tooling compilers if tools is passed to the
+# build script.
+#
# Util
# ==============================================================================
+
error(){
echo -e "\033[1;31mError:\e[0m $@"
exit 1
fi
compile_x(){
- mkdir $_folder -p
-
cmd="$compiler_cache $_compiler
$_options
$_warnings
if [ $enable_tools = true ]; then source vg/src/tools.sh; fi
}
-tools() {
- enable_tools=true
+run_command(){
+ case "$1" in
+ tools)
+ enable_tools=true
+ ;;
+ "")
+ return
+ ;;
+ *)
+ vg_command $1
+ esac
}
-$1
-$2
-$3
-$4
-$5
-$6
-$7
-$8
-$9
+run_command $1
+run_command $2
+run_command $3
+run_command $4
+run_command $5
+run_command $6
+run_command $7
+run_command $8
+run_command $9