forked from ARM-software/CMSIS-DSP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_doc.sh
67 lines (54 loc) · 1.79 KB
/
gen_doc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Version: 1.0
# Date: 2022-05-31
# This bash script generates CMSIS-NN Documentation:
#
# Pre-requisites:
# - bash shell (for Windows: install git for Windows)
# - doxygen 1.9.2
set -o pipefail
DIRNAME=$(dirname $(readlink -f $0))
DOXYGEN=$(which doxygen)
DESCRIBE=$(readlink -f ${DIRNAME}/../Scripts/git/git_describe.sh)
CHANGELOG=$(readlink -f ${DIRNAME}/../Scripts/git/gen_changelog.sh)
if [[ ! -f "${DOXYGEN}" ]]; then
echo "Doxygen not found!" >&2
echo "Did you miss to add it to PATH?"
exit 1
else
version=$("${DOXYGEN}" --version)
echo "DOXYGEN is ${DOXYGEN} at version ${version}"
if [[ "${version}" != "1.9.2" ]]; then
echo " >> Version is different from 1.9.2 !" >&2
fi
fi
if [ -z $VERSION ]; then
VERSION_FULL=$(/bin/bash ${DESCRIBE} "v")
VERSION=${VERSION_FULL%+*}
fi
echo "Generating documentation ..."
pushd $DIRNAME > /dev/null
rm -rf ${DIRNAME}/../Documentation/html
sed -e "s/{projectNumber}/${VERSION}/" "${DIRNAME}/dsp.dxy.in" \
> "${DIRNAME}/dsp.dxy"
echo "${CHANGELOG} -f html > history.txt"
/bin/bash "${CHANGELOG}" -f html 1> history.txt 2>/dev/null
echo "${DOXYGEN} dsp.dxy"
"${DOXYGEN}" dsp.dxy
popd > /dev/null
if [[ $2 != 0 ]]; then
cp -f "${DIRNAME}/templates/search.css" "${DIRNAME}/../Documentation/html/search/"
fi
projectName=$(grep -E "PROJECT_NAME\s+=" "${DIRNAME}/dsp.dxy" | sed -r -e 's/[^"]*"([^"]+)"/\1/')
datetime=$(date -u +'%a %b %e %Y %H:%M:%S')
year=$(date -u +'%Y')
if [[ "${year}" != "2022" ]]; then
year="2022-${year}"
fi
sed -e "s/{datetime}/${datetime}/" "${DIRNAME}/templates/footer.js.in" \
| sed -e "s/{year}/${year}/" \
| sed -e "s/{projectName}/${projectName}/" \
| sed -e "s/{projectNumber}/${VERSION}/" \
| sed -e "s/{projectNumberFull}/${VERSION_FULL}/" \
> "${DIRNAME}/../Documentation/html/footer.js"
exit 0