Added isntall flag, improved pathing for using doxygen to generate documentation

This commit is contained in:
connerwolfssl
2018-03-08 10:53:44 -07:00
parent 9e6b9a3793
commit 0535a8a68a
2 changed files with 52 additions and 13 deletions

View File

@ -1,4 +1,12 @@
#!/bin/sh #!/bin/bash
POSIXLY_CORRECT=1
CHECK_API=false
GEN_HTML=false
GEN_PDF=false
GEN_ALL=false
INSTALL_DOX=false
command -v g++ command -v g++
if [ $? -ne "0" ]; then if [ $? -ne "0" ]; then
@ -24,14 +32,34 @@ echo "Please install make"
exit 1 exit 1
fi fi
./check_api.sh # Checking arguments and setting appropriate option variables
if [ $? = 1 ]; then for var in $@
echo "Not all API match" do
exit 1 case $var in
fi -install)
INSTALL_DOX=true
;;
-html)
CHECK_API=true
GEN_HTML=true
;;
-pdf)
CHECK_API=true
GEN_PDF=true
;;
-all)
CHECK_API=true
GEN_ALL=true
;;
esac
done
if [ ! -e "build/bin/doxygen" ]; then # Checking if doxygen is already installed
# True - doxygen from "which doxygen" is used to generate documentation
# False - clones doxygen Release_1_8_13 and ./build/bin/ added to PATH
if [ $INSTALL_DOX = true ] && [ ! "$(which doxygen)" ]; then
mkdir -p build mkdir -p build
cd build cd build
echo "cloning doxygen 1.8.13..." echo "cloning doxygen 1.8.13..."
@ -39,13 +67,24 @@ git clone https://github.com/doxygen/doxygen --branch Release_1_8_13
cmake -G "Unix Makefiles" doxygen/ cmake -G "Unix Makefiles" doxygen/
make make
cd .. cd ..
export PATH="./build/bin/:$PATH"
fi
# Runs script to check that all API with documentation match wolfSSL API
if [ $CHECK_API = true ]; then
./check_api.sh
fi
if [ $? = 1 ]; then
echo "Not all API match"
exit 1
fi fi
if [ $1 = "-html" ] || [ $1 = "-all" ]; then
#HTML GENERATION #HTML GENERATION
if [ $GEN_HTML = true ] || [ $GEN_ALL = true ]; then
cp -r formats/html/* ./ cp -r formats/html/* ./
echo "generating html..." echo "generating html..."
build/bin/doxygen Doxyfile doxygen Doxyfile
cp html_changes/search/* html/search/ cp html_changes/search/* html/search/
cp html_changes/*.css html/ cp html_changes/*.css html/
cp html_changes/*.js html/ cp html_changes/*.js html/
@ -58,10 +97,10 @@ echo "To view the html files use a browser to open the index.html file located a
fi fi
#PDF GENERATION #PDF GENERATION
if [ $1 = "-pdf" ] || [ $1 = "-all" ]; then if [ $GEN_PDF = true ] || [ $GEN_ALL = true ]; then
cp -r formats/pdf/* ./ cp -r formats/pdf/* ./
echo "generating pdf..." echo "generating pdf..."
build/bin/doxygen Doxyfile doxygen Doxyfile
cd latex/ cd latex/
make make
mv refman.pdf ../ mv refman.pdf ../

View File

@ -6,11 +6,11 @@ dist_doc_DATA+= doc/README.txt
dox-pdf: dox-pdf:
echo "Generating PDF" echo "Generating PDF"
cd doc && ./generate_documentation.sh -pdf || (echo "HTML generation failed $$?"; exit 1) cd doc && ./generate_documentation.sh -install -pdf || (echo "HTML generation failed $$?"; exit 1)
dox-html: dox-html:
echo "Generating HTML" echo "Generating HTML"
cd doc && ./generate_documentation.sh -html || (echo "HTML generation failed $$?"; exit 1) cd doc && ./generate_documentation.sh -install -html || (echo "HTML generation failed $$?"; exit 1)
dox: dox-html dox-pdf dox: dox-html dox-pdf