stm32f4-nucleo-test/libopencm3/scripts/gendoxylist
Arti Zirk 2de3a91b0a git subrepo clone https://github.com/libopencm3/libopencm3.git
subrepo:
  subdir:   "libopencm3"
  merged:   "88e91c9a7cce"
upstream:
  origin:   "https://github.com/libopencm3/libopencm3.git"
  branch:   "master"
  commit:   "88e91c9a7cce"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2023-01-21 18:31:08 +02:00

30 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Karl Palsson <karlp@tweak.net.au> Sept 2017
# Parse .d files for a given target, and generate a doxygen config file
# stub that is to be "@INCLUDE = <xxx>" into a doxygen template file.
[ $# -eq 2 ] || {
printf "Usage: $0 <libdir> <outputdir>\n"
exit 1
}
DDIR=$1
ODIR=$2
ONAME=doxy.sourcelist
IPATH=$(echo ${DDIR} | sed -e 's#../lib/##')
PATH_DELTA=$(realpath --relative-to=${ODIR} ${DDIR})
printf "# This file is autogenerated by scripts/gendoxylist\n" > ${ODIR}/${ONAME}
printf "# All headers for core/platform, not always caught by .d file tracking\n" >> ${ODIR}/${ONAME}
UNTRACKED_DIRS="../include/libopencm3/cm3 ../include/libopencm3/${IPATH}"
for FN in $(find ${UNTRACKED_DIRS} -name '*.h' | sort); do
printf "INPUT += ../%s\n" "$FN" >> ${ODIR}/${ONAME}
done
# There will be duplicates here, but doxygen doesn't mind.
printf "# Headers first\n" >> ${ODIR}/${ONAME}
grep -o '[^ ]*.h' ${DDIR}/*.d | grep 'include/libopencm3' | cut -d ':' -f2 | sort | uniq | sed "s#^#INPUT += ${PATH_DELTA}/#" >> ${ODIR}/${ONAME}
printf "# Now sources\n" >> ${ODIR}/${ONAME}
grep -o '[^ ]*\.c' ${DDIR}/*.d | cut -d ':' -f 2 | sort | uniq | sed "s#^#INPUT += $PATH_DELTA/#" >> ${ODIR}/${ONAME}