fx9860g and fxcg50 2D math rendering library with support for TeX syntax.
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.

configure 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #! /bin/bash
  2. usage() {
  3. echo "usage: $0 --platform=<platform> [options...]"
  4. echo ""
  5. echo "Available platforms:"
  6. for file in config/*.cfg; do
  7. platform="${file#config/}"
  8. platform="${platform%.cfg}"
  9. printf ' %-10s' "$platform"
  10. head -1 "$file" | sed 's/^# *//'
  11. done
  12. echo ""
  13. echo "Options for fx9860g and fxcg50:"
  14. echo " --toolchain=<toolchain>"
  15. echo " Target triplet; default is 'sh3eb-elf' for fx9860g and 'sh4eb-elf'"
  16. echo " for fxcg50"
  17. echo " --prefix=<path>"
  18. echo " Library install path, guessed automatically by asking the compiler"
  19. echo " if not specified"
  20. exit ${1:-1}
  21. }
  22. platform=
  23. toolchain=
  24. # Parse command-line arguments
  25. for arg in "$@"; do case "$arg" in
  26. -h|--help|"-?")
  27. usage 0;;
  28. --platform=*)
  29. platform=${arg#*=};;
  30. --toolchain=*)
  31. toolchain=${arg#*=};;
  32. --prefix=*)
  33. prefix=${arg#*=};;
  34. *)
  35. echo "error: unrecognized option '$arg'" 2>&1
  36. error=1;;
  37. esac; done
  38. # Check validity
  39. if [ -z "$platform" ]; then
  40. echo "error: please specify a platform" 2>&1
  41. echo "Try '$0 --help' for more information."
  42. exit 1
  43. fi
  44. if [ ! -f "config/$platform.cfg" ]; then
  45. echo "error: unknown platform '$platform'" 2>&1
  46. echo "Try '$0 --help' for a list of available platforms."
  47. exit 1
  48. fi
  49. # Guess toolchains
  50. [[ $platform == fx9860g && -z $toolchain ]] && toolchain=sh3eb-elf
  51. [[ $platform == fxcg50 && -z $toolchain ]] && toolchain=sh4eb-elf
  52. # Guess compiler paths
  53. if [[ ( $platform == fx9860g || $platform == fxcg50 ) && -z $prefix ]]; then
  54. echo "No prefix specified, let's ask the compiler:"
  55. echo " $toolchain-gcc --print-search-dirs | grep install | sed 's/install: //'"
  56. inst=$($toolchain-gcc --print-search-dirs | grep install | sed 's/install: //')
  57. if [[ $? != 0 ]]; then
  58. echo "Call returned $?, giving up."
  59. fi
  60. echo "Got '$inst'".
  61. if [[ ! -d $inst ]]; then
  62. echo "Directory does not exist (or is not a directory), giving up."
  63. fi
  64. echo ""
  65. prefix=$inst
  66. fi
  67. # Output configuration
  68. output_config() {
  69. echo "PLATFORM=$platform"
  70. if [[ $platform == fx9860g || $platform == fxcg50 ]]; then
  71. echo "TOOLCHAIN=$toolchain"
  72. echo "PREFIX=$prefix"
  73. fi
  74. }
  75. output_config > Makefile.cfg
  76. echo "Makefile.cfg now links to the platform file 'config/$platform.cfg'."