#!/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 PATH_DELTA=$(realpath --relative-to=${ODIR} ${DDIR}) printf "# This file is autogenerated by scripts/gendoxylist\n" > ${ODIR}/${ONAME} printf "# Documentation only header, not caught by .d file tracking" >> ${ODIR}/${ONAME} FN=$(find ../include/libopencm3/ -name doc-$(basename ${ODIR}).h) printf "INPUT += ../%s\n" "$FN" > ${ODIR}/${ONAME} 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}