psasim: merge all AUT programs into a single executable

This makes both building and testing much faster.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/tests/psa-client-server/psasim/Makefile b/tests/psa-client-server/psasim/Makefile
index a7e22e1..4b0c46e 100644
--- a/tests/psa-client-server/psasim/Makefile
+++ b/tests/psa-client-server/psasim/Makefile
@@ -1,5 +1,3 @@
-MAIN ?= src/client.c
-
 CFLAGS += -Wall -Werror -std=c99 -D_XOPEN_SOURCE=1 -D_POSIX_C_SOURCE=200809L
 
 ifeq ($(DEBUG),1)
@@ -16,11 +14,15 @@
 					include/psa_manifest/pid.h \
 					include/psa_manifest/sid.h
 
-PSA_CLIENT_SRC = src/psa_ff_client.c \
-		 $(MAIN) \
+PSA_CLIENT_COMMON_SRC = src/psa_ff_client.c \
 		 src/psa_sim_crypto_client.c \
 		 src/psa_sim_serialise.c
 
+PSA_CLIENT_BASE_SRC = $(PSA_CLIENT_COMMON_SRC) src/client.c
+
+PSA_CLIENT_FULL_SRC = $(PSA_CLIENT_COMMON_SRC) \
+				$(wildcard src/aut_*.c)
+
 PARTITION_SERVER_BOOTSTRAP = src/psa_ff_bootstrap_TEST_PARTITION.c
 
 PSA_SERVER_SRC = $(PARTITION_SERVER_BOOTSTRAP) \
@@ -35,8 +37,11 @@
 test/seedfile:
 	dd if=/dev/urandom of=./test/seedfile bs=64 count=1
 
-test/psa_client: $(PSA_CLIENT_SRC) $(GENERATED_H_FILES)
-	$(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_CLIENT_SRC) $(LIBPSACLIENT) $(LDFLAGS) -o $@
+test/psa_client_base: $(PSA_CLIENT_BASE_SRC) $(GENERATED_H_FILES)
+	$(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_CLIENT_BASE_SRC) $(LIBPSACLIENT) $(LDFLAGS) -o $@
+
+test/psa_client_full: $(PSA_CLIENT_FULL_SRC) $(GENERATED_H_FILES)
+	$(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_CLIENT_FULL_SRC) $(LIBPSACLIENT) $(LDFLAGS) -o $@
 
 test/psa_partition: $(PSA_SERVER_SRC) $(GENERATED_H_FILES) test/seedfile
 	$(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_SERVER_SRC) $(LIBPSASERVER) $(LDFLAGS) -o $@
@@ -56,7 +61,7 @@
 	$(MAKE) -C $(MBEDTLS_ROOT_PATH) clean
 
 clean:
-	rm -f test/psa_client test/psa_partition
+	rm -f test/psa_client_base test/psa_client_full test/psa_partition
 	rm -f $(PARTITION_SERVER_BOOTSTRAP)
 	rm -rf libpsaclient libpsaserver
 	rm -rf include/psa_manifest