2
0

generate_documentation.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. # This script depends on g++, cmake, git, and make to be installed
  3. POSIXLY_CORRECT=1
  4. CHECK_API=false
  5. GEN_HTML=false
  6. GEN_PDF=false
  7. GEN_ALL=false
  8. INSTALL_DOX=false
  9. # Checking arguments and setting appropriate option variables
  10. for var in "$@"
  11. do
  12. case $var in
  13. -install)
  14. INSTALL_DOX=true
  15. ;;
  16. -html)
  17. CHECK_API=true
  18. GEN_HTML=true
  19. ;;
  20. -pdf)
  21. CHECK_API=true
  22. GEN_PDF=true
  23. ;;
  24. -all)
  25. CHECK_API=true
  26. GEN_ALL=true
  27. ;;
  28. esac
  29. done
  30. # Checking if doxygen is already installed
  31. # True - doxygen from "which doxygen" is used to generate documentation
  32. # False - clones doxygen Release_1_8_13 and ./build/bin/ added to PATH
  33. if [ $INSTALL_DOX = true ] && [ ! "$(which doxygen)" ]; then
  34. mkdir -p build
  35. cd build
  36. echo "cloning doxygen 1.8.13..."
  37. git clone --depth 1 --branch Release_1_8_13 https://github.com/doxygen/doxygen
  38. cmake -G "Unix Makefiles" doxygen/
  39. make
  40. cd ..
  41. export PATH="./build/bin/:$PATH"
  42. fi
  43. # Runs script to check that all API with documentation match wolfSSL API
  44. if [ $CHECK_API = true ]; then
  45. ./check_api.sh
  46. fi
  47. if [ $? = 1 ]; then
  48. echo "Not all API match"
  49. exit 1
  50. fi
  51. #HTML GENERATION
  52. if [ $GEN_HTML = true ] || [ $GEN_ALL = true ]; then
  53. cp -r formats/html/* ./
  54. echo "generating html..."
  55. doxygen Doxyfile
  56. cp html_changes/search/* html/search/
  57. cp html_changes/*.css html/
  58. cp html_changes/*.js html/
  59. rm footer.html header.html
  60. rm -rf html_changes
  61. rm mainpage.dox
  62. rm Doxyfile
  63. echo "finished generating html..."
  64. echo "To view the html files use a browser to open the index.html file located at doc/html/index.html"
  65. fi
  66. #PDF GENERATION
  67. if [ $GEN_PDF = true ] || [ $GEN_ALL = true ]; then
  68. cp -r formats/pdf/* ./
  69. echo "generating pdf..."
  70. doxygen Doxyfile
  71. cd latex/
  72. make
  73. mv refman.pdf ../
  74. cd ..
  75. rm -rf latex/
  76. rm Doxyfile
  77. rm header.tex
  78. echo "finished generating pdf..."
  79. fi