script/makefile to build doxygen docs in parallel

Change-Id: I6b56ac08db71eb354e0b2d57913e6e78d2652877
This commit is contained in:
Norbert Thiebaud
2016-03-14 19:34:01 -05:00
parent bfa7b70048
commit 2848692ff4
5 changed files with 5030 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
.SUFFIXES:
gb_Side=host
BUILDDIR=$(shell pwd)
SRCDIR:=$(abspath $(dir $(firstword $(MAKEFILE_LIST)))/../..)
$(info SRCDIR:$(SRCDIR))
include $(SRCDIR)/config_host.mk
.PHONY: init_doxygen generate_tag generate_doc
.DEFAULT: generate_doc
prefered_modules := sw sc sd
gbuild_modules := $(prefered_modules) $(filter-out $(prefered_modules),$(patsubst $(SRCDIR)/%/,%,$(dir $(wildcard $(SRCDIR)/*/Module_*.mk))))
$(info gbuild_modules:$(gbuild_modules))
DOXYGEN_REF_TAGFILES=$(foreach m,$(gbuild_modules), $(BUILDDIR)/docs/$(m)/$(m).tags=./$(m)/html)
export DOXYGEN_REF_TAGFILES
$(BUILDDIR)/docs/%.tag: init_doxygen
@echo "doxygen tag of $(basename $(notdir $@))"
@export DOXYGEN_INCLUDE_PATH=`echo $(SOLARINC) | sed -e 's/-I\.//g' -e 's/ -I/ /'g -e 's/ -isystem/ /g' -e 's|/usr/[^ ]*| |g'` ; \
$(SRCDIR)/solenv/bin/mkonedoc.sh "$(basename $(notdir $@))" "tag" "$(SRCDIR)" "$(BUILDDIR)/docs"
@touch $@
$(BUILDDIR)/docs/%.doc: generate_tag
@echo "doxygen doc of $(basename $(notdir $@))"
@export DOXYGEN_INCLUDE_PATH=`echo $(SOLARINC) | sed -e 's/-I\.//g' -e 's/ -I/ /'g -e 's/ -isystem/ /g' -e 's|/usr/[^ ]*| |g'` ; \
$(SRCDIR)/solenv/bin/mkonedoc.sh "$(basename $(notdir $@))" "doc" "$(SRCDIR)" "$(BUILDDIR)/docs"
@touch $@
all: generate_doc
generate_tag: $(foreach m,$(gbuild_modules), $(BUILDDIR)/docs/$(m).tag)
@echo "all tag generated"
generate_doc: $(foreach m,$(gbuild_modules), $(BUILDDIR)/docs/$(m).doc)
@$(SRCDIR)/solenv/bin/mkdoc_portal.sh "$(SRCDIR)" "$(BUILDDIR)/docs"
@echo "Done."
init_doxygen:
@echo "init"
@rm -fr $(BUILDDIR)/docs
@mkdir $(BUILDDIR)/docs

129
solenv/bin/mkdocs_portal.sh Executable file
View File

@@ -0,0 +1,129 @@
#!/bin/bash
SRCDIR="$1"
BASE_OUTPUT="$2"
pushd "$SRCDIR" > /dev/null
function header
{
local title="$1"
local breadcrumb="$2"
local output="$3"
cat - > $output <<EOF
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>$title</title>
<style>
* { margin: 0; padding: 0; }
body { font-family: sans-serif; font-size: 12px; }
#head { padding: 20px; background: #00A500; }
#head a { color: #000; }
#body { padding: 20px; }
#foot { padding: 10px; font-size: 9px; border-top: 1px #18A303 solid; margin-top: 25px; }
p { line-height: 1.7em; margin-bottom: 1em; }
pre { margin-bottom: 0.5em; }
.multi-col { -moz-column-width: 20em; -webkit-column-width: 20em; -moz-column-gap: 1em; -webkit-column-gap: 1em; }
h1 { margin-bottom: 0.5em; }
h2,h3,h4 { margin: 1.3em 0 0.5em 0; }
ul, ol { margin: 0.5em 1.5em; }
</style>
</head>
<body>
<div id="head">
<h1>${title}</h1>
<p>${breadcrumb}</p>
</div>
<div id="body" style="multi-col">
EOF
}
function footer
{
local output="$1"
cat - >> $output <<EOF
</div>
<div id="foot">
<small>
<p>Generated by Libreoffice <a href="http://cgit.freedesktop.org/libreoffice/core/plain/solenv/bin/mkdocs.sh">Module Description Tool</a></p>
<p>Last updated:
EOF
date -f '+%F %T' >> $output
cat - >> $output <<EOF
</p>
</small>
</div>
</body>
</html>
EOF
}
function proc_text
{
# Local links: [[...]]
# Git links: [git:...]
# Other remote links: [...]
# Headings: == bleh ==
# Paragraphs: \n\n
sed -re ' s/\[\[([-_a-zA-Z0-9]+)\]\]/<a href="\1.html">\1<\/a>/g' - \
| sed -re ' s/\[git:([^]]+)\]/<a href="http:\/\/cgit.freedesktop.org\/libreoffice\/core\/tree\/\1">\1<\/a>/g' \
| sed -re ' s/\[([^]]+)\]/<a href="\1">\1<\/a>/g' \
| sed -re ' s/====([^=]+)====/<h4>\1<\/h4>/g' \
| sed -re ' s/===([^=]+)===/<h3>\1<\/h3>/g' \
| sed -re ' s/==([^=]+)==/<h2>\1<\/h2>/g' \
| sed -re ':a;N;$!ba;s/\n\n/<\/p><p>/g' \
| awk 'BEGIN { print "<p>" } { print } END { print "</p>" }'
}
# generate entry page
echo "generating index page"
header "LibreOffice Modules" " " "$BASE_OUTPUT/index.html"
for module_name in *; do
if [ -d $module_name ]; then
cur_file=$(echo $module_name/README* $module_name/readme.txt*)
if [ -f "$cur_file" ]; then
# write index.html entry
text="<h2><a href=\"${module_name}.html\">${module_name}</a></h2>\n"
text="${text}$(head -n1 $cur_file | proc_text )"
echo -e $text >> "$BASE_OUTPUT/index.html"
# write detailed module content
header "$module_name" "<a href=\"index.html\">LibreOffice</a> &raquo; ${module_name}" "$BASE_OUTPUT/${module_name}.html"
text="<p><b>View module in:</b>"
text="${text} &nbsp; <a href=\"http://cgit.freedesktop.org/libreoffice/core/tree/${module_name}\">cgit</a>"
if $(echo $INPUT_PROJECTS | grep -q $module_name); then
text="${text} &nbsp; <a href=\"${module_name}/html/classes.html\">Doxygen</a>"
fi
text="${text} </p><p>&nbsp;</p>"
echo -e $text >> "$BASE_OUTPUT/${module_name}.html"
proc_text < $cur_file >> "$BASE_OUTPUT/${module_name}.html"
footer "$BASE_OUTPUT/${module_name}.html"
else
empty_modules[${#empty_modules[*]}]=$module_name
fi
fi
done
if [ ${#empty_modules[*]} -gt 0 ]; then
echo -e "<p>&nbsp;</p><p>READMEs were not available for these modules:</p><ul>\n" >> "$BASE_OUTPUT/index.html"
for module_name in "${empty_modules[@]}"; do
echo -e "<li><a href=\"http://cgit.freedesktop.org/libreoffice/core/tree/${module_name}\">${module_name}</a></li>\n" >> "$BASE_OUTPUT/index.html"
done
echo -e "</ul>\n" >> "$BASE_OUTPUT/index.html"
fi
footer "$BASE_OUTPUT/index.html"
popd > /dev/null
## done

45
solenv/bin/mkonedoc.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
module="$1"
mode="$2"
SRCDIR="$3"
BASE_OUTPUT="$4"
module_include=""
if [ -d "$module/inc" ]; then
module_include="$module/inc"
fi
if [ -d "include/$module" ]; then
module_include="$module_include include/$module"
fi
DOXYGEN_INPUT=`printf "%s" "$module/source $module_include"`
DOXYGEN_OUTPUT="$BASE_OUTPUT/$module"
DOXYGEN_VERSION="master"
DOXYGEN_PROJECTNAME="LibreOffice Module $module"
if [ "$mode" = "tag" ] ; then
DOXYGEN_OUR_TAGFILE="$DOXYGEN_OUTPUT/$module.tags"
DOXYGEN_REF_TAGFILES=
else
DOXYGEN_OUR_TAGFILE="$DOXYGEN_OUTPUT/$module.tags2"
DOXYGEN_REF_TAGFILES="$(echo $DOXYGEN_REF_TAGFILES | sed -e "s@$DOXYGEN_OUTPUT/$module.tags@@")"
fi
# export variables referenced in doxygen config file
export DOXYGEN_INPUT
export DOXYGEN_OUTPUT
export DOXYGEN_INCLUDE_PATH
export DOXYGEN_VERSION
export DOXYGEN_OUR_TAGFILE
export DOXYGEN_REF_TAGFILES
export DOXYGEN_PROJECTNAME
echo "Calling doxygen mode $mode for $module"
echo "using tagfiles : $DOXYGEN_REF_TAGFILES" >> $BASE_OUTPUT/$module.log 2>&1
doxygen "$SRCDIR/solenv/inc/doxygen_$mode.cfg" >> $BASE_OUTPUT/$module.log 2>&1
echo "$(date "+%F %T") doxygen $module.$mode rc:$?"

2405
solenv/inc/doxygen_doc.cfg Normal file

File diff suppressed because it is too large Load Diff

2405
solenv/inc/doxygen_tag.cfg Normal file

File diff suppressed because it is too large Load Diff