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 kdelibs for details.
10 # Recurse handling is a little complicated, since normally
11 # subdir (given on the command-line) processing doesn't recurse
12 # but you can force it to do so.
20 while test -n "$1" ; do
46 echo "doxygen.sh usage:"
47 echo "doxygen.sh [--options] <srcdir> [<subdir>]"
48 echo " --no-cleanup Do not remove Doxyfile and other cruft from build"
49 echo " --no-recurse Build only the given top-level directory"
50 echo " --no-modulename Build in apidocs/, not apidocs-module/"
51 echo " --doxdatadir=dir Use dir as the source of global Doxygen files"
52 echo " --installdir=dir Use dir as target to install to"
53 echo " --preprocess Generate source code (KConfigXT, uic, etc.)"
54 echo " --manpages Generate man pages in addition to html"
58 DOXDATA
=`echo $1 | sed -e 's+--doxdatadir=++'`
61 PREFIX
=`echo $1 | sed -e 's+--installdir=++'`
64 echo "Unknown option: $1"
76 ### Sanity check the mandatory "top srcdir" argument.
77 if test -z "$top_srcdir" ; then
78 echo "Usage: doxygen.sh <top_srcdir>"
81 if test ! -d "$top_srcdir" ; then
82 echo "top_srcdir ($top_srcdir) is not a directory."
86 ### Normalize top_srcdir so it is an absolute path.
87 if expr "x$top_srcdir" : "x/" > /dev
/null
; then
88 # top_srcdir is absolute already
91 top_srcdir
=`cd "$top_srcdir" 2> /dev/null && pwd`
92 if test ! -d "$top_srcdir" ; then
93 echo "top_srcdir ($top_srcdir) is not a directory."
98 ### Normalize DOXDATA so it is an absolute path.
99 if test -n "$DOXDATA"; then
100 if expr "x$DOXDATA" : "x/" > /dev
/null
; then
101 # DOXDATA is absolute already
104 DOXDATA
=`cd "$DOXDATA" 2> /dev/null && pwd`
105 if test ! -d "$DOXDATA" ; then
106 echo "DOXDATA ($DOXDATA) is not a directory."
113 ### Sanity check and guess QTDOCDIR.
114 if test -z "$QTDOCDIR" ; then
115 if test -z "$QTDIR" ; then
116 for i
in /usr
/X11R
6/share
/doc
/qt
/html
119 test -d "$QTDOCDIR" && break
122 for i
in share
/doc
/qt
/html
doc
/html
125 test -d "$QTDOCDIR" && break
129 if test -z "$QTDOCDIR" ||
test ! -d "$QTDOCDIR" ; then
130 if test -z "$QTDOCDIR" ; then
131 echo "* QTDOCDIR could not be guessed."
133 echo "* QTDOCDIR does not name a directory."
135 if test -z "$QTDOCTAG" ; then
136 echo "* QTDOCDIR set to \"\""
139 echo "* But I'll use $QTDOCDIR anyway because of QTDOCTAG."
143 ### Get the "top srcdir", also its name, and handle the case that subdir "."
144 ### is given (which would be top_srcdir then, so it's equal to none-given
145 ### but no recursion either).
147 # top_srcdir="$1" # Already set by options processing
148 module_name
=`basename "$top_srcdir"`
150 if test "x." = "x$subdir" ; then
152 if test "x$recurse_given" = "xNO" ; then
156 if test "x" != "x$subdir" ; then
157 # If no recurse option given explicitly, default to
158 # no recurse when processing subdirs given on the command-line.
159 if test "x$recurse_given" = "xNO" ; then
164 if test -z "$DOXDATA" ||
test ! -d "$DOXDATA" ; then
165 if test -n "$DOXDATA" ; then
166 echo "* \$DOXDATA is '$DOXDATA' which does not name a directory"
168 DOXDATA
="$top_srcdir/doc/common"
171 if test ! -d "$DOXDATA" ; then
172 echo "* \$DOXDATA does not name a directory ( or is unset ), tried \"$DOXDATA\""
176 if test -n "$PREFIX" && test ! -d "$PREFIX" ; then
177 echo "* \$PREFIX does not name a directory, tried \"$PREFIX\""
178 echo "* \$PREFIX is disabled."
182 TOPNAME
=`grep '^/.*DOXYGEN_NAME' "$top_srcdir/Mainpage.dox" | sed -e 's+.*=++' | sed s+\"++g`
183 if test -z "$TOPNAME" ; then
184 TOPNAME
="API Reference"
187 COPYRIGHT
=`grep '^/.*DOXYGEN_COPYRIGHT' "$top_srcdir/Mainpage.dox" | sed -e 's+[^=]*=++' | sed s+\"++g`
188 if test -z "$COPYRIGHT" ; then
189 COPYRIGHT
="1996-`date +%Y` The KDE developers"
193 # Preprocess source dir and generate source files (KConfigXT, uic, etc.)
194 # @param $1: create or cleanup (parameter for doxygen-preprocess-foo.sh)
198 for dir
in `find $top_srcdir/$subdir -type d | grep -v ".svn"`; do
199 # execute global preprocessing modules
200 local preproc_base
="`dirname $0`"
201 for proc
in `find "$preproc_base" -name "doxygen-preprocess-*.sh"`; do
202 (cd $dir && $proc $1)
204 # execute local preprocessing modules
205 for proc
in `find $dir -maxdepth 1 -name "doxygen-preprocess-*.sh"`; do
206 echo "* running $proc"
207 (cd $dir && $proc $1)
212 if test "$preprocess" = "1"; then
213 echo "* Generating source code in $top_srcdir/$subdir"
214 preprocess_sources create
215 echo "* Generating source code completed"
218 ### We need some values from top-level files, which
219 ### are not preserved between invocations of this
220 ### script, so factor it out for easy use.
223 VERSION
=`grep '^/.*DOXYGEN_VERSION' "$top_srcdir/Mainpage.dox" | sed -e 's+.*=++'`
224 NAME
=`grep '^/.*DOXYGEN_NAME' "$top_srcdir/Mainpage.dox" | sed -e 's+.*=++'`
225 echo "PROJECT_NUMBER = $VERSION" > Doxyfile.
in
226 echo "PROJECT_NAME = $NAME" >> Doxyfile.
in
229 apidoxdir
="$module_name"-apidocs
230 test "x$use_modulename" = "x0" && apidoxdir
="apidocs"
232 ### If we're making the top subdir, create the structure
233 ### for the apidox and initialize it. Otherwise, just use the
234 ### structure assumed to be there.
235 if test -z "$subdir" ; then
236 if test ! -d "$apidoxdir" ; then
237 mkdir
"$apidoxdir" > /dev
/null
2>&1
239 cd "$apidoxdir" > /dev
/null
2>&1 ||
{
240 echo "Cannot create and cd into $apidoxdir"
244 test -f "Doxyfile.in" || create_doxyfile_in
246 # Copy in logos and the like
247 for i
in "favicon.ico" "block_title_bottom.png" "block_title_mid.png" "block_title_top.png" "top-kde.jpg" "top-left.jpg" "top-right.jpg" "top.jpg" "kde.css" "flat.css" "print.css" "tabs.css"
249 cp "$DOXDATA/$i" .
> /dev
/null
2> /dev
/null
251 for i
in "$top_srcdir/doc/api/Dox-"*.png
253 T
=`basename "$i" | sed -e 's+Dox-++'`
254 test -f "$i" && cp "$i" "./$T" > /dev
/null
2> /dev
/null
261 cd "$apidoxdir" > /dev
/null
2>&1 ||
{
262 echo "Cannot cd into $apidoxdir -- maybe you need to"
263 echo "build the top-level dox first."
267 if test "x1" = "x$recurse" ; then
268 # OK, so --recurse was requested
269 if test ! -f "subdirs.top" ; then
270 echo "* No subdirs.top available in the $apidoxdir."
271 echo "* The --recurse option will be ignored."
277 ### Read a single line (TODO: support \ continuations) from the Mainpage.dox.
278 ### Used to extract variable assignments from it.
281 file="$2" ; test -z "$file" && file="$srcdir/Mainpage.dox"
282 test -f "$file" ||
return
283 pattern
=`echo "$1" | tr + .`
284 grep "^//[[:space:]]*$1" "$file" | \
285 sed -e "s+//[[:space:]]*$pattern.*=[[:space:]]*++"
288 ### Try to order the top-level subdirectories so that we get the smallest
289 ### amount of re-processing due to missing tag files.
292 echo "* Sorting top-level subdirs"
294 ( cd "$top_srcdir" &&
297 # For each Mainpage.dox, get the list (possibly empty) of
298 # referenced tag files.
300 if test -d "$dir" && test -f "$dir/Mainpage.dox" ; then
301 # Need this dir at the very least, even if it doesn't reference
303 list
=`grep DOXYGEN_REFERENCES $dir/Mainpage.dox | sed 's/.*=//'`
306 # Print the partial order pairs that we now know. This
307 # is *expected* to produce loops in the partial order;
308 # these cannot be avoided.
309 for req
in $list ; do
313 done ) |
grep -v / |
tsort 2> /dev
/null
> subdirs.top
319 mp
=`extract_line DOXYGEN_GENERATE_MAN`
320 if test -z "$mp" ; then
323 echo "GENERATE_MAN = $mp" >> "$subdir/Doxyfile"
324 echo "MAN_OUTPUT = man" >> "$subdir/Doxyfile"
325 echo "MAN_EXTENSION = .3" >> "$subdir/Doxyfile"
326 echo "MAN_LINKS = YES" >> "$subdir/Doxyfile"
329 ### Add HTML header, footer, CSS tags to Doxyfile.
330 ### Assumes $subdir is set. Argument is a string
331 ### to stick in front of the file if needed.
334 dox_header
="$top_srcdir/doc/api/$1header.html"
335 dox_footer
="$top_srcdir/doc/api/$1footer.html"
336 dox_css
="$top_srcdir/doc/api/doxygen.css"
337 test -f "$dox_header" || dox_header
="$DOXDATA/$1header.html"
338 test -f "$dox_footer" || dox_footer
="$DOXDATA/$1footer.html"
339 test -f "$dox_css" || dox_css
="$DOXDATA/doxygen.css"
341 echo "HTML_HEADER = $dox_header" >> "$subdir/Doxyfile" ; \
342 echo "HTML_FOOTER = $dox_footer" >> "$subdir/Doxyfile" ; \
343 echo "HTML_STYLESHEET = $dox_css" >> "$subdir/Doxyfile"
348 line
=`extract_line DOXYGEN_PROJECTNAME "$1"`
349 test -n "$line" && echo "PROJECT_NAME = \"$line\"" >> "$2"
350 line
=`extract_line DOXYGEN_PROJECTVERSION "$1"`
351 test -n "$line" && echo "PROJECT_NUMBER = \"$line\"" >> "$2"
356 for i
in "$top_srcdir/doc/api/Doxyfile.local"
358 if test -f "$i" ; then
359 cat "$i" >> "$subdir/Doxyfile"
365 ### Post-process HTML files by substituting in the menu files
367 # In non-top directories, both <!-- menu --> and <!-- gmenu -->
368 # are calculated and replaced. Top directories get an empty <!-- menu -->
372 # Special case top-level to have an empty MENU.
373 if test "x$subdir" = "x." ; then
376 htmltop
="$top_builddir" # Just ., presumably
377 echo "* Post-processing top-level files"
380 htmldir
="$subdir/html"
381 htmltop
="$top_builddir.." # top_builddir ends with /
382 echo "* Post-processing files in $htmldir"
384 # Build a little PHP file that maps class names to file
385 # names, for the quick-class-picker functionality.
386 # (The quick-class-picker is disabled due to styling
387 # problems in IE & FF).
389 echo "<?php \$map = array("; \
390 for htmlfile
in `find $htmldir/ -type f -name "class[A-Z]*.html" | grep -v "\-members.html$"`; do
391 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]"`
392 echo " \"$classname\" => \"$htmlfile\","
395 ) > "$subdir/classmap.inc"
397 # This is a list of pairs, with / separators so we can use
398 # basename and dirname (a crude shell hack) to split them
399 # into parts. For each, if the file part exists (as a html
400 # file) tack it onto the MENU variable as a <li> with link.
401 for i
in "Main Page/index" \
403 "Namespace List/namespaces" \
404 "Class Hierarchy/hierarchy" \
405 "Alphabetical List/classes" \
406 "Class List/annotated" \
409 "Namespace Members/namespacemembers" \
410 "Class Members/functions" \
411 "Related Pages/pages"
415 test -f "$htmldir/$FILE.html" && MENU
="$MENU<li><a href=\"$FILE.html\">$NAME</a></li>"
422 # Get the list of global Menu entries.
423 GMENU
=`cat subdirs | tr -d '\n'`
425 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("./index.html"); } for (k=j; k<c; k++) { printf "../index.html"; } if (j<c) { printf("../html/index.html"); } printf "\">%s</a>\n" , a[j]; } }' | tr -d '\n'`
427 # Map the PHP file into HTML options so that
428 # it can be substituted in for the quick-class-picker.
430 # For now, leave the CMENU disabled
434 if test "x$subdir" = "x." ; then
435 # Disable CMENU on toplevel anyway
439 test -f "$subdir/classmap.inc" && \
440 CMENU
=`grep '=>' "$subdir/classmap.inc" | sed -e 's+"\([^"]*\)" => "'"$subdir/html/"'\([^"]*\)"+<option value="\2">\1<\/option>+' | tr -d '\n'`
442 if test -f "$subdir/classmap.inc" && grep "=>" "$subdir/classmap.inc" > /dev
/null
2>&1 ; then
443 # Keep the menu, it's useful
451 # Now substitute in the MENU in every file. This depends
452 # on HTML_HEADER (ie. header.html) containing the
453 # <!-- menu --> comment.
454 for i
in "$htmldir"/*.html
456 if test -f "$i" ; then
457 sed -e "s+<!-- menu -->+$MENU+" \
458 -e "s+<!-- gmenu -->+$GMENU+" \
459 -e "s+<!-- pmenu.*-->+$PMENU+" \
460 -e "s+<!-- cmenu.begin -->+$CMENUBEGIN+" \
461 -e "s+<!-- cmenu.end -->+$CMENUEND+" \
462 < "$i" |
sed -e "s+@topdir@+$htmltop+g" |
sed -e "s+@topname@+$TOPNAME+g" |
sed -e "s+@copyright@+$COPYRIGHT+g" > "$i.new" && mv "$i.new" "$i"
463 sed -e "s+<!-- cmenu -->+$CMENU+" < "$i" > "$i.new"
464 test -s "$i.new" && mv "$i.new" "$i"
465 echo "* Added menus to $i"
469 ## Allen: Comment this out for now.
470 ## Basically, I think it's annoying. We need something less obtrusive.
471 ## # For each class, post-process it to check for bc-ness
472 ## for i in "$htmldir"/class*.html
474 ## test "$htmldir/classes.html" = "$i" && continue
475 ## if test -f "$i" ; then
476 ## grep -l 'bc.html#_bc' "$i" > /dev/null || \
477 ## { sed -e 's+<!-- BC -->+<div class="bic">This class is not guaranteed to be binary compatible across releases.</div>+' "$i" > "$i.new" ; test -s "$i.new" && mv "$i.new" "$i" ; }
478 ## echo "* Added BC warning to $i"
488 ### Handle the Doxygen processing of a toplevel directory.
492 echo "*** Creating API documentation main page for $module_name"
495 for i
in "$top_srcdir/doc/api/Doxyfile.global" \
496 "$DOXDATA/Doxyfile.global"
498 if test -f "$i" ; then
504 if test ! -f "Doxyfile" ; then
505 echo "* Cannot create Doxyfile."
509 cat "$top_builddir/Doxyfile.in" >> Doxyfile
513 echo "INPUT = $top_srcdir"
514 echo "DOTFILE_DIRS = $top_srcdir"
515 echo "OUTPUT_DIRECTORY = $top_builddir"
516 echo "RECURSIVE = NO"
517 echo "ALPHABETICAL_INDEX = NO"
518 echo "HTML_OUTPUT = ."
520 apidox_htmlfiles
"main"
521 if test "$manpages" = "1"; then
525 # KDevelop has a top-level Makefile.am with settings.
526 for i
in "$top_srcdir/Mainpage.dox"
528 if test -f "$i" ; then
529 grep '^//[[:space:]]*DOXYGEN_SET_' "$i" | \
530 sed -e 's+//[[:space:]]*DOXYGEN_SET_++' -e "s+@topdir@+$top_srcdir+g" >> Doxyfile
531 apidox_specials
"$srcdir/Mainpage.dox" "$subdir/Doxyfile"
541 ( cd "$top_srcdir" && find .
-name Mainpage.dox
) |
sed -e 's+/Mainpage.dox$++' -e 's+^\./++' |
sort > subdirs.
in
542 for i
in `cat subdirs.in`
544 test "x." = "x$i" && continue;
548 if test "x." = "x$dir" ; then
553 indent
=`echo "$dir" | sed -e 's+[^/]*/+\ \ +g' | sed -e 's+&+\\\&+g'`
554 entryname
=`extract_line DOXYGEN_SET_PROJECT_NAME "$top_srcdir/$dir/$file/Mainpage.dox"`
555 test -z "$entryname" && entryname
="$file"
557 if grep DOXYGEN_EMPTY
"$top_srcdir/$dir/$file/Mainpage.dox" > /dev
/null
2>&1 ; then
558 echo "<li>$indent$file</li>"
560 echo "<li>$indent<a href=\"@topdir@/$dir$file/html/index.html\">$entryname</a></li>"
567 ### Handle the Doxygen processing of a non-toplevel directory.
569 # $1 is empty to generate tag files only.
570 # $1 is non-empty to generate HTML.
572 # Additionally, the environment variable $NO_APPEND_TAG may be set
573 # to a non-empty value to suppress adding the tag for this subdir
574 # to the list of tag files (used when re-generating a single subdir).
579 if test -z "$1" ; then
580 echo "*** Creating tag file in $subdir"
582 echo "*** Creating apidox in $subdir"
585 #rm -f "$subdir/Doxyfile"
586 if test ! -d "$top_srcdir/$subdir" ; then
587 echo "* No source (sub)directory $subdir"
590 for i
in "$top_srcdir/doc/api/Doxyfile.global" \
591 "$DOXDATA/Doxyfile.global"
593 if test -f "$i" ; then
594 cp "$i" "$subdir/Doxyfile"
600 test -f "Doxyfile.in" || create_doxyfile_in
601 cat "Doxyfile.in" >> "$subdir/Doxyfile"
604 echo "PROJECT_NAME = \"$subdir\""
605 if test -d "$top_srcdir/doc/common" ; then
606 echo "INPUT = $top_srcdir/doc/common $srcdir"
608 echo "INPUT = $srcdir"
610 echo "DOTFILE_DIRS = $top_srcdir $srcdir"
611 echo "OUTPUT_DIRECTORY = ."
612 if grep -l "$subdir/" subdirs.
in > /dev
/null
2>&1 ; then
613 echo "RECURSIVE = NO"
615 echo "HTML_OUTPUT = $subdir/html"
616 if test -d "$top_srcdir/doc/api"; then
617 echo "IMAGE_PATH = $top_srcdir/doc/api $srcdir $srcdir/doc/pics"
618 echo "EXAMPLE_PATH = $top_srcdir/doc/api/examples $srcdir/examples $srcdir/doc/examples"
620 echo "IMAGE_PATH = $srcdir $srcdir/doc/pics"
621 echo "EXAMPLE_PATH = $srcdir/examples $srcdir/doc/examples"
623 } >> "$subdir/Doxyfile"
626 if test "$manpages" = "1"; then
630 # Mainpage.doxs may contain overrides to our settings,
632 grep '^//[[:space:]]*DOXYGEN_SET_' "$srcdir/Mainpage.dox" | \
633 sed -e 's+//[[:space:]]*DOXYGEN_SET_++' -e "s+@topdir@+$top_srcdir+g" >> "$subdir/Doxyfile"
634 apidox_specials
"$srcdir/Mainpage.dox" "$subdir/Doxyfile"
636 excludes
=`extract_line DOXYGEN_EXCLUDE`
637 if test -n "$excludes"; then
640 for item
in `echo "$excludes"`; do
641 if test -d "$top_srcdir/$subdir/$item"; then
642 dirs="$dirs $top_srcdir/$subdir/$item/"
644 patterns
="$patterns $item"
647 echo "EXCLUDE_PATTERNS += $patterns" >> "$subdir/Doxyfile"
648 echo "EXCLUDE += $dirs" >> "$subdir/Doxyfile"
651 echo "TAGFILES = \\" >> "$subdir/Doxyfile"
652 ## For now, don't support \ continued references lines
653 tags
=`extract_line DOXYGEN_REFERENCES`
654 for i
in $tags qt
; do
655 tagsubdir
=`dirname $i` ; tag
=`basename $i`
659 if test "x$tagsubdir" = "x." ; then
662 tagsubdir
="$tagsubdir/"
665 # Find location of tag file
666 if test -f "$tagsubdir$tag/$tag.tag" ; then
667 file="$tagsubdir$tag/$tag.tag"
668 loc
="$tagsubdir$tag/html"
670 # This checks for dox built with_out_ --no-modulename
671 # in the same build dir as this dox run was started in.
672 file=`ls -1 ../*-apidocs/"$tagsubdir$tag/$tag.tag" 2> /dev/null`
674 if test -n "$file" ; then
675 loc
=`echo "$file" | sed -e "s/$tag.tag\$/html/"`
677 # If the tag file doesn't exist yet, but should
678 # because we have the right dirs here, queue
679 # this directory for re-processing later.
680 if test -d "$top_srcdir/$tagsubdir$tag" ; then
681 echo "* Need to re-process $subdir for tag $i"
682 echo "$subdir" >> "subdirs.later"
684 # Re-check in $PREFIX if needed.
685 test -n "$PREFIX" && \
686 file=`cd "$PREFIX" && \
687 ls -1 *-apidocs/"$tagsubdir$tag/$tag.tag" 2> /dev/null`
689 # If something is found, patch it up. The location must be
690 # relative to the installed location of the dox and the
691 # file must be absolute.
692 if test -n "$file" ; then
693 loc
=`echo "../$file" | sed -e "s/$tag.tag\$/html/"`
695 echo "* Tags for $tagsubdir$tag will only work when installed."
701 if test "$tag" = "qt" ; then
702 if test -z "$QTDOCDIR" ; then
703 echo " $file" >> "$subdir/Doxyfile"
705 if test -z "$file" ; then
707 echo "\\" >> "$subdir/Doxyfile"
709 echo " $file=$QTDOCDIR \\" >> "$subdir/Doxyfile"
713 if test -n "$file" ; then
714 test -z "$not_found" && echo "* Found tag $file"
715 echo " $file=../$top_builddir$loc \\" >> "$subdir/Doxyfile"
720 if test -z "$1" ; then
721 echo "" >> "$subdir/Doxyfile"
722 echo "GENERATE_HTML=NO" >> "$subdir/Doxyfile"
723 echo "GENERATE_TAGFILE=$subdir/$subdirname.tag" >> "$subdir/Doxyfile"
724 test -z "$NO_APPEND_TAG" && echo " $subdir/$subdirname.tag \\" >> subdirs.tag
726 #test -s subdirs.tag && grep -v "$subdir/$subdirname.tag" subdirs.tag >> "$subdir/Doxyfile"
727 echo "" >> "$subdir/Doxyfile"
728 echo "GENERATE_HTML=YES" >> "$subdir/Doxyfile"
733 if grep '^DOXYGEN_EMPTY' "$srcdir/Mainpage.dox" > /dev
/null
2>&1 ; then
734 # This directory is empty, so don't process it, but
735 # *do* handle subdirs that might have dox.
739 doxygen
"$subdir/Doxyfile"
740 if test -n "$1" ; then
746 ### Run a given subdir by setting up global variables first.
748 # $1 is the subdir to process
749 # $2 is the flag for apidox_subdir
753 local subdir
=`echo "$1" | sed -e 's+/$++'`
754 srcdir
="$top_srcdir/$subdir"
755 subdirname
=`basename "$subdir"`
756 mkdir
-p "$subdir" 2> /dev
/null
757 if test ! -d "$subdir" ; then
758 echo "Can't create dox subdirectory $subdir"
761 top_builddir
=`echo "/$subdir" | sed -e 's+/[^/]*+../+g'`
766 ### Create installdox-slow in the toplevel
769 # Fix up the installdox script so it accepts empty args
771 # This code is copied from the installdox generated by Doxygen,
772 # copyright by Dimitri van Heesch and released under the GPL.
773 # This does a _slow_ update of the dox, because it loops
774 # over the given substitutions instead of assuming all the
775 # needed ones are given.
783 if (open
(F
,"search.cfg"))
785 $_=<F
> ; s
/[ \t\n]*$
//g
; $subst{"_doc"} = $_;
786 $_=<F
> ; s
/[ \t\n]*$
//g
; $subst{"_cgi"} = $_;
793 $v = ($1 eq
"") ?
shift @ARGV
: $1;
794 ($v =~
/\
/$
/) ||
($v .
= "/");
796 if ( /(.
+)\@
(.
+)/ ) {
799 print STDERR
"Argument $_ is invalid for option -l\n";
810 print STDERR
"Illegal option -$_\n";
821 if (opendir
(D
,".")) {
822 foreach
$file ( readdir
(D
) ) {
824 next
if ( $file =~
/^\.\.?$
/ );
825 ($file =~
/$match/) && (push @files
, $file);
826 ($file =~
"tree.js") && (push @files
, $file);
833 print STDERR
"Warning: No input files given and none found!\n";
839 print
"Editing: $f...\n";
843 unless
(rename
$oldf,$f) {
844 print STDERR
"Error: cannot rename file $oldf\n";
848 unless
(open
(G
,">$oldf")) {
849 print STDERR
"Error: opening file $oldf for writing\n";
852 if ($oldf ne
"tree.js") {
854 foreach
$sub (keys
%subst
) {
855 s
/doxygen\
=\"$sub\
:([^
\"\t\
>\
<]*)\" (href|src
)=\"\
1/doxygen\
=\"$sub:$subst{$sub}\" \
2=\"$subst{$sub}/g
;
862 foreach
$sub (keys
%subst
) {
863 s
/\"$sub\
:([^
\"\t\
>\
<]*)\", \"\
1/\"$sub:$subst{$sub}\" ,\"$subst{$sub}/g
;
870 print STDERR
"Warning file $f does not exist\n";
876 print STDERR
"Usage: installdox [options] [html-file [html-file ...]]\n";
877 print STDERR
"Options:\n";
878 print STDERR
" -l tagfile\@linkName tag file + URL or directory \n";
879 print STDERR
" -q Quiet mode\n\n";
885 # Do only the subdirs that match the RE passed in as $1
888 RE
=`echo "$1" | sed -e 's+/$++'`
890 # Here's a queue of dirs to re-process later when
891 # all the rest have been done already.
894 # subdirs.top lists _all_ subdirs of top in the order they
895 # should be handled; subdirs.in lists those dirs that contain
896 # dox. So the intersection of the two is the ordered list
897 # of top-level subdirs that contain dox.
899 # subdirs.top also doesn't contain ".", so that special
900 # case can be ignored in the loop.
904 for i
in `grep "^$RE" subdirs.top`
906 if test "x$i" = "x." ; then
909 # Calculate intersection of this element and the
911 if grep "^$i\$" subdirs.
in > /dev
/null
2>&1 ; then
913 mkdir
-p "$i" 2> /dev
/null
915 # Handle the subdirs of this one
916 for j
in `grep "$i/" subdirs.in`
919 mkdir
-p "$j" 2> /dev
/null
924 # Now we still need to handle whatever is left
925 for i
in `cat subdirs.in`
927 test -d "$i" ||
echo "$i"
928 mkdir
-p "$i" 2> /dev
/null
932 # Run once for the tags
933 for i
in `cat subdirs.sort`
938 # Run again for the HTML
939 for i
in `cat subdirs.sort`
946 if test "x." = "x$top_builddir" ; then
949 create_installdox
> installdox-slow
950 if test "x$recurse" = "x1" ; then
951 if test "x$module_name" = "xkdelibs" ; then
952 if test -z "$QTDOCTAG" && test -d "$QTDOCDIR" && \
953 test ! -f "qt/qt.tag" ; then
954 # Special case: create a qt tag file.
955 echo "*** Creating a tag file for the Qt library:"
957 doxytag
-t qt
/qt.tag
"$QTDOCDIR" > /dev
/null
2>&1
960 if test -n "$QTDOCTAG" && test -r "$QTDOCTAG" ; then
961 echo "*** Copying tag file for the Qt library:"
963 cp "$QTDOCTAG" qt
/qt.tag
970 if test "x$recurse" = "x1" ; then
971 do_subdirs_re
"$subdir"
973 NO_APPEND_TAG
=true do_subdir
"$subdir"
974 do_subdir
"$subdir" true
979 # At the end of a run, clean up stuff.
980 if test "YES" = "$cleanup" ; then
981 rm -f subdirs.
in subdirs.later subdirs.
sort subdirs.top Doxyfile.
in
982 #rm -f `find . -name Doxyfile`
984 # rmdir qt > /dev/null 2>&1
985 if test "$preprocess" = "1"; then
986 echo "* Cleaning up previously generated source code in $top_srcdir/$subdir"
987 preprocess_sources cleanup
988 echo "* Cleaning up previously generated source code done"