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