drivers/test/build.sh

49 lines
937 B
Bash
Raw Normal View History

#!/usr/bin/bash
# This file is part of noxos and licensed under the MIT open source license
NX_DRV_NAME="test"
set -e
workspace_setup() {
echo " --> Setting up workspace"
mkdir -pv ../build
echo ""
}
check_toolchain() {
echo " --> Checking Toolchain"
hash gcc
echo " |--> found gcc"
hash ld
echo " |--> found ld"
[ ! -f "../../libraries/libnxdrv/build/libnxdrv.so" ] && echo "libnxdrv not found!" && exit 255
echo " |--> found libnxdrv"
echo " --> All checks passed"
}
driver_build() {
echo " --> Building driver: $NX_DRV_NAME"
gcc src/main.c -o ../build/$NX_DRV_NAME.nxkm -nostdlib -nolibc -I../../libraries/libnxdrv/inc -L../../libraries/libnxdrv/build -lnxdrv
echo ""
}
echo "!=====[ libnx build script ]=====!"
case $1 in
"check")
check_toolchain
;;
*)
workspace_setup
driver_build
;;
esac
echo "!=====[ Finished ]=====!"