diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-14 13:24:07 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-04-14 13:24:07 +0200 |
commit | 49fe0eec8f17698fc5f86d0abe01777af1fb2b23 (patch) | |
tree | 356cd3e3261934a3fb90786e1789ee4ad001cbe5 /CAN-config-generator/build.sh | |
parent | 044ef27d3667a114964549f89c63ab1ea6655877 (diff) |
Change directory architecture to use 2 separated projects.
Each projects, binder and generator, has to be compiled separatly.
CAN-binder will host high and low level binding
CAN-config-generator only the generator used for low level binding.
build.sh script just launch both build in their respective dir.
Change-Id: Ic77932660fcca507b23a631d4e4e790f608880ae
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-config-generator/build.sh')
-rwxr-xr-x | CAN-config-generator/build.sh | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/CAN-config-generator/build.sh b/CAN-config-generator/build.sh new file mode 100755 index 00000000..b6d9216a --- /dev/null +++ b/CAN-config-generator/build.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +function build { + echo "ACTION: build" + if [ ! -d "$1/$2" ]; then + echo "INFO: build dir ($1/$2) doesn't exist, created it!" + mkdir -p "$1/$2" + fi + pushd "$1/$2" + #cd "$1/$2" + cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$3 $1 + make + popd +} + +function clean { + echo "ACTION: clean" + if [ -d "$1/$2" ]; then + rm -vrf "$1/$2" + fi +} + +function rebuild { + clean $1 $2 + build $1 $2 $3 +} + +function printhelp { + echo "Usage: build.sh <action> <subdir> [config]" + echo " action: can be one of the following" + echo " build: build this project." + echo " rebuild: rebuild this project." + echo " clean: clean the previous build." + echo " install: install the build result." + echo " subdir: the subdir into which the build is done." + echo " config: can be Debug or Release. Ignored if the action is 'clean'." +} + +function checkparams { + if [ "$#" -ne "$(($1+1))" ]; then + echo "ERROR: Wrong number of parameters, expected $1 but got $(($#-1))" + printhelp + exit 1 + fi +} + +function main { + CURRENT_DIR=$( dirname "$(readlink -f "$0")" ) + echo "Current script: $CURRENT_DIR" + + if [ "$#" -lt "1" ]; then + echo "ERROR: At least <action> must be specified!" + exit 1 + fi + + case "$1" in + "build") + checkparams 3 $* + build $CURRENT_DIR $2 $3 + ;; + "rebuild") + checkparams 3 $* + rebuild $CURRENT_DIR $2 $3 + ;; + "clean") + checkparams 2 $* + clean $CURRENT_DIR $2 + ;; + "install") + checkparams 3 $* + echo "ERROR: Not implemented yet!" + ;; + *) + echo "ERROR: Unknown action '$3'!" + exit 1 + ;; + esac +} + +main $* + |