From 841c83cf64b0bbca0b4ef9b6359ba5c9228231ad Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson@intel.com>
Date: Fri, 17 Jan 2020 11:22:36 +0000
Subject: [PATCH] doc: add dependency on header files for API doxygen

Generate a dependency file for the header files used in the API guide
so that the docs can be rebuilt if a header changes.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
 doc/api/generate_doxygen.sh | 5 ++++-
 doc/api/meson.build         | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/api/generate_doxygen.sh b/doc/api/generate_doxygen.sh
index ab57660958..ee509e8961 100755
--- a/doc/api/generate_doxygen.sh
+++ b/doc/api/generate_doxygen.sh
@@ -6,5 +6,8 @@ DOXYCONF=$1
 OUTDIR=$2
 SCRIPTCSS=$3
 
-doxygen "${DOXYCONF}"
+# run doxygen, capturing all the header files it processed
+doxygen "${DOXYCONF}" | tee doxygen.out
+echo "$OUTDIR: $(awk '/Preprocessing/ {printf("%s ", substr($2, 1, length($2) - 3))}' doxygen.out)" > $OUTDIR.d
+
 "${SCRIPTCSS}" "${OUTDIR}"/doxygen.css
diff --git a/doc/api/meson.build b/doc/api/meson.build
index 899e930fa6..49d5b9a153 100644
--- a/doc/api/meson.build
+++ b/doc/api/meson.build
@@ -15,7 +15,7 @@ generate_doxygen = find_program('generate_doxygen.sh')
 generate_examples = find_program('generate_examples.sh')
 generate_css = find_program('doxy-html-custom.sh')
 
-htmldir = join_paths('share', 'doc', 'dpdk')
+htmldir = join_paths(get_option('datadir'), 'doc', 'dpdk')
 
 # due to the following bug: https://github.com/mesonbuild/meson/issues/4107
 # if install is set to true it will override build_by_default and it will
@@ -46,6 +46,7 @@ doxy_build = custom_target('doxygen',
 	depends: example,
 	input: doxy_conf,
 	output: 'api',
+	depfile: 'api.d',
 	command: [generate_doxygen, '@INPUT@', '@OUTPUT@', generate_css],
 	install: get_option('enable_docs'),
 	install_dir: htmldir,
-- 
2.39.5