build.sh 664 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. release_mode=0
  3. warnings_to_disable="-std=c11 -Wno-switch -Wno-pointer-sign -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-macro-redefined"
  4. libraries="-pthread -ldl -lm"
  5. other_args=""
  6. compiler="clang"
  7. if [ "$release_mode" -eq "0" ]; then
  8. other_args="${other_args} -g -fno-inline-functions"
  9. fi
  10. if [[ "$(uname)" == "Darwin" ]]; then
  11. # Set compiler to clang on MacOS
  12. # MacOS provides a symlink to clang called gcc, but it's nice to be explicit here.
  13. compiler="clang"
  14. other_args="${other_args} -liconv"
  15. fi
  16. ${compiler} src/main.c ${warnings_to_disable} ${libraries} ${other_args} -o odin
  17. ./odin run code/demo.odin