Valerio Setti | 4362aae | 2024-05-09 09:15:39 +0200 | [diff] [blame] | 1 | CFLAGS += -Wall -Werror -std=c99 -D_XOPEN_SOURCE=1 -D_POSIX_C_SOURCE=200809L |
Valerio Setti | 4f4ade9 | 2024-05-03 17:28:04 +0200 | [diff] [blame] | 2 | |
| 3 | ifeq ($(DEBUG),1) |
Valerio Setti | 66fb1c1 | 2024-05-10 06:51:16 +0200 | [diff] [blame^] | 4 | CFLAGS += -DDEBUG |
Valerio Setti | 4f4ade9 | 2024-05-03 17:28:04 +0200 | [diff] [blame] | 5 | endif |
| 6 | |
Valerio Setti | 66fb1c1 | 2024-05-10 06:51:16 +0200 | [diff] [blame^] | 7 | LIBPSACLIENT_PATH := ../../libpsaclient |
| 8 | LIBPSASERVER_PATH := ../../libpsaserver |
Valerio Setti | 4f4ade9 | 2024-05-03 17:28:04 +0200 | [diff] [blame] | 9 | |
Valerio Setti | 66fb1c1 | 2024-05-10 06:51:16 +0200 | [diff] [blame^] | 10 | LIBPSACLIENT := -L$(LIBPSACLIENT_PATH)/library -lmbedcrypto -lmbedx509 -lmbedtls |
| 11 | LIBPSASERVER := -L$(LIBPSASERVER_PATH)/library -lmbedcrypto |
Valerio Setti | 4f4ade9 | 2024-05-03 17:28:04 +0200 | [diff] [blame] | 12 | |
Valerio Setti | 66fb1c1 | 2024-05-10 06:51:16 +0200 | [diff] [blame^] | 13 | LIBPSACLIENT_H := -I$(LIBPSACLIENT_PATH)/include |
| 14 | LIBPSASERVER_H := -I$(LIBPSASERVER_PATH)/include |
Valerio Setti | 4f4ade9 | 2024-05-03 17:28:04 +0200 | [diff] [blame] | 15 | |
Valerio Setti | 66fb1c1 | 2024-05-10 06:51:16 +0200 | [diff] [blame^] | 16 | COMMON_INCLUDE := -I./include |
| 17 | |
| 18 | TEST_BIN = test/psa_client \ |
| 19 | test/psa_partition |
| 20 | |
| 21 | GENERATED_H_FILES = include/psa_manifest/manifest.h \ |
| 22 | include/psa_manifest/pid.h \ |
| 23 | include/psa_manifest/sid.h |
| 24 | |
| 25 | PSA_CLIENT_SRC = src/psa_ff_client.c \ |
| 26 | src/client.c |
| 27 | |
| 28 | PARTITION_SERVER_BOOTSTRAP = src/psa_ff_bootstrap_TEST_PARTITION.c |
| 29 | |
| 30 | PSA_SERVER_SRC = $(PARTITION_SERVER_BOOTSTRAP) \ |
| 31 | src/psa_ff_server.c |
| 32 | |
| 33 | .PHONY: all clean |
| 34 | |
| 35 | all: $(TEST_BIN) |
| 36 | |
| 37 | test/psa_client: $(PSA_CLIENT_SRC) $(GENERATED_H_FILES) |
| 38 | $(CC) $(COMMON_INCLUDE) $(LIBPSACLIENT_H) $(CFLAGS) $(PSA_CLIENT_SRC) $(LIBPSACLIENT) $(LDFLAGS) -o $@ |
| 39 | |
| 40 | test/psa_partition: $(PSA_SERVER_SRC) $(GENERATED_H_FILES) |
| 41 | $(CC) $(COMMON_INCLUDE) $(LIBPSASERVER_H) $(CFLAGS) $(PSA_SERVER_SRC) $(LIBPSASERVER) $(LDFLAGS) -o $@ |
| 42 | |
| 43 | $(PARTITION_SERVER_BOOTSTRAP) $(GENERATED_H_FILES): src/manifest.json src/server.c |
| 44 | tools/psa_autogen.py src/manifest.json |
Valerio Setti | 4f4ade9 | 2024-05-03 17:28:04 +0200 | [diff] [blame] | 45 | |
| 46 | clean: |
Valerio Setti | 66fb1c1 | 2024-05-10 06:51:16 +0200 | [diff] [blame^] | 47 | rm -f $(TEST_BIN) |
| 48 | rm -f $(PARTITION_SERVER_BOOTSTRAP) |
| 49 | rm -rf include/psa_manifest |
| 50 | rm -f test/psa_service_* test/psa_notify_* |
Valerio Setti | 4f4ade9 | 2024-05-03 17:28:04 +0200 | [diff] [blame] | 51 | |