doc: dynamically generate correct file lists

Instead of the fragile and error prone attempts to specifically
include/exclude files from doxygen by name and pattern, simply use the
already generated .d files to provide accurate and up to date lists of
all source files used.

Pros:
* Nothing left to worry about
* Much more encouraging to actually _work_ on the documentation now that
you can be sure the right docs will be generated instead of a confusing
mix.

Downsides/Upsides:
* Automatically includes all CM3/USB in each device's page _as well_ now

Downsides:
* lpc43xx still manually listed.  However, completely contained in it's
own dir, so no problems
* No attempt to carry this in latex.  easy, but more tempted to drop
latex support outright. (I don't think the generation there has even
worked for a while now)
* Due to the mismatch between lib directories and document roots, the
sourcelist can't be magically created per directory.  There has to be
some sort of mapping between the two, so as this is doc generation only,
a static list seems sane for maintennance.  (Especially compared to the
old method)
* Source list generation probably doesn't work on windows.
This commit is contained in:
Karl Palsson 2017-10-04 22:09:04 +00:00
parent f592e6d54e
commit d002d9552f
25 changed files with 97 additions and 224 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ include/libopencm3/**/nvic.h
include/libopencm3/**/**/nvic.h
lib/**/vector_nvic.c
lib/**/**/vector_nvic.c
doxy.sourcelist
include/libopencmsis/efm32/
include/libopencmsis/lm3s/
include/libopencmsis/lpc13xx/

View File

