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 9if [ "$(uname)" = "FreeBSD" ] ; then 10# on FreeBSD, we need GNU find for "-printf" flag 11 FIND=gfind 12 if ! which -s $FIND ; then 13 echo "Error: need '$FIND' on FreeBSD. Install 'findutils' pkg" 14 exit 1 15 fi 16fi 17 18# generate a .d file including both C files and also build files, so we can 19# detect both file changes and file additions/deletions 20echo "$API_EXAMPLES: $($FIND ${EXAMPLES_DIR} -type f \( -name '*.c' -o -name 'meson.build' \) -printf '%p ' )" > ${API_EXAMPLES}.d 21 22exec > "${API_EXAMPLES}" 23printf '/**\n' 24printf '@page examples DPDK Example Programs\n\n' 25$FIND "${EXAMPLES_DIR}" -type f -name '*.c' -printf '@example examples/%P\n' | LC_ALL=C sort 26printf '*/\n' 27