mkconfig 646 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. TARGET_LIST=("nspire" "sfml")
  3. create_configuration() {
  4. echo "Creating $1 configuration"
  5. rm config.mk -f
  6. echo "include platform/$1/rules.mk" >> config.mk
  7. echo "include external/platform/$1/rules.mk" >> config.mk
  8. }
  9. is_valid_target() {
  10. for item in "${TARGET_LIST[@]}"; do
  11. [[ $1 == "$item" ]] && return 0
  12. done
  13. return 1
  14. }
  15. old_PS3=PS3
  16. PS3='#? '
  17. # If $1 isn't set
  18. if [[ -z ${1+z} ]]; then
  19. echo "Platform:"
  20. select TARGET in "${TARGET_LIST[@]}"; do
  21. create_configuration "$TARGET"
  22. [[ $TARGET == "" ]] || break
  23. done
  24. # else use it as a platform selection
  25. else
  26. is_valid_target "$1" && create_configuration "$1"
  27. fi
  28. PS3=old_PS3