#!/bin/sh # Karl Palsson Sept 2017 # Parse .d files for a given target, and generate a doxygen config file # stub that is to be "@INCLUDE = " into a doxygen template file. 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 platform, not always caught by .d file tracking\n" >> ${ODIR}/${ONAME} for FN in $(find ../include/libopencm3/${IPATH} -name '*.h'); 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}