gendox 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #!/bin/bash
  2. #
  3. # Shell script to make doxygen documentation by specifying a target directory
  4. # on the command line
  5. #
  6. # Gef (gefdavis@dingoblue.net.au) -- August 2001
  7. # TODO:
  8. # - Dynamic ChangeLog (page gets updated with each commit)
  9. # - Have the ability to specify server dox or local dox, which will then
  10. # change the content on the main page
  11. # - Incorporate a scaled gtkradiant splash image into the pages
  12. #------------------------------------------------------------------------
  13. # Set some variables
  14. #------------------------------------------------------------------------
  15. # WORKINGDIR=`pwd`;
  16. RETVAL=0;
  17. TARGETSTRING='';
  18. EXTRAS_PATH="./Doxygen_files";
  19. CONFIG_OUTPUT="$EXTRAS_PATH/genConf";
  20. DOXYCONFIG="./DoxyConfig";
  21. DOXYFILE="$EXTRAS_PATH/Doxyfile";
  22. NEWDOXYFILE="$EXTRAS_PATH/genDoxyfile";
  23. declare -a TARGETLIST[$#];
  24. COUNTER=0;
  25. TARGETCOUNT=0;
  26. QUIETMODE=0;
  27. # added -k command line option to kill running doxygen procs
  28. KILLON=0
  29. #------------------------------------------------------------------------
  30. # load the functions
  31. #------------------------------------------------------------------------
  32. if [ -f "$EXTRAS_PATH/gendoxfunctions" ] ; then
  33. . $EXTRAS_PATH/gendoxfunctions
  34. else
  35. echo -e "Missing critical files...\n";
  36. exit 1;
  37. fi
  38. #------------------------------------------------------------------------
  39. # parse the command line options
  40. #------------------------------------------------------------------------
  41. COMLINE="$*";
  42. OPTCOUNT="$#";
  43. parse_commandline;
  44. if [ $RETVAL -gt 0 ] ; then
  45. echo -e "Exiting.";
  46. exit $RETVAL;
  47. fi
  48. if [ $KILLON -gt 0 ] ; then
  49. PIDOF_DOXYGEN=`pidof -x doxygen`
  50. MYPID=$$
  51. if [ -z "$PIDOF_DOXYGEN" ] ; then
  52. [ $QUIETMODE -gt 0 ] || echo -e " * Killing other doxygen pids";
  53. killall -q -9 doxygen
  54. else
  55. [ $QUIETMODE -gt 0 ] || echo -e " * Killing other doxygen pids";
  56. kill -9 $PIDOF_DOXYGEN &> /dev/null
  57. fi
  58. [ $QUIETMODE -gt 0 ] || echo -e " * Cleaning up gendox pids";
  59. killall -q -9 `pidof -x gendox | sed -e s/$MYPID//` &> /dev/null
  60. fi
  61. # If the output dir hasn't been set yet...
  62. #if [ -z "$OUTPUTDIR" ] ; then
  63. # OUTPUTDIR="../$(basename `pwd`)-doxygen";
  64. #fi
  65. #------------------------------------------------------------------------
  66. # execute some functions to determine stuff(c)
  67. # Get the perl path (either from the config file, or find it)
  68. #------------------------------------------------------------------------
  69. get_perlpath;
  70. if [ X"$PERLPATH" == "X" ] ; then
  71. echo -e "\nError: A working install of perl is needed to use doxygen";
  72. exit 2;
  73. fi
  74. [ $QUIETMODE -gt 0 ] || echo -e " -> Set PERL_PATH to: $PERLPATH";
  75. get_dotpath;
  76. [ $QUIETMODE -gt 0 ] || echo -e " -> Set HAVE_DOT to: $HAVEDOT";
  77. if [ X"$HAVEDOT" == "XYes" ] ; then
  78. [ $QUIETMODE -gt 0 ] || echo -e " -> Set DOT_PATH to: $DOTPATH";
  79. fi
  80. get_language;
  81. [ $QUIETMODE -gt 0 ] || echo -e " -> Set OUTPUT_LANGUAGE to: $OUPUTLANGUAGE";
  82. get_projectname;
  83. [ $QUIETMODE -gt 0 ] || echo -e " -> Set PROJECT_NAME to: $PROJECTNAME";
  84. get_version;
  85. [ $QUIETMODE -gt 0 ] || echo -e " -> Set PROJECT_NUMBER to: $VERSION";
  86. #------------------------------------------------------------------------
  87. # Got everything we need, now write the DoxyConfig file and run doxygen
  88. #------------------------------------------------------------------------
  89. # Clean up first
  90. clean_up;
  91. # Put the images & reference pages in the right place
  92. move_stuff;
  93. if [ $RETVAL -ge 666 ] ; then
  94. exit 666;
  95. fi
  96. # Generate the config file
  97. gen_doxyconfig;
  98. if [ $RETVAL -gt 0 ] ; then
  99. echo -e "Error: You are missing critical files."
  100. exit RETVAL;
  101. fi
  102. # build the reference page and the index
  103. build_extra_html;
  104. # Generate documentation
  105. RETVAL=0;
  106. run_doxygen;
  107. if [ $RETVAL -gt 0 ] ; then
  108. echo -e "Doxygen error: returned $RETVAL";
  109. echo -e " Check doxygen.log for details";
  110. elif [ $RETVAL -lt 0 ] ; then
  111. echo -e "Doxygen error: Doxygen returned $RETVAL";
  112. fi
  113. # if the log file is empty, remove it
  114. if [ ! -s ./doxygen.log ] ; then
  115. rm -f ./doxygen.log
  116. fi
  117. #------------------------------------------------------------------------
  118. # Done.
  119. #------------------------------------------------------------------------
  120. [ $QUIETMODE -gt 0 ] || echo -e "Finished...";
  121. [ $QUIETMODE -gt 0 ] || echo -e "Duration: $SECONDS seconds\n";
  122. # echo -e "** Removing output while in debug mode **";
  123. # echo -e "** Output dir: $OUTPUTDIR **\n";
  124. # rm -rf $OUTPUTDIR
  125. exit 0;