2024-05-29 11:36:09 +00:00
|
|
|
MAIN ?= src/client.c
|
2024-05-29 09:29:39 +00:00
|
|
|
|
2024-05-09 07:15:39 +00:00
|
|
|
CFLAGS += -Wall -Werror -std=c99 -D_XOPEN_SOURCE=1 -D_POSIX_C_SOURCE=200809L
|
2024-05-03 15:28:04 +00:00
|
|
|
|
|
|
|
ifeq ($(DEBUG),1)
|
2024-05-10 13:53:40 +00:00
|
|
|
CFLAGS += -DDEBUG -O0 -g
|
2024-05-03 15:28:04 +00:00
|
|
|
endif
|
|
|
|
|
2024-05-10 09:21:04 +00:00
|
|
|
LIBPSACLIENT := -Llibpsaclient/ -lmbedcrypto -lmbedx509 -lmbedtls
|
|
|
|
LIBPSASERVER := -Llibpsaserver/ -lmbedcrypto
|
2024-05-03 15:28:04 +00:00
|
|
|
|
2024-05-10 09:21:04 +00:00
|
|
|
MBEDTLS_ROOT_PATH = ../../..
|
|
|
|
COMMON_INCLUDE := -I./include -I$(MBEDTLS_ROOT_PATH)/include
|
2024-05-10 04:51:16 +00:00
|
|
|
|
|
|
|
TEST_BIN = test/psa_client \
|
|
|
|
test/psa_partition
|
|
|
|
|
|
|
|
GENERATED_H_FILES = include/psa_manifest/manifest.h \
|
|
|
|
include/psa_manifest/pid.h \
|
|
|
|
include/psa_manifest/sid.h
|
|
|
|
|
|
|
|
PSA_CLIENT_SRC = src/psa_ff_client.c \
|
2024-05-29 11:36:09 +00:00
|
|
|
$(MAIN) \
|
2024-05-29 09:29:39 +00:00
|
|
|
src/psa_sim_crypto_client.c \
|
|
|
|
src/psa_sim_serialise.c
|
2024-05-10 04:51:16 +00:00
|
|
|
|
|
|
|
PARTITION_SERVER_BOOTSTRAP = src/psa_ff_bootstrap_TEST_PARTITION.c
|
|
|
|
|
|
|
|
PSA_SERVER_SRC = $(PARTITION_SERVER_BOOTSTRAP) \
|
2024-05-29 09:29:39 +00:00
|
|
|
src/psa_ff_server.c \
|
|
|
|
src/psa_sim_crypto_server.c \
|
|
|
|
src/psa_sim_serialise.c
|
2024-05-10 04:51:16 +00:00
|
|
|
|
2024-05-10 09:21:04 +00:00
|
|
|
.PHONY: all clean libpsaclient libpsaserver
|
2024-05-10 04:51:16 +00:00
|
|
|
|
|
|
|
all: $(TEST_BIN)
|
|
|
|
|
2024-05-14 08:57:35 +00:00
|
|
|
test/seedfile:
|
|
|
|
dd if=/dev/urandom of=./test/seedfile bs=64 count=1
|
|
|
|
|
2024-05-10 04:51:16 +00:00
|
|
|
test/psa_client: $(PSA_CLIENT_SRC) $(GENERATED_H_FILES)
|
2024-06-11 08:53:53 +00:00
|
|
|
$(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_CLIENT_SRC) $(LIBPSACLIENT) $(LDFLAGS) -o $@
|
2024-05-10 04:51:16 +00:00
|
|
|
|
2024-05-14 08:57:35 +00:00
|
|
|
test/psa_partition: $(PSA_SERVER_SRC) $(GENERATED_H_FILES) test/seedfile
|
2024-05-10 09:21:04 +00:00
|
|
|
$(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_SERVER_SRC) $(LIBPSASERVER) $(LDFLAGS) -o $@
|
2024-05-10 04:51:16 +00:00
|
|
|
|
|
|
|
$(PARTITION_SERVER_BOOTSTRAP) $(GENERATED_H_FILES): src/manifest.json src/server.c
|
|
|
|
tools/psa_autogen.py src/manifest.json
|
2024-05-03 15:28:04 +00:00
|
|
|
|
2024-05-10 09:21:04 +00:00
|
|
|
# Build MbedTLS libraries (crypto, x509 and tls) and copy them locally to
|
|
|
|
# build client/server applications.
|
|
|
|
#
|
|
|
|
# Note: these rules assume that mbedtls_config.h is already configured by all.sh.
|
|
|
|
# If not using all.sh then the user must do it manually.
|
|
|
|
libpsaclient libpsaserver:
|
|
|
|
$(MAKE) -C $(MBEDTLS_ROOT_PATH)/library CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" libmbedcrypto.a libmbedx509.a libmbedtls.a
|
|
|
|
mkdir -p $@
|
|
|
|
cp $(MBEDTLS_ROOT_PATH)/library/libmbed*.a $@/
|
|
|
|
$(MAKE) -C $(MBEDTLS_ROOT_PATH) clean
|
|
|
|
|
2024-05-03 15:28:04 +00:00
|
|
|
clean:
|
2024-05-10 04:51:16 +00:00
|
|
|
rm -f $(TEST_BIN)
|
|
|
|
rm -f $(PARTITION_SERVER_BOOTSTRAP)
|
2024-05-10 09:21:04 +00:00
|
|
|
rm -rf libpsaclient libpsaserver
|
2024-05-10 04:51:16 +00:00
|
|
|
rm -rf include/psa_manifest
|
|
|
|
rm -f test/psa_service_* test/psa_notify_*
|
2024-05-15 05:29:51 +00:00
|
|
|
rm -f test/*.log
|
|
|
|
rm -f test/seedfile
|