Xmd/scripts/buildapp.sh
2023-11-03 21:43:16 -04:00

38 lines
423 B
Bash
Executable File

#!/bin/sh
. `dirname $0`/flags.sh
function build() {
if
mkdir -p bin && \
cc $CFLAGS -c -o "bin/$1.o" src/*.c && \
cc -o "bin/$1" "bin/$1.o" $APP_LIBS
then
echo ".// ok"
return 0
else
echo "XXX FAIL!"
return 1
fi
}
function clean() {
rm -f bin/*
}
case "$2" in
install)
clean; build "$1"
cp "bin/$1" "$PREFIX/bin"
clean
;;
run)
build "$1" && "./bin/$1"
;;
clean)
clean
;;
*)
build "$1"
esac