xref: /dpdk/doc/api/generate_examples.sh (revision fee17a1d)
1#! /bin/sh -e
2# SPDX-License-Identifier: BSD-3-Clause
3# Copyright 2018 Luca Boccassi <[email protected]>
4
5EXAMPLES_DIR=$1
6API_EXAMPLES=$2
7
8FIND=find
9
10# generate a .d file including both C files and also build files, so we can
11# detect both file changes and file additions/deletions
12echo "$API_EXAMPLES: $($FIND ${EXAMPLES_DIR} -type f \( -name '*.c' -o -name 'meson.build' \) | tr '\n' ' ' )" > ${API_EXAMPLES}.d
13
14exec > "${API_EXAMPLES}"
15printf '/**\n'
16printf '@page examples DPDK Example Programs\n\n'
17$FIND "${EXAMPLES_DIR}" -type f -name '*.c' |
18	sed "s|${EXAMPLES_DIR}|@example examples|" |
19	LC_ALL=C sort
20printf '*/\n'
21