Files
mbedtls/scripts/crypto-common.make
Gilles Peskine e3e4da61a8 Use intermediate variables for TF-PSA-Crypto's contribution to LOCAL_CFLAGS
Define these intermediate variables in the crypto helper file.

No behavior change except possibly an inconsequential reordering of compiler
options.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-07 11:17:43 +01:00

48 lines
2.1 KiB
Makefile

# Helper code for the make build system in Mbed TLS: define some variables
# providing information such as file paths.
# This file is only meant to exist for a short transition period.
# It may change or be removed without notice.
# Do not use it if you are not Mbed TLS!
# Assume that this makefile is located in a first-level subdirectory of the
# Mbed TLS root, and is accessed directly (not via VPATH or such).
# If this is not the case, TF_PSA_CRYPTO_PATH or MBEDTLS_PATH must be defined
# before including this file.
ifneq ($(origin TF_PSA_CRYPTO_PATH), undefined)
# TF_PSA_CRYPTO_PATH was defined before including this file, good.
else ifneq ($(origin MBEDTLS_PATH), undefined)
TF_PSA_CRYPTO_PATH := $(MBEDTLS_PATH)/tf-psa-crypto
else
# $(dir $(lastword $(MAKEFILE_LIST))) is the path to this file, possibly
# a relative path, with a trailing slash. Strip off another directory
# from that.
TF_PSA_CRYPTO_PATH := $(patsubst %/,%,$(dir $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))))/tf-psa-crypto
endif
ifeq (,$(wildcard $(TF_PSA_CRYPTO_PATH)/core/psa_crypto.c))
$(error $$(TF_PSA_CRYPTO_PATH)/core/psa_crypto.c not found)
endif
TF_PSA_CRYPTO_CORE_PATH = $(MBEDTLS_PATH)/tf-psa-crypto/core
TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH = $(MBEDTLS_PATH)/tf-psa-crypto/drivers/builtin/src
# Gather information about crypto drivers that are separate from the main
# "builtin" driver (historically located in /3rdparty in Mbed TLS 2.x/3.x).
THIRDPARTY_DIR := $(TF_PSA_CRYPTO_PATH)/drivers
THIRDPARTY_INCLUDES =
include $(TF_PSA_CRYPTO_PATH)/drivers/everest/Makefile.inc
include $(TF_PSA_CRYPTO_PATH)/drivers/p256-m/Makefile.inc
# Directories with headers of public interfaces of TF-PSA-Crypto
TF_PSA_CRYPTO_LIBRARY_PUBLIC_INCLUDE = \
-I$(TF_PSA_CRYPTO_PATH)/include \
-I$(TF_PSA_CRYPTO_PATH)/drivers/builtin/include \
$(THIRDPARTY_INCLUDES)
# Directories with headers of internal interfaces of TF-PSA-Crypto
# (currently consumed by Mbed TLS, eventually not so when we've finished
# cleaning up)
TF_PSA_CRYPTO_LIBRARY_PRIVATE_INCLUDE = \
-I$(TF_PSA_CRYPTO_PATH)/core \
-I$(TF_PSA_CRYPTO_PATH)/drivers/builtin/src