configure 566 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. # Init prefix
  3. PREFIX="/usr/local"
  4. # Parse arguments with getopts
  5. while getopts hp: opt
  6. do case "$opt" in
  7. p) PREFIX=$OPTARG;;
  8. h) echo "Usage: configure [-h] [-p prefix_dir]"
  9. echo
  10. echo " -h :Print this help message."
  11. echo " -p :Pass custom install directory."
  12. echo " (defaults to /usr/local)";;
  13. [?]) echo "Usage: configure [-h] [-p prefix_dir]";;
  14. esac
  15. done
  16. # Function to generate installation files
  17. gen() {
  18. sed -e "s|@APP_DIR|$PREFIX|g" "$1.in" > "$1"
  19. chmod +x "$1"
  20. }
  21. # Generate executable and Makefile
  22. gen bin/dargite3d
  23. gen Makefile