Shared admin folder
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

doxygen.sh 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  1. #! /bin/sh
  2. #
  3. # doxygen.sh Copyright (C) 2005 by Adriaan de Groot
  4. # Based on some code from Doxyfile.am, among other things.
  5. # License: GPL version 2.
  6. # See file COPYING in tdelibs for details.
  7. echo "*** doxygen.sh"
  8. # Recurse handling is a little complicated, since normally
  9. # subdir (given on the command-line) processing doesn't recurse
  10. # but you can force it to do so.
  11. recurse=1
  12. recurse_given=NO
  13. use_modulename=1
  14. cleanup=YES
  15. while test -n "$1" ; do
  16. case "x$1" in
  17. "x--no-cleanup" )
  18. cleanup=NO
  19. ;;
  20. "x--no-recurse" )
  21. recurse=0
  22. recurse_given=YES
  23. ;;
  24. "x--recurse" )
  25. recurse=1
  26. recurse_given=YES
  27. ;;
  28. "x--no-modulename" )
  29. use_modulename=0
  30. ;;
  31. "x--modulename" )
  32. use_modulename=1
  33. ;;
  34. "x--help" )
  35. echo "doxygen.sh usage:"
  36. echo "doxygen.sh [--no-recurse] [--no-modulename] <srcdir> [<subdir>]"
  37. exit 2
  38. ;;
  39. x--doxdatadir=* )
  40. DOXDATA=`echo $1 | sed -e 's+--doxdatadir=++'`
  41. ;;
  42. x--installdir=*)
  43. PREFIX=`echo $1 | sed -e 's+--installdir=++'`
  44. ;;
  45. x--* )
  46. echo "Unknown option: $1"
  47. exit 1
  48. ;;
  49. * )
  50. top_srcdir="$1"
  51. break
  52. ;;
  53. esac
  54. shift
  55. done
  56. ### Sanity check the mandatory "top srcdir" argument.
  57. if test -z "$top_srcdir" ; then
  58. echo "Usage: doxygen.sh <top_srcdir>"
  59. exit 1
  60. fi
  61. if test ! -d "$top_srcdir" ; then
  62. echo "top_srcdir ($top_srcdir) is not a directory."
  63. exit 1
  64. fi
  65. ### Normalize top_srcdir so it is an absolute path.
  66. if expr "x$top_srcdir" : "x/" > /dev/null ; then
  67. # top_srcdir is absolute already
  68. :
  69. else
  70. top_srcdir=`cd "$top_srcdir" 2> /dev/null && pwd`
  71. if test ! -d "$top_srcdir" ; then
  72. echo "top_srcdir ($top_srcdir) is not a directory."
  73. exit 1
  74. fi
  75. fi
  76. ### Sanity check and guess TQTDOCDIR.
  77. if test -z "$TQTDOCDIR" ; then
  78. if test -z "$TQTDIR" ; then
  79. for i in /usr/X11R6/share/doc/tqt/html
  80. do
  81. TQTDOCDIR="$i"
  82. test -d "$TQTDOCDIR" && break
  83. done
  84. else
  85. for i in share/doc/tqt/html doc/html
  86. do
  87. TQTDOCDIR="$TQTDIR/$i"
  88. test -d "$TQTDOCDIR" && break
  89. done
  90. fi
  91. fi
  92. if test -z "$TQTDOCDIR" || test ! -d "$TQTDOCDIR" ; then
  93. if test -z "$TQTDOCDIR" ; then
  94. echo "* TQTDOCDIR could not be guessed."
  95. else
  96. echo "* TQTDOCDIR does not name a directory."
  97. fi
  98. if test -z "$TQTDOCTAG" ; then
  99. echo "* TQTDOCDIR set to \"\""
  100. TQTDOCDIR=""
  101. else
  102. echo "* But I'll use $TQTDOCDIR anyway because of TQTDOCTAG."
  103. fi
  104. fi
  105. ### Get the "top srcdir", also its name, and handle the case that subdir "."
  106. ### is given (which would be top_srcdir then, so it's equal to none-given
  107. ### but no recursion either).
  108. ###
  109. # top_srcdir="$1" # Already set by options processing
  110. module_name=`basename "$top_srcdir"`
  111. module_name=`echo "$module_name" | awk -F '-' '{print $1}'`
  112. subdir="$2"
  113. if test "x." = "x$subdir" ; then
  114. subdir=""
  115. if test "x$recurse_given" = "xNO" ; then
  116. recurse=0
  117. fi
  118. fi
  119. if test "x" != "x$subdir" ; then
  120. # If no recurse option given explicitly, default to
  121. # no recurse when processing subdirs given on the command-line.
  122. if test "x$recurse_given" = "xNO" ; then
  123. recurse=0
  124. fi
  125. fi
  126. if test -z "$DOXDATA" || test ! -d "$DOXDATA" ; then
  127. if test -n "$DOXDATA" ; then
  128. echo "* \$DOXDATA is '$DOXDATA' which does not name a directory"
  129. fi
  130. DOXDATA="$top_srcdir/doc/common"
  131. fi
  132. if test ! -d "$DOXDATA" ; then
  133. echo "* \$DOXDATA does not name a directory ( or is unset ), tried \"$DOXDATA\""
  134. exit 1
  135. fi
  136. if test -n "$PREFIX" && test ! -d "$PREFIX" ; then
  137. echo "* \$PREFIX does not name a directory, tried \"$PREFIX\""
  138. echo "* \$PREFIX is disabled."
  139. PREFIX=""
  140. fi
  141. ### We need some values from top-level files, which
  142. ### are not preserved between invocations of this
  143. ### script, so factor it out for easy use.
  144. create_doxyfile_in()
  145. {
  146. eval `grep 'VERSION="' "$top_srcdir/admin/cvs.sh"`
  147. echo "PROJECT_NUMBER = $VERSION" > Doxyfile.in
  148. grep '^KDE_INIT_DOXYGEN' "$top_srcdir/configure.in.in" | \
  149. sed -e 's+[^[]*\[\([^]]*\)+PROJECT_NAME = "\1"+' \
  150. -e 's+].*++' >> Doxyfile.in
  151. }
  152. apidoxdir="$module_name"-apidocs
  153. test "x$use_modulename" = "x0" && apidoxdir="apidocs"
  154. ### If we're making the top subdir, create the structure
  155. ### for the apidox and initialize it. Otherwise, just use the
  156. ### structure assumed to be there.
  157. if test -z "$subdir" ; then
  158. if test ! -d "$apidoxdir" ; then
  159. mkdir "$apidoxdir" > /dev/null 2>&1
  160. fi
  161. cd "$apidoxdir" > /dev/null 2>&1 || {
  162. echo "Cannot create and cd into $apidoxdir"
  163. exit 1
  164. }
  165. test -f "Doxyfile.in" || create_doxyfile_in
  166. # Copy in logos and the like
  167. for i in "favicon.ico" "kde_gear_64.png"
  168. do
  169. cp "$DOXDATA/$i" . > /dev/null 2> /dev/null
  170. done
  171. for i in "$top_srcdir/doc/api/Dox-"*.png
  172. do
  173. T=`basename "$i" | sed -e 's+Dox-++'`
  174. test -f "$i" && cp "$i" "./$T" > /dev/null 2> /dev/null
  175. done
  176. top_builddir="."
  177. srcdir="$1"
  178. subdir="."
  179. else
  180. cd "$apidoxdir" > /dev/null 2>&1 || {
  181. echo "Cannot cd into $apidoxdir -- maybe you need to"
  182. echo "build the top-level dox first."
  183. exit 1
  184. }
  185. if test "x1" = "x$recurse" ; then
  186. # OK, so --recurse was requested
  187. if test ! -f "subdirs.top" ; then
  188. echo "* No subdirs.top available in the $apidoxdir."
  189. echo "* The --recurse option will be ignored."
  190. recurse=0
  191. fi
  192. fi
  193. fi
  194. ### Read a single line (TODO: support \ continuations) from the Makefile.am.
  195. ### Used to extract variable assignments from it.
  196. extract_line()
  197. {
  198. file="$2" ; test -z "$file" && file="$srcdir/Makefile.am"
  199. pattern=`echo "$1" | tr + .`
  200. grep "^$1" "$file" | \
  201. sed -e "s+$pattern.*=\s*++"
  202. }
  203. ### Handle the COMPILE_{FIRST,LAST,BEFORE,AFTER} part of Makefile.am
  204. ### in the toplevel. Copied from admin/cvs.sh. Licence presumed LGPL).
  205. create_subdirs()
  206. {
  207. echo "* Sorting top-level subdirs"
  208. dirs=
  209. idirs=
  210. if test -f "$top_srcdir/inst-apps"; then
  211. idirs=`cat "$top_srcdir/"inst-apps`
  212. else
  213. idirs=`cd "$top_srcdir" && ls -1 | sort`
  214. fi
  215. compilefirst=""
  216. compilelast=""
  217. if test -f "$top_srcdir/"Makefile.am.in ; then
  218. compilefirst=`sed -ne 's#^COMPILE_FIRST[ ]*=[ ]*##p' "$top_srcdir/"Makefile.am.in | head -n 1`
  219. compilelast=`sed -ne 's#^COMPILE_LAST[ ]*=[ ]*##p' "$top_srcdir/"Makefile.am.in | head -n 1`
  220. fi
  221. for i in $idirs; do
  222. if test -f "$top_srcdir/$i"/Makefile.am; then
  223. case " $compilefirst $compilelast " in
  224. *" $i "*) ;;
  225. *) dirs="$dirs $i"
  226. esac
  227. fi
  228. done
  229. : > ./_SUBDIRS
  230. for d in $compilefirst; do
  231. echo $d >> ./_SUBDIRS
  232. done
  233. (for d in $dirs; do
  234. list=""
  235. if test -f "$top_srcdir/"Makefile.am.in ; then
  236. list=`sed -ne "s#^COMPILE_BEFORE_$d""[ ]*=[ ]*##p" "$top_srcdir/"Makefile.am.in | head -n 1`
  237. fi
  238. for s in $list; do
  239. echo $s $d
  240. done
  241. list=""
  242. if test -f "$top_srcdir/"Makefile.am.in ; then
  243. list=`sed -ne "s#^COMPILE_AFTER_$d""[ ]*=[ ]*##p" "$top_srcdir/"Makefile.am.in | head -n 1`
  244. fi
  245. for s in $list; do
  246. echo $d $s
  247. done
  248. echo $d $d
  249. done ) | tsort >> ./_SUBDIRS
  250. for d in $compilelast; do
  251. echo $d >> ./_SUBDIRS
  252. done
  253. test -r _SUBDIRS && mv _SUBDIRS subdirs.top || true
  254. }
  255. ### Add HTML header, footer, CSS tags to Doxyfile.
  256. ### Assumes $subdir is set. Argument is a string
  257. ### to stick in front of the file if needed.
  258. apidox_htmlfiles()
  259. {
  260. dox_header="$top_srcdir/doc/api/$1header.html"
  261. dox_footer="$top_srcdir/doc/api/$1footer.html"
  262. dox_css="$top_srcdir/doc/api/doxygen.css"
  263. test -f "$dox_header" || dox_header="$DOXDATA/$1header.html"
  264. test -f "$dox_footer" || dox_footer="$DOXDATA/$1footer.html"
  265. test -f "$dox_css" || dox_css="$DOXDATA/doxygen.css"
  266. echo "HTML_HEADER = $dox_header" >> "$subdir/Doxyfile" ; \
  267. echo "HTML_FOOTER = $dox_footer" >> "$subdir/Doxyfile" ; \
  268. echo "HTML_STYLESHEET = $dox_css" >> "$subdir/Doxyfile"
  269. }
  270. apidox_specials()
  271. {
  272. line=`extract_line DOXYGEN_PROJECTNAME "$1"`
  273. test -n "$line" && echo "PROJECT_NAME = \"$line\"" >> "$2"
  274. }
  275. apidox_local()
  276. {
  277. for i in "$top_srcdir/doc/api/Doxyfile.local"
  278. do
  279. if test -f "$i" ; then
  280. cat "$i" >> "$subdir/Doxyfile"
  281. break
  282. fi
  283. done
  284. }
  285. ### Post-process HTML files by substituting in the menu files
  286. #
  287. # In non-top directories, both <!-- menu --> and <!-- gmenu -->
  288. # are calculated and replaced. Top directories get an empty <!-- menu -->
  289. # if any.
  290. doxyndex()
  291. {
  292. # Special case top-level to have an empty MENU.
  293. if test "x$subdir" = "x." ; then
  294. MENU=""
  295. htmldir="."
  296. htmltop="$top_builddir" # Just ., presumably
  297. echo "* Post-processing top-level files"
  298. else
  299. MENU="<ul>"
  300. htmldir="$subdir/html"
  301. htmltop="$top_builddir.." # top_builddir ends with /
  302. echo "* Post-processing files in $htmldir"
  303. # Build a little PHP file that maps class names to file
  304. # names, for the quick-class-picker functionality.
  305. # (The quick-class-picker is disabled due to styling
  306. # problems in IE & FF).
  307. (
  308. echo "<?php \$map = array("; \
  309. for htmlfile in `find $htmldir/ -type f -name "class[A-Z]*.html" | grep -v "\-members.html$"`; do
  310. classname=`echo $htmlfile | sed -e "s,.*/class\\(.*\\).html,\1," -e "s,_1_1,::,g" -e "s,_01, ,g" -e "s,_4,>,g" -e "s+_00+,+g" -e "s+_3+<+g" | tr "[A-Z]" "[a-z]"`
  311. echo " \"$classname\" => \"$htmlfile\","
  312. done | sort ; \
  313. echo ") ?>"
  314. ) > "$subdir/classmap.inc"
  315. # This is a list of pairs, with / separators so we can use
  316. # basename and dirname (a crude shell hack) to split them
  317. # into parts. For each, if the file part exists (as a html
  318. # file) tack it onto the MENU variable as a <li> with link.
  319. for i in "Main Page/index" \
  320. "Modules/modules" \
  321. "Namespace List/namespaces" \
  322. "Class Hierarchy/hierarchy" \
  323. "Alphabetical List/classes" \
  324. "Class List/annotated" \
  325. "File List/files" \
  326. "Directories/dirs" \
  327. "Namespace Members/namespacemembers" \
  328. "Class Members/functions" \
  329. "Related Pages/pages"
  330. do
  331. NAME=`dirname "$i"`
  332. FILE=`basename "$i"`
  333. test -f "$htmldir/$FILE.html" && MENU="$MENU<li><a href=\"$FILE.html\">$NAME</a></li>"
  334. done
  335. MENU="$MENU</ul>"
  336. fi
  337. # Get the list of global Menu entries.
  338. GMENU=`cat subdirs | tr -d '\n'`
  339. PMENU=`grep '<!-- pmenu' "$htmldir/index.html" | sed -e 's+.*pmenu *++' -e 's+ *-->++' | awk '{ c=split($0,a,"/"); for (j=1; j<=c; j++) { printf " / <a href=\""; if (j==c) { printf("."); } for (k=j; k<c; k++) { printf "../"; } if (j<c) { printf("../html/index.html"); } printf "\">%s</a>\n" , a[j]; } }' | tr -d '\n'`
  340. # Map the PHP file into HTML options so that
  341. # it can be substituted in for the quick-class-picker.
  342. CMENU=""
  343. # For now, leave the CMENU disabled
  344. CMENUBEGIN="<!--"
  345. CMENUEND="-->"
  346. if test "x$subdir" = "x." ; then
  347. # Disable CMENU on toplevel anyway
  348. CMENUBEGIN="<!--"
  349. CMENUEND="-->"
  350. else
  351. test -f "$subdir/classmap.inc" && \
  352. CMENU=`grep '=>' "$subdir/classmap.inc" | sed -e 's+"\([^"]*\)" => "'"$subdir/html/"'\([^"]*\)"+<option value="\2">\1<\/option>+' | tr -d '\n'`
  353. if test -f "$subdir/classmap.inc" && grep "=>" "$subdir/classmap.inc" > /dev/null 2>&1 ; then
  354. # Keep the menu, it's useful
  355. :
  356. else
  357. CMENUBEGIN="<!--"
  358. CMENUEND="-->"
  359. fi
  360. fi
  361. # Now substitute in the MENU in every file. This depends
  362. # on HTML_HEADER (ie. header.html) containing the
  363. # <!-- menu --> comment.
  364. for i in "$htmldir"/*.html
  365. do
  366. if test -f "$i" ; then
  367. sed -e "s+<!-- menu -->+$MENU+" \
  368. -e "s+<!-- gmenu -->+$GMENU+" \
  369. -e "s+<!-- pmenu.*-->+$PMENU+" \
  370. -e "s+<!-- cmenu.begin -->+$CMENUBEGIN+" \
  371. -e "s+<!-- cmenu.end -->+$CMENUEND+" \
  372. < "$i" | sed -e "s+@topdir@+$htmltop+g" > "$i.new" && mv "$i.new" "$i"
  373. sed -e "s+<!-- cmenu -->+$CMENU+" < "$i" > "$i.new"
  374. test -s "$i.new" && mv "$i.new" "$i"
  375. fi
  376. done
  377. }
  378. ### Handle the Doxygen processing of a toplevel directory.
  379. apidox_toplevel()
  380. {
  381. echo ""
  382. echo "*** Creating API documentation main page for $module_name"
  383. echo "*"
  384. rm -f "Doxyfile"
  385. for i in "$top_srcdir/doc/api/Doxyfile.global" \
  386. "$top_srcdir/admin/Doxyfile.global" \
  387. "$DOXDATA/Doxyfile.global"
  388. do
  389. if test -f "$i" ; then
  390. cp "$i" Doxyfile
  391. break
  392. fi
  393. done
  394. if test ! -f "Doxyfile" ; then
  395. echo "* Cannot create Doxyfile."
  396. exit 1
  397. fi
  398. cat "$top_builddir/Doxyfile.in" >> Doxyfile
  399. echo "INPUT = $top_srcdir" >> Doxyfile
  400. echo "OUTPUT_DIRECTORY = $top_builddir" >> Doxyfile ; \
  401. echo "FILE_PATTERNS = *.dox" >> Doxyfile ; \
  402. echo "RECURSIVE = NO" >> Doxyfile ; \
  403. echo "ALPHABETICAL_INDEX = NO" >> Doxyfile ; \
  404. echo "HTML_OUTPUT = ." >> Doxyfile ; \
  405. apidox_htmlfiles "main"
  406. # KDevelop has a top-level Makefile.am with settings.
  407. for i in "$top_srcdir/Makefile.am.in" "$top_srcdir/Makefile.am"
  408. do
  409. if test -f "$i" ; then
  410. grep '^DOXYGEN_SET_' "$i" | \
  411. sed -e 's+DOXYGEN_SET_++' -e "s+@topdir@+$top_srcdir+" >> Doxyfile
  412. apidox_specials "$srcdir/Makefile.am" "$subdir/Doxyfile"
  413. break
  414. fi
  415. done
  416. apidox_local
  417. doxygen Doxyfile
  418. ( cd "$top_srcdir" && grep -l '^include.*Doxyfile.am' `find . -name Makefile.am` ) | sed -e 's+/Makefile.am$++' -e 's+^\./++' | sort > subdirs.in
  419. for i in `cat subdirs.in`
  420. do
  421. test "x." = "x$i" && continue;
  422. dir=`dirname "$i"`
  423. file=`basename "$i"`
  424. if test "x." = "x$dir" ; then
  425. dir=""
  426. else
  427. dir="$dir/"
  428. fi
  429. indent=`echo "$dir" | sed -e 's+[^/]*/+\&nbsp;\&nbsp;+g' | sed -e 's+&+\\\&+g'`
  430. entryname=`extract_line DOXYGEN_SET_PROJECT_NAME "$top_srcdir/$dir/$file/Makefile.am"`
  431. test -z "$entryname" && entryname="$file"
  432. if grep DOXYGEN_EMPTY "$top_srcdir/$dir/$file/Makefile.am" > /dev/null 2>&1 ; then
  433. echo "<li>$indent$file</li>"
  434. else
  435. echo "<li>$indent<a href=\"@topdir@/$dir$file/html/index.html\">$entryname</a></li>"
  436. fi
  437. done > subdirs
  438. doxyndex
  439. }
  440. ### Handle the Doxygen processing of a non-toplevel directory.
  441. apidox_subdir()
  442. {
  443. echo ""
  444. echo "*** Creating apidox in $subdir"
  445. echo "*"
  446. rm -f "$subdir/Doxyfile"
  447. if test ! -d "$top_srcdir/$subdir" ; then
  448. echo "* No source (sub)directory $subdir"
  449. return
  450. fi
  451. for i in "$top_srcdir/doc/api/Doxyfile.global" \
  452. "$top_srcdir/admin/Doxyfile.global" \
  453. "$DOXDATA/Doxyfile.global"
  454. do
  455. if test -f "$i" ; then
  456. cp "$i" "$subdir/Doxyfile"
  457. break
  458. fi
  459. done
  460. test -f "Doxyfile.in" || create_doxyfile_in
  461. cat "Doxyfile.in" >> "$subdir/Doxyfile"
  462. echo "PROJECT_NAME = \"$subdir\"" >> "$subdir/Doxyfile"
  463. echo "INPUT = $srcdir" >> "$subdir/Doxyfile"
  464. echo "OUTPUT_DIRECTORY = ." >> "$subdir/Doxyfile"
  465. if grep -l "$subdir/" subdirs.in > /dev/null 2>&1 ; then
  466. echo "RECURSIVE = NO" >> "$subdir/Doxyfile"
  467. fi
  468. echo "HTML_OUTPUT = $subdir/html" >> "$subdir/Doxyfile"
  469. echo "GENERATE_TAGFILE = $subdir/$subdirname.tag" >> "$subdir/Doxyfile"
  470. test -d "$top_srcdir/doc/api" && \
  471. echo "IMAGE_PATH = $top_srcdir/doc/api" >> "$subdir/Doxyfile"
  472. apidox_htmlfiles ""
  473. # Makefile.ams may contain overrides to our settings,
  474. # so copy them in.
  475. grep '^DOXYGEN_SET_' "$srcdir/Makefile.am" | \
  476. sed -e 's+DOXYGEN_SET_++' >> "$subdir/Doxyfile"
  477. apidox_specials "$srcdir/Makefile.am" "$subdir/Doxyfile"
  478. excludes=`extract_line DOXYGEN_EXCLUDE`
  479. if test -n "$excludes"; then
  480. patterns=""
  481. dirs=""
  482. for item in `echo "$excludes"`; do
  483. if test -d "$top_srcdir/$subdir/$item"; then
  484. dirs="$dirs $top_srcdir/$subdir/$item/"
  485. else
  486. patterns="$patterns $item"
  487. fi
  488. done
  489. echo "EXCLUDE_PATTERNS += $patterns" >> "$subdir/Doxyfile"
  490. echo "EXCLUDE += $dirs" >> "$subdir/Doxyfile"
  491. fi
  492. echo "TAGFILES = \\" >> "$subdir/Doxyfile"
  493. ## For now, don't support \ continued references lines
  494. tags=`extract_line DOXYGEN_REFERENCES`
  495. for i in $tags tqt ; do
  496. tagsubdir=`dirname $i` ; tag=`basename $i`
  497. tagpath=""
  498. not_found=""
  499. if test "x$tagsubdir" = "x." ; then
  500. tagsubdir=""
  501. else
  502. tagsubdir="$tagsubdir/"
  503. fi
  504. # Find location of tag file
  505. if test -f "$tagsubdir$tag/$tag.tag" ; then
  506. file="$tagsubdir$tag/$tag.tag"
  507. loc="$tagsubdir$tag/html"
  508. else
  509. # This checks for dox built with_out_ --no-modulename
  510. # in the same build dir as this dox run was started in.
  511. file=`ls -1 ../*-apidocs/"$tagsubdir$tag/$tag.tag" 2> /dev/null`
  512. if test -n "$file" ; then
  513. loc=`echo "$file" | sed -e "s/$tag.tag\$/html/"`
  514. else
  515. # If the tag file doesn't exist yet, but should
  516. # because we have the right dirs here, queue
  517. # this directory for re-processing later.
  518. if test -d "$top_srcdir/$tagsubdir$tag" ; then
  519. echo "* Need to re-process $subdir for tag $i"
  520. echo "$subdir" >> "subdirs.later"
  521. else
  522. # Re-check in $PREFIX if needed.
  523. test -n "$PREFIX" && \
  524. file=`cd "$PREFIX" && \
  525. ls -1 *-apidocs/"$tagsubdir$tag/$tag.tag" 2> /dev/null`
  526. # If something is found, patch it up. The location must be
  527. # relative to the installed location of the dox and the
  528. # file must be absolute.
  529. if test -n "$file" ; then
  530. loc=`echo "../$file" | sed -e "s/$tag.tag\$/html/"`
  531. file="$PREFIX/$file"
  532. echo "* Tags for $tagsubdir$tag will only work when installed."
  533. not_found="YES"
  534. fi
  535. fi
  536. fi
  537. fi
  538. if test "$tag" = "tqt" ; then
  539. if test -z "$TQTDOCDIR" ; then
  540. echo " $file" >> "$subdir/Doxyfile"
  541. else
  542. if test -z "$file" ; then
  543. # Really no TQt tags
  544. echo "" >> "$subdir/Doxyfile"
  545. else
  546. echo " $file=$TQTDOCDIR" >> "$subdir/Doxyfile"
  547. fi
  548. fi
  549. else
  550. if test -n "$file" ; then
  551. test -z "$not_found" && echo "* Found tag $file"
  552. echo " $file=../$top_builddir$loc \\" >> "$subdir/Doxyfile"
  553. fi
  554. fi
  555. done
  556. apidox_local
  557. if grep '^DOXYGEN_EMPTY' "$srcdir/Makefile.am" > /dev/null 2>&1 ; then
  558. # This directory is empty, so don't process it, but
  559. # *do* handle subdirs that might have dox.
  560. :
  561. else
  562. # Regular processing
  563. doxygen "$subdir/Doxyfile"
  564. doxyndex
  565. fi
  566. }
  567. ### Run a given subdir by setting up global variables first.
  568. do_subdir()
  569. {
  570. subdir=`echo "$1" | sed -e 's+/$++'`
  571. srcdir="$top_srcdir/$subdir"
  572. subdirname=`basename "$subdir"`
  573. mkdir -p "$subdir" 2> /dev/null
  574. if test ! -d "$subdir" ; then
  575. echo "Can't create dox subdirectory $subdir"
  576. return
  577. fi
  578. top_builddir=`echo "/$subdir" | sed -e 's+/[^/]*+../+g'`
  579. apidox_subdir
  580. }
  581. ### Create installdox-slow in the toplevel
  582. create_installdox()
  583. {
  584. # Fix up the installdox script so it accepts empty args
  585. #
  586. # This code is copied from the installdox generated by Doxygen,
  587. # copyright by Dimitri van Heesch and released under the GPL.
  588. # This does a _slow_ update of the dox, because it loops
  589. # over the given substitutions instead of assuming all the
  590. # needed ones are given.
  591. #
  592. cat <<\EOF
  593. #! /usr/bin/env perl
  594. %subst = () ;
  595. $quiet = 0;
  596. if (open(F,"search.cfg"))
  597. {
  598. $_=<F> ; s/[ \t\n]*$//g ; $subst{"_doc"} = $_;
  599. $_=<F> ; s/[ \t\n]*$//g ; $subst{"_cgi"} = $_;
  600. }
  601. while ( @ARGV ) {
  602. $_ = shift @ARGV;
  603. if ( s/^-// ) {
  604. if ( /^l(.*)/ ) {
  605. $v = ($1 eq "") ? shift @ARGV : $1;
  606. ($v =~ /\/$/) || ($v .= "/");
  607. $_ = $v;
  608. if ( /(.+)\@(.+)/ ) {
  609. $subst{$1} = $2;
  610. } else {
  611. print STDERR "Argument $_ is invalid for option -l\n";
  612. &usage();
  613. }
  614. }
  615. elsif ( /^q/ ) {
  616. $quiet = 1;
  617. }
  618. elsif ( /^\?|^h/ ) {
  619. &usage();
  620. }
  621. else {
  622. print STDERR "Illegal option -$_\n";
  623. &usage();
  624. }
  625. }
  626. else {
  627. push (@files, $_ );
  628. }
  629. }
  630. if ( ! @files ) {
  631. if (opendir(D,".")) {
  632. foreach $file ( readdir(D) ) {
  633. $match = ".html";
  634. next if ( $file =~ /^\.\.?$/ );
  635. ($file =~ /$match/) && (push @files, $file);
  636. ($file =~ "tree.js") && (push @files, $file);
  637. }
  638. closedir(D);
  639. }
  640. }
  641. if ( ! @files ) {
  642. print STDERR "Warning: No input files given and none found!\n";
  643. }
  644. foreach $f (@files)
  645. {
  646. if ( ! $quiet ) {
  647. print "Editing: $f...\n";
  648. }
  649. $oldf = $f;
  650. $f .= ".bak";
  651. unless (rename $oldf,$f) {
  652. print STDERR "Error: cannot rename file $oldf\n";
  653. exit 1;
  654. }
  655. if (open(F,"<$f")) {
  656. unless (open(G,">$oldf")) {
  657. print STDERR "Error: opening file $oldf for writing\n";
  658. exit 1;
  659. }
  660. if ($oldf ne "tree.js") {
  661. while (<F>) {
  662. foreach $sub (keys %subst) {
  663. s/doxygen\=\"$sub\:([^ \"\t\>\<]*)\" (href|src)=\"\1/doxygen\=\"$sub:$subst{$sub}\" \2=\"$subst{$sub}/g;
  664. print G "$_";
  665. }
  666. }
  667. }
  668. else {
  669. while (<F>) {
  670. foreach $sub (keys %subst) {
  671. s/\"$sub\:([^ \"\t\>\<]*)\", \"\1/\"$sub:$subst{$sub}\" ,\"$subst{$sub}/g;
  672. print G "$_";
  673. }
  674. }
  675. }
  676. }
  677. else {
  678. print STDERR "Warning file $f does not exist\n";
  679. }
  680. unlink $f;
  681. }
  682. sub usage {
  683. print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n";
  684. print STDERR "Options:\n";
  685. print STDERR " -l tagfile\@linkName tag file + URL or directory \n";
  686. print STDERR " -q Quiet mode\n\n";
  687. exit 1;
  688. }
  689. EOF
  690. }
  691. # Do only the subdirs that match the RE passed in as $1
  692. do_subdirs_re()
  693. {
  694. RE=`echo "$1" | sed -e 's+/$++'`
  695. # Here's a queue of dirs to re-process later when
  696. # all the rest have been done already.
  697. > subdirs.later
  698. # subdirs.top lists _all_ subdirs of top in the order they
  699. # should be handled; subdirs.in lists those dirs that contain
  700. # dox. So the intersection of the two is the ordered list
  701. # of top-level subdirs that contain dox.
  702. #
  703. # subdirs.top also doesn't contain ".", so that special
  704. # case can be ignored in the loop.
  705. (
  706. for i in `grep "^$RE" subdirs.top`
  707. do
  708. if test "x$i" = "x." ; then
  709. continue
  710. fi
  711. # Calculate intersection of this element and the
  712. # set of dox dirs.
  713. if grep "^$i\$" subdirs.in > /dev/null 2>&1 ; then
  714. echo "$i"
  715. mkdir -p "$i" 2> /dev/null
  716. # Handle the subdirs of this one
  717. for j in `grep "$i/" subdirs.in`
  718. do
  719. echo "$j"
  720. mkdir -p "$j" 2> /dev/null
  721. done
  722. fi
  723. done
  724. # Now we still need to handle whatever is left
  725. for i in `cat subdirs.in`
  726. do
  727. test -d "$i" || echo "$i"
  728. mkdir -p "$i" 2> /dev/null
  729. done
  730. ) > subdirs.sort
  731. for i in `cat subdirs.sort`
  732. do
  733. do_subdir "$i"
  734. done
  735. if test -s "subdirs.later" ; then
  736. sort subdirs.later | uniq > subdirs.sort
  737. for i in `cat subdirs.sort`
  738. do
  739. : > subdirs.later
  740. echo "*** Reprocessing $i"
  741. do_subdir "$i"
  742. test -s "subdirs.later" && echo "* Some tag files were still not found."
  743. done
  744. fi
  745. }
  746. if test "x." = "x$top_builddir" ; then
  747. apidox_toplevel
  748. create_subdirs
  749. create_installdox > installdox-slow
  750. if test "x$recurse" = "x1" ; then
  751. if test "x$module_name" = "xtdelibs" ; then
  752. if test -z "$TQTDOCTAG" && test -d "$TQTDOCDIR" && \
  753. test ! -f "tqt/tqt.tag" ; then
  754. # Special case: create a tqt tag file.
  755. echo "*** Creating a tag file for the TQt library:"
  756. mkdir tqt
  757. doxytag -t tqt/tqt.tag "$TQTDOCDIR" > /dev/null 2>&1
  758. fi
  759. fi
  760. if test -n "$TQTDOCTAG" && test -r "$TQTDOCTAG" ; then
  761. echo "*** Copying tag file for the TQt library:"
  762. mkdir tqt
  763. cp "$TQTDOCTAG" tqt/tqt.tag
  764. fi
  765. do_subdirs_re "."
  766. fi
  767. else
  768. if test "x$recurse" = "x1" ; then
  769. do_subdirs_re "$subdir"
  770. else
  771. do_subdir "$subdir"
  772. fi
  773. fi
  774. # At the end of a run, clean up stuff.
  775. if test "YES" = "$cleanup" ; then
  776. rm -f subdirs.in subdirs.later subdirs.sort subdirs.top Doxyfile.in
  777. rm -f `find . -name Doxyfile`
  778. rm -f tqt/tqt.tag
  779. rmdir tqt > /dev/null 2>&1
  780. fi
  781. exit 0