From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2EBFCA051A;
	Fri, 17 Jan 2020 12:25:40 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id D56C31DBA;
	Fri, 17 Jan 2020 12:25:35 +0100 (CET)
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id CEA412AB
 for <dev@dpdk.org>; Fri, 17 Jan 2020 12:25:31 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 17 Jan 2020 03:25:31 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.70,330,1574150400"; d="scan'208";a="220706528"
Received: from silpixa00399126.ir.intel.com ([10.237.222.218])
 by fmsmga008.fm.intel.com with ESMTP; 17 Jan 2020 03:25:30 -0800
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Date: Fri, 17 Jan 2020 11:22:35 +0000
Message-Id: <20200117112236.5225-2-bruce.richardson@intel.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200117112236.5225-1-bruce.richardson@intel.com>
References: <20200117112236.5225-1-bruce.richardson@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 1/2] doc/api: generate dependency file for
	examples doc
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

For the doxygen API for the examples folder, we can generate a build
dependency file when we generate the examples.dox file. This allows
correct rebuilds if the files in examples change.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 doc/api/generate_examples.sh | 4 ++++
 doc/api/meson.build          | 5 ++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/doc/api/generate_examples.sh b/doc/api/generate_examples.sh
index 6fcfe513b..dae7ee0be 100755
--- a/doc/api/generate_examples.sh
+++ b/doc/api/generate_examples.sh
@@ -5,6 +5,10 @@
 EXAMPLES_DIR=$1
 API_EXAMPLES=$2
 
+# generate a .d file including both C files and also build files, so we can
+# detect both file changes and file additions/deletions
+echo "$API_EXAMPLES: $(find ${EXAMPLES_DIR} -type f \( -name '*.c' -o -name 'meson.build' \) -printf '%p ' )" > ${API_EXAMPLES}.d
+
 exec > "${API_EXAMPLES}"
 printf '/**\n'
 printf '@page examples DPDK Example Programs\n\n'
diff --git a/doc/api/meson.build b/doc/api/meson.build
index c72b880e1..899e930fa 100644
--- a/doc/api/meson.build
+++ b/doc/api/meson.build
@@ -15,7 +15,6 @@ generate_doxygen = find_program('generate_doxygen.sh')
 generate_examples = find_program('generate_examples.sh')
 generate_css = find_program('doxy-html-custom.sh')
 
-inputdir = join_paths(meson.source_root(), 'examples')
 htmldir = join_paths('share', 'doc', 'dpdk')
 
 # due to the following bug: https://github.com/mesonbuild/meson/issues/4107
@@ -24,9 +23,9 @@ htmldir = join_paths('share', 'doc', 'dpdk')
 # false it would be impossible to install the docs.
 # So use a configure option for now.
 example = custom_target('examples.dox',
-	input: inputdir,
 	output: 'examples.dox',
-	command: [generate_examples, '@INPUT@', '@OUTPUT@'],
+	command: [generate_examples, join_paths(meson.source_root(), 'examples'), '@OUTPUT@'],
+	depfile: 'examples.dox.d',
 	install: get_option('enable_docs'),
 	install_dir: htmldir,
 	build_by_default: get_option('enable_docs'))
-- 
2.20.1