Umorna -- Tiny game written to test 'chads' library, it uses assets from itch.io...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
725B

  1. #!/bin/bash
  2. set -xe
  3. CC=clang
  4. CFLAGS="-std=gnu17 -Weverything -Werror"
  5. LDLIBS="-lraylib"
  6. TARGET=umorna
  7. build_type="$1"
  8. if [ -z "$build_type" ] || \
  9. [ "$build_type" = debug ]; then
  10. CFLAGS+=" -O0 -g"
  11. elif [ "$build_type" = "release" ]; then
  12. CFLAGS+=" -O3 -flto"
  13. fi
  14. sources=(
  15. "source/engine.c"
  16. "source/render.c"
  17. "source/game.c"
  18. "source/menu.c"
  19. "source/main.c"
  20. )
  21. objects=()
  22. updated=""
  23. for source in "${sources[@]}"; do
  24. obj="${source%.*}.o"
  25. objects+=("$obj")
  26. if [ "$source" -nt "$obj" ]; then
  27. "$CC" $CFLAGS -c "$source" -o "$obj"
  28. updated="y"
  29. fi
  30. done
  31. if [ ! -f "$TARGET" ] || [ -n "$updated" ]; then
  32. "$CC" $CFLAGS $LDLIBS "${objects[@]}" -o "$TARGET"
  33. fi