build 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/bash
  2. check-make-ok()
  3. {
  4. if [ $? != 0 ]; then
  5. echo ""
  6. echo "Make Failed..."
  7. echo "Please check the messages and fix any problems. If you're still stuck,"
  8. echo "then please email all the output and as many details as you can to"
  9. echo " projects@drogon.net"
  10. echo ""
  11. exit 1
  12. fi
  13. }
  14. if [ x$1 = "xclean" ]; then
  15. echo Cleaning
  16. echo
  17. cd wiringPi
  18. make clean
  19. cd ../gpio
  20. make clean
  21. cd ../examples
  22. make clean
  23. exit
  24. fi
  25. if [ x$1 = "xuninstall" ]; then
  26. echo Uninstalling
  27. echo
  28. echo "WiringPi library"
  29. cd wiringPi
  30. sudo make uninstall
  31. echo
  32. echo "GPIO Utility"
  33. cd ../gpio
  34. sudo make uninstall
  35. cd ..
  36. exit
  37. fi
  38. echo "wiringPi Build script"
  39. echo "====================="
  40. echo
  41. # Check for I2C being installed...
  42. # ... and if-so, then automatically make the I2C helpers
  43. if [ -f /usr/include/linux/i2c-dev.h ]; then
  44. grep -q i2c_smbus_read_byte /usr/include/linux/i2c-dev.h
  45. if [ $? = 0 ]; then
  46. target=i2c
  47. echo "Building wiringPi with the I2C helper libraries."
  48. else
  49. target=all
  50. echo "The wiringPi I2C helper libraries will not be built."
  51. fi
  52. fi
  53. echo
  54. echo "WiringPi library"
  55. cd wiringPi
  56. sudo make uninstall
  57. make $target
  58. check-make-ok
  59. sudo make install
  60. check-make-ok
  61. echo
  62. echo "GPIO Utility"
  63. cd ../gpio
  64. make
  65. check-make-ok
  66. sudo make install
  67. check-make-ok
  68. # echo
  69. # echo "Examples"
  70. # cd ../examples
  71. # make
  72. # cd ..
  73. echo
  74. echo All Done.