Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

156 rindas
3.7 KiB

  1. #!/bin/env bash
  2. # build
  3. # Simple wiringPi build and install script
  4. #
  5. # Copyright (c) 2012-2015 Gordon Henderson
  6. ###############################################################################
  7. # This file is part of wiringPi:
  8. # A "wiring" library for the Raspberry Pi
  9. #
  10. # wiringPi is free software: you can redistribute it and/or modify
  11. # it under the terms of the GNU Lesser General Public License as published by
  12. # the Free Software Foundation, either version 3 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # wiringPi is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU Lesser General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU Lesser General Public License
  21. # along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
  22. ###############################################################################
  23. #
  24. # wiringPi is designed to run on a Raspberry Pi only.
  25. # However if you're clever enough to actually look at this script to
  26. # see why it's not building for you, then good luck.
  27. #
  28. # To everyone else: Stop using cheap alternatives. Support the
  29. # Raspberry Pi Foundation as they're the only ones putting money
  30. # back into education!
  31. ###############################################################################
  32. function check_make_ok() {
  33. if [[ $? -ne 0 ]]; then
  34. echo
  35. echo "Make Failed..."
  36. echo "Please check the messages and fix any problems."
  37. echo
  38. exit 1
  39. fi
  40. }
  41. function doClean() {
  42. echo
  43. echo "Cleaning"
  44. echo
  45. cd wiringPi
  46. echo -n "wiringPi: " ; make clean
  47. cd ../devLib
  48. echo -n "DevLib: " ; make clean
  49. cd ../gpio
  50. echo -n "gpio: " ; make clean
  51. cd ../examples
  52. echo -n "Examples: " ; make clean
  53. cd Gertboard
  54. #echo -n "Gertboard: " ; make clean
  55. cd ../PiFace
  56. #echo -n "PiFace: " ; make clean
  57. cd ../PiGlow
  58. #echo -n "PiGlow: " ; make clean
  59. cd ../q2w
  60. #echo -n "Quick2Wire: " ; make clean
  61. cd ../scrollPhat
  62. #echo -n "scrollPhat: " ; make clean
  63. cd ../..
  64. echo
  65. }
  66. function doUninstall() {
  67. echo
  68. echo "Uninstalling"
  69. echo
  70. echo "WiringPi library"
  71. cd wiringPi
  72. echo -n "wiringPi: " ; sudo make uninstall
  73. cd ../devLib
  74. echo -n "DevLib: " ; sudo make uninstall
  75. cd ../gpio
  76. echo -n "gpio: " ; sudo make uninstall
  77. }
  78. ###############################################################################
  79. # Main build script
  80. echo "WiringPi Build script"
  81. echo "========================================"
  82. nargs=$#
  83. while [[ $# -gt 0 ]]; do
  84. if [[ "$1" == "clean" ]]; then
  85. doClean
  86. fi
  87. if [[ "$1" == "uninstall" ]]; then
  88. doUninstall
  89. fi
  90. shift # next arg!
  91. done
  92. # Targets specified on the command line were processed => Done.
  93. if [[ nargs -ne 0 ]]; then exit; fi
  94. # Default if nothing specified on command line:
  95. echo
  96. echo "WiringPi Library"
  97. cd wiringPi
  98. sudo make uninstall
  99. make -j5
  100. check_make_ok
  101. sudo make install
  102. check_make_ok
  103. echo
  104. echo "WiringPi Devices Library"
  105. cd ../devLib
  106. sudo make uninstall
  107. make -j5
  108. check_make_ok
  109. sudo make install
  110. check_make_ok
  111. echo
  112. echo "GPIO Utility"
  113. cd ../gpio
  114. make -j5
  115. check_make_ok
  116. sudo make install
  117. check_make_ok
  118. # echo
  119. # echo "wiringPi Daemon"
  120. # cd ../wiringPiD
  121. # make -j5
  122. # check_make_ok
  123. # sudo make install
  124. # check_make_ok
  125. # echo
  126. # echo "Examples"
  127. # cd ../examples
  128. # make
  129. # cd ..
  130. echo
  131. echo All Done.
  132. echo ""
  133. echo "NOTE: To compile programs with wiringPi, you need to add:"
  134. echo " -lwiringPi"
  135. echo " to your compile line(s) To use the Gertboard, MaxDetect, etc."
  136. echo " code (the devLib), you need to also add:"
  137. echo " -lwiringPiDev"
  138. echo " to your compile line(s)."
  139. echo ""