blob: 902a515c69ee68fe38e34197519fa36d936ee437 [file] [log] [blame]
Minos Galanakis2c824b42025-03-20 09:28:45 +00001#!/bin/sh
2
3# Generate doxygen documentation with a full mbedtls_config.h (this ensures that every
4# available flag is documented, and avoids warnings about documentation
5# without a corresponding #define).
6#
7# /!\ This must not be a Makefile target, as it would create a race condition
8# when multiple targets are invoked in the same parallel build.
9#
10# Copyright The Mbed TLS Contributors
11# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
12
13set -eu
14
15. $(dirname "$0")/project_detection.sh
16
17if in_mbedtls_repo; then
18 CONFIG_H='include/mbedtls/mbedtls_config.h'
19 if [ -r $CONFIG_H ]; then :; else
20 echo "$CONFIG_H not found" >&2
21 fi
22 if ! in_3_6_branch; then
23 CRYPTO_CONFIG_H='tf-psa-crypto/include/psa/crypto_config.h'
24 fi
25fi
26
27if in_tf_psa_crypto_repo; then
28 CRYPTO_CONFIG_H='include/psa/crypto_config.h'
29fi
30
31if in_tf_psa_crypto_repo || (in_mbedtls_repo && ! in_3_6_branch); then
32 if [ -r $CRYPTO_CONFIG_H ]; then :; else
33 echo "$CRYPTO_CONFIG_H not found" >&2
34 exit 1
35 fi
36 CRYPTO_CONFIG_BAK=${CRYPTO_CONFIG_H}.bak
37 cp -p $CRYPTO_CONFIG_H $CRYPTO_CONFIG_BAK
38fi
39
40if in_mbedtls_repo; then
41 CONFIG_BAK=${CONFIG_H}.bak
42 cp -p $CONFIG_H $CONFIG_BAK
43 scripts/config.py realfull
44 make apidoc
45 mv $CONFIG_BAK $CONFIG_H
46elif in_tf_psa_crypto_repo; then
47 scripts/config.py realfull
48 TF_PSA_CRYPTO_ROOT_DIR=$PWD
49 rm -rf doxygen/build-apidoc-full
50 mkdir doxygen/build-apidoc-full
51 cd doxygen/build-apidoc-full
52 cmake -DCMAKE_BUILD_TYPE:String=Check -DGEN_FILES=ON $TF_PSA_CRYPTO_ROOT_DIR
53 make tfpsacrypto-apidoc
54 cd $TF_PSA_CRYPTO_ROOT_DIR
55fi
56
57if in_tf_psa_crypto_repo || (in_mbedtls_repo && ! in_3_6_branch); then
58 mv $CRYPTO_CONFIG_BAK $CRYPTO_CONFIG_H
59fi