#!/bin/bash
#
#******************************************************************************
# make-helper (generic)
#------------------------------------------------------------------------------
##
# \file       	make-helper
# \library    	libseq66 directory
# \author     	Chris Ahlstrom
# \date       	2019-05-11
# \update     	2020-10-02
# \version    	$Revision$
# \license    	$XPC_SUITE_GPL_LICENSE$
#
#     This file creates the doxygen documentation for the $TARGET
#     subdirectory.
#
#------------------------------------------------------------------------------

DOXLOGFILE="dox-build-$1.log"
TARGET="$1"

cat << E_O_F > $DOXLOGFILE
Running Doxygen on the $TARGET target, in the make-helper script.
$ doxygen $TARGET.cfg &> $DOXLOGFILE

E_O_F

doxygen $TARGET.cfg &>> $DOXLOGFILE

# sed -e 's/letterpaper,/letterpaper,margin=2cm,/' -i latex/refman.tex

cat << E_O_F >> $DOXLOGFILE

The PDF build breaks too easily, so now we descend and run the commands a few
times.

make --directory=latex pdf

E_O_F

make --directory=latex pdf &>> $DOXLOGFILE

# Optimize the PDF to cut down on its size.

cat << E_O_F >> $DOXLOGFILE

../optimize seq66_$TARGET >> dox-progress.log 2>> dox-errors.log
cp latex/refman.pdf seq66_$TARGET.pdf

E_O_F

mv latex/refman.pdf seq66_lib_$TARGET.pdf

#******************************************************************************
# make-helper (generic)
#------------------------------------------------------------------------------
# vim: ts=3 sw=3 et ft=sh
#------------------------------------------------------------------------------
