4 # This bash script generates CSMSIS Driver Verification documentation
7 # - bash shell (for Windows: install git for Windows)
13 DIRNAME=$(dirname $(readlink -f $0))
14 DOXYGEN=$(which doxygen 2>/dev/null)
15 REQ_DXY_VERSION="1.9.2"
17 ALLPARTS=($(find ${DIRNAME} -mindepth 1 -maxdepth 1 -type d -exec basename {} \;))
20 if [[ -z "$*" ]]; then
24 if [[ " ${ALLPARTS[@]} " =~ " $part " ]]; then
30 if [[ ! -f "${DOXYGEN}" ]]; then
31 echo "Doxygen not found!" >&2
32 echo "Did you miss to add it to PATH?"
35 version=$("${DOXYGEN}" --version | sed -E 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
36 echo "Doxygen is ${DOXYGEN} at version ${version}"
37 if [[ "${version}" != "${REQ_DXY_VERSION}" ]]; then
38 echo "Doxygen required to be at version ${REQ_DXY_VERSION}!" >&2
44 partname=$(basename $(dirname $1))
45 if [[ $REGEN != 0 ]] || [[ " ${PARTS[@]} " =~ " ${partname} " ]]; then
46 pushd "$(dirname $1)" > /dev/null
48 "${DOXYGEN}" $(basename "$1")
51 if [[ $2 != 0 ]]; then
52 # use with $partname in path for complex multi-folder projects
53 #mkdir -p "${DIRNAME}/../Documentation/html/search/"
54 #cp -f "${DIRNAME}/templates/search.css" "${DIRNAME}/../Documentation/html/search/"
55 mkdir -p "${DIRNAME}/../Documentation/html/search/"
56 cp -f "${DIRNAME}/templates/search.css" "${DIRNAME}/../Documentation/html/search/"
59 projectName=$(grep -E "PROJECT_NAME\s+=" $1 | sed -r -e 's/[^"]*"([^"]+)".*/\1/')
60 projectNumber=$(grep -E "PROJECT_NUMBER\s+=" $1 | sed -r -e 's/[^"]*"([^"]+)".*/\1/')
61 datetime=$(date -u +'%a %b %e %Y %H:%M:%S')
62 sed -e "s/{datetime}/${datetime}/" "${DIRNAME}/templates/footer.js" \
63 | sed -e "s/{projectName}/${projectName}/" \
64 | sed -e "s/{projectNumber}/${projectNumber}/" \
65 > "${DIRNAME}/../Documentation/html/footer.js"
69 if [[ $REGEN != 0 ]]; then
70 echo "Cleaning existing documentation ..."
71 find "${DIRNAME}/../Documentation/" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} +
74 echo "Generating documentation ..."
75 doxygen "${DIRNAME}/CMSIS_DV.dxy" 1