@ -15,7 +15,7 @@ PDFS := $(ARCHS:=.pdf)
doc: html latex
html: cm3 usb $(ARCHS)
html: rebuildsources cm3 usb $(ARCHS)
doxygen
latex: $(PDFS)
@ -35,5 +35,32 @@ $(ARCHS):
clean:
@rm -rf html/ */html/ */latex/ *.pdf */*.tag
.PHONY: doc html cm3 usb $(ARCHS) latex
rebuildsources:
@printf "Manually regenerating source lists from build deps\n"
../scripts/gendoxylist ../lib/stm32/f0 stm32f0
../scripts/gendoxylist ../lib/stm32/f1 stm32f1
../scripts/gendoxylist ../lib/stm32/f2 stm32f2
../scripts/gendoxylist ../lib/stm32/f3 stm32f3
../scripts/gendoxylist ../lib/stm32/f4 stm32f4
../scripts/gendoxylist ../lib/stm32/f7 stm32f7
../scripts/gendoxylist ../lib/stm32/l0 stm32l0
../scripts/gendoxylist ../lib/stm32/l1 stm32l1
../scripts/gendoxylist ../lib/stm32/l4 stm32l4
../scripts/gendoxylist ../lib/stm32/l4 stm32l4
../scripts/gendoxylist ../lib/efm32/g efm32g
../scripts/gendoxylist ../lib/efm32/gg efm32gg
../scripts/gendoxylist ../lib/efm32/lg efm32lg
../scripts/gendoxylist ../lib/efm32/tg efm32tg
../scripts/gendoxylist ../lib/lm3s lm3s
../scripts/gendoxylist ../lib/lm4f lm4f
../scripts/gendoxylist ../lib/lpc13xx lpc13xx
../scripts/gendoxylist ../lib/lpc17xx lpc17xx
../scripts/gendoxylist ../lib/sam/3a sam3a
../scripts/gendoxylist ../lib/sam/3n sam3n
../scripts/gendoxylist ../lib/sam/3s sam3s
../scripts/gendoxylist ../lib/sam/3u sam3u
../scripts/gendoxylist ../lib/sam/3x sam3x
../scripts/gendoxylist ../lib/vf6xx vf6xx
.PHONY: doc html cm3 usb $(ARCHS) latex rebuildsources

View File

@ -15,11 +15,8 @@
WARN_LOGFILE = doxygen_efm32g.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/efm32/efm32g \
../../lib/efm32/efm32g
EXCLUDE =
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_efm32g.xml

View File

@ -15,11 +15,8 @@
WARN_LOGFILE = doxygen_efm32gg.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/efm32/efm32gg \
../../lib/efm32/efm32gg
EXCLUDE =
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_efm32gg.xml

View File

@ -15,11 +15,8 @@
WARN_LOGFILE = doxygen_efm32lg.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/efm32/efm32lg \
../../lib/efm32/efm32lg
EXCLUDE =
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_efm32lg.xml

View File

@ -15,11 +15,8 @@
WARN_LOGFILE = doxygen_efm32tg.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/efm32/efm32tg \
../../lib/efm32/efm32tg
EXCLUDE =
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_efm32tg.xml

View File

@ -15,9 +15,8 @@
WARN_LOGFILE = doxygen_lm3s.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/lm3s \
../../lib/lm3s
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_lm3s.xml

View File

@ -15,9 +15,8 @@
WARN_LOGFILE = doxygen_lm4f.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/lm4f \
../../lib/lm4f
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_lm4f.xml

View File

@ -15,9 +15,8 @@
WARN_LOGFILE = doxygen_lpc13xx.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/lpc13xx \
../../lib/lpc13xx
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_lpc13xx.xml

View File

@ -15,9 +15,9 @@
WARN_LOGFILE = doxygen_lpc43xx.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/lpc43xx \
../../lib/lpc43xx
INPUT = ../../include/libopencm3/license.dox
INPUT += ../../include/libopencm3/lpc43xx
INPUT += ../../lib/lpc43xx
LAYOUT_FILE = DoxygenLayout_lpc43xx.xml

View File

@ -17,16 +17,8 @@
WARN_LOGFILE = doxygen_sam3a.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/sam/3a \
../../include/libopencm3/sam/common
INPUT += ../../lib/sam/3a \
../../lib/sam/common
EXCLUDE =
EXCLUDE_PATTERNS = *_common_3n3s.h
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_sam3a.xml

View File

@ -17,16 +17,8 @@
WARN_LOGFILE = doxygen_sam3n.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/sam/3n \
../../include/libopencm3/sam/common
INPUT += ../../lib/sam/3n \
../../lib/sam/common
EXCLUDE =
EXCLUDE_PATTERNS = *_common_3a3u3x.h
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_sam3n.xml

View File

@ -17,16 +17,8 @@
WARN_LOGFILE = doxygen_sam3s.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/sam/3s \
../../include/libopencm3/sam/common
INPUT += ../../lib/sam/3a \
../../lib/sam/common
EXCLUDE =
EXCLUDE_PATTERNS = *_common_3a3u3x.h
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_sam3s.xml

View File

@ -17,16 +17,8 @@
WARN_LOGFILE = doxygen_sam3u.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/sam/3u \
../../include/libopencm3/sam/common
INPUT += ../../lib/sam/3u \
../../lib/sam/common
EXCLUDE =
EXCLUDE_PATTERNS = *_common_3n3s.h
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_sam3u.xml

View File

@ -17,16 +17,8 @@
WARN_LOGFILE = doxygen_sam3x.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/sam/3x \
../../include/libopencm3/sam/common
INPUT += ../../lib/sam/3x \
../../lib/sam/common
EXCLUDE =
EXCLUDE_PATTERNS = *_common_3n3s.h
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_sam3x.xml

View File

@ -1,4 +1,4 @@
# HTML Documentation for STM32F1 code level
# HTML Documentation for STM32F0 code level
# 14 September 2012
# (C) Ken Sarkies <ksarkies@internode.on.net>
@ -15,19 +15,8 @@
WARN_LOGFILE = doxygen_stm32f0.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/stm32/f0 \
../../include/libopencm3/stm32/common
INPUT += ../../lib/stm32/f0 \
../../lib/stm32/common
EXCLUDE = ../../include/libopencm3/stm32/f0/usb.h \
../../include/libopencm3/stm32/f0/usb_desc.h
EXCLUDE_PATTERNS = *_common_*f24.h *_common_*f24.c \
*_common_*f234.h *_common_*f234.c \
*_common_*f124.h *_common_*f124.c
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_stm32f0.xml

View File

@ -15,27 +15,8 @@
WARN_LOGFILE = doxygen_stm32f1.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/stm32/f1 \
../../include/libopencm3/stm32/common
INPUT += ../../lib/stm32/f1 \
../../lib/stm32/common
EXCLUDE = ../../include/libopencm3/stm32/f1/usb.h \
../../include/libopencm3/stm32/f1/usb_desc.h \
../../include/libopencm3/stm32/common/crs_common_all.h
EXCLUDE += ../../lib/stm32/common/crs_common_all.c \
../../lib/stm32/common/rtc_common_l1f024.c \
../../lib/stm32/common/
EXCLUDE_PATTERNS = *_common_*f24.h *_common_*f24.c \
*_common_*f234.h *_common_*f234.c \
*_common_*f0234.h *_common_*f0234.c \
*_common_*f024.h *_common_*f024.c \
*_common_*f03.h *_common_*f03.c \
*_common_l01.h _common_l01.c
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_stm32f1.xml

View File

@ -15,20 +15,8 @@
WARN_LOGFILE = doxygen_stm32f2.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/stm32/f2 \
../../include/libopencm3/stm32/common
INPUT += ../../lib/stm32/f2 \
../../lib/stm32/common
EXCLUDE =
EXCLUDE_PATTERNS = *_common_f13.h *_common_f13.c \
*_common_*f013.h *_common_*f013.c \
*_common_*f01.h *_common_*f01.c \
*_common_*f03.h *_common_*f03.c \
*crs_common_all.[ch]
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_stm32f2.xml

View File

@ -12,22 +12,8 @@
WARN_LOGFILE = doxygen_stm32f3.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/stm32/f3 \
../../include/libopencm3/stm32/common
INPUT += ../../lib/stm32/f3 \
../../lib/stm32/common
EXCLUDE = ../../include/libopencm3/stm32/f3/usb.h \
../../include/libopencm3/stm32/f3/usb_desc.h
EXCLUDE_PATTERNS = *_common_*f*24.h *_common_*f*24.c \
*_common_*f01.h *_common_*f01.c \
*_common_bcd.h *_common_bcd.c \
*crs_common_all.[ch]
EXCLUDE_PATTERNS += *adc_common_v1* *adc_common_v2_single*
EXCLUDE_PATTERNS += *pwr_common_l01.*
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_stm32f3.xml

View File

@ -15,20 +15,8 @@
WARN_LOGFILE = doxygen_stm32f4.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/stm32/f4 \
../../include/libopencm3/stm32/common
INPUT += ../../lib/stm32/f4 \
../../lib/stm32/common
EXCLUDE =
EXCLUDE_PATTERNS = *_common_f*3.h *_common_f*3.c \
*_common_*f013.h *_common_*f013.c \
*_common_*f01.h *_common_*f01.c \ \
*_common_*f03.h *_common_*f03.c \
*crs_common_all.[ch]
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_stm32f4.xml

View File

@ -15,20 +15,8 @@
WARN_LOGFILE = doxygen_stm32f7.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/stm32/f7 \
../../include/libopencm3/stm32/common
INPUT += ../../lib/stm32/f7 \
../../lib/stm32/common
EXCLUDE =
EXCLUDE_PATTERNS = *_common_f*3.h *_common_f*3.c \
*_common_*f013.h *_common_*f013.c \
*_common_*f01.h *_common_*f01.c \ \
*_common_*f03.h *_common_*f03.c
EXCLUDE_PATTERNS += pwr_common_v1.* pwr_common_v2.*
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_stm32f7.xml

View File

@ -16,23 +16,7 @@
WARN_LOGFILE = doxygen_stm32l0.log
INPUT = ../../include/libopencm3/license.dox
INPUT +=../../include/libopencm3/stm32/l0
INPUT +=../../include/libopencm3/stm32/common
INPUT +=../../lib/stm32/l0
INPUT +=../../lib/stm32/common
EXCLUDE = ../../include/libopencm3/stm32/common/gpio_common_f24.h
EXCLUDE +=../../include/libopencm3/stm32/common/timer_common_f24.h \
EXCLUDE +=../../include/libopencm3/stm32/common/crypto_common_f24.h \
EXCLUDE +=../../include/libopencm3/stm32/common/hash_common_f24.h
EXCLUDE =../../lib/stm32/common/gpio_common_f24.c
EXCLUDE =../../lib/stm32/common/timer_common_f24.c
EXCLUDE =../../lib/stm32/common/crypto_common_f24.c
EXCLUDE =../../lib/stm32/common/hash_common_f24.c
EXCLUDE_PATTERNS =
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_stm32l0.xml

View File

@ -15,29 +15,8 @@
WARN_LOGFILE = doxygen_stm32l1.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/stm32/l1 \
../../include/libopencm3/stm32/common
INPUT += ../../lib/stm32/l1 \
../../lib/stm32/common
EXCLUDE = ../../include/libopencm3/stm32/common/gpio_common_f24.h \
../../include/libopencm3/stm32/common/gpio_common_f234.h \
../../include/libopencm3/stm32/common/timer_common_f24.h \
../../include/libopencm3/stm32/common/crypto_common_f24.h \
../../include/libopencm3/stm32/common/hash_common_f24.h \
../../include/libopencm3/stm32/common/crs_common_all.h
EXCLUDE += ../../lib/stm32/common/gpio_common_f24.c \
../../lib/stm32/common/timer_common_f24.c \
../../lib/stm32/common/crypto_common_f24.c \
../../lib/stm32/common/hash_common_f24.c \
../../lib/stm32/common/crs_common_all.c
EXCLUDE_PATTERNS = *common/flash_common_f*.*
EXCLUDE_PATTERNS += *common/adc_common_v2*
EXCLUDE_PATTERNS += *common/spi_common_f03.*
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_stm32l1.xml

View File

@ -15,12 +15,8 @@
WARN_LOGFILE = doxygen_vf6xx.log
INPUT = ../../include/libopencm3/license.dox \
../../include/libopencm3/vf6xx
INPUT += ../../lib/vf6xx
EXCLUDE =
INPUT = ../../include/libopencm3/license.dox
@INCLUDE = doxy.sourcelist
LAYOUT_FILE = DoxygenLayout_vf6xx.xml

21
scripts/gendoxylist Executable file
View File

@ -0,0 +1,21 @@
#!/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.
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}