Updated the build script.
2 files changed, 31 insertions(+), 2 deletions(-)

M src/arschipel.pas => arschipel.pas
M tool => build.sh
M src/arschipel.pas => arschipel.pas +0 -0

M tool => build.sh +31 -2
@@ 1,6 1,35 @@ 
 #!/bin/sh
 set -eu
 
-mkdir -p build
+TARGS="arschipel"
+
+clean() {
+  rm -f -- *.o "$TARGS"
+}
+
+build() {
+  for x in $TARGS.pas; do
+    fpc -v0sw -O2 -Xs -Mfpc "$x"
+  done
+}
 
-fpc -v0sw -obuild/arschipel src/arschipel.pas
+debug() {
+  for x in $TARGS.pas; do
+    fpc -vs -gl -Crtoi -Mfpc "$x"
+  done
+}
+
+shift $((OPTIND - 1))
+
+while getopts :cd opts; do
+  case "${opts}" in
+  c) clean ;;
+  d) debug ;;
+  \?) exit 1 ;;
+  esac
+done
+
+if [ -z "${1:-}" ]; then
+  build
+fi
+