blob: 6c9d4d7342589bee8c50f77362b7b435b195d490 [file] [log] [blame]
Gilles Peskine4ad57332023-12-22 11:30:30 +01001MBEDTLS_TEST_PATH = ../tests
Harry Ramsey2543ec02025-02-11 14:06:44 +00002FRAMEWORK = ${MBEDTLS_PATH}/framework
Gilles Peskinef3d1ae12023-12-22 11:40:58 +01003include ../scripts/common.make
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +02004
Gilles Peskine5dbee582021-11-04 15:07:28 +01005ifeq ($(shell uname -s),Linux)
6DLOPEN_LDFLAGS ?= -ldl
7else
8DLOPEN_LDFLAGS ?=
9endif
10
Gilles Peskine4411c9c2024-01-04 20:51:38 +010011ifdef RECORD_PSA_STATUS_COVERAGE_LOG
12LOCAL_CFLAGS += -Werror -DRECORD_PSA_STATUS_COVERAGE_LOG
13endif
Ronald Cron8dc0af22020-06-05 16:00:22 +020014DEP=${MBEDLIBS} ${MBEDTLS_TEST_OBJS}
Christoph M. Wintersteiger977d89a2018-10-25 12:47:03 +010015
Gilles Peskinef80a0292021-11-04 15:18:00 +010016# Only build the dlopen test in shared library builds, and not when building
17# for Windows.
18ifdef BUILD_DLOPEN
19# Don't override the value
20else ifdef WINDOWS_BUILD
21BUILD_DLOPEN =
22else ifdef SHARED
23BUILD_DLOPEN = y
24else
25BUILD_DLOPEN =
26endif
27
Harry Ramsey2543ec02025-02-11 14:06:44 +000028LOCAL_CFLAGS += -I$(FRAMEWORK)/tests/programs
29
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020030## The following assignment is the list of base names of applications that
31## will be built on Windows. Extra Linux/Unix/POSIX-only applications can
32## be declared by appending with `APPS += ...` afterwards.
33## See the get_app_list function in scripts/generate_visualc_files.pl and
34## make sure to check that it still works if you tweak the format here.
Harry Ramsey91c0d462024-11-04 15:06:41 +000035##
36## Note: Variables cannot be used to define an apps path. This cannot be
37## substituted by the script generate_visualc_files.pl.
Gilles Peskine8de196a2020-02-11 17:18:08 +010038APPS = \
Harry Ramsey91c0d462024-11-04 15:06:41 +000039 ../tf-psa-crypto/programs/psa/aead_demo \
40 ../tf-psa-crypto/programs/psa/crypto_examples \
41 ../tf-psa-crypto/programs/psa/hmac_demo \
42 ../tf-psa-crypto/programs/psa/key_ladder_demo \
43 ../tf-psa-crypto/programs/psa/psa_constant_names \
44 ../tf-psa-crypto/programs/psa/psa_hash \
Felix Conway9949f002025-04-03 15:05:21 +010045 ../tf-psa-crypto/programs/test/which_aes \
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020046 ssl/dtls_client \
47 ssl/dtls_server \
48 ssl/mini_client \
49 ssl/ssl_client1 \
50 ssl/ssl_client2 \
51 ssl/ssl_context_info \
52 ssl/ssl_fork_server \
53 ssl/ssl_mail_client \
54 ssl/ssl_server \
55 ssl/ssl_server2 \
Gilles Peskine33406b62023-11-02 18:48:39 +010056 test/metatest \
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020057 test/query_compile_time_config \
Gilles Peskinedf6e84a2023-02-22 22:09:51 +010058 test/query_included_headers \
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020059 test/selftest \
60 test/udp_proxy \
61 test/zeroize \
62 util/pem2der \
63 util/strerror \
64 x509/cert_app \
65 x509/cert_req \
66 x509/cert_write \
67 x509/crl_app \
Gilles Peskine2c1442e2021-07-26 20:20:54 +020068 x509/load_roots \
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020069 x509/req_app \
Gilles Peskine8de196a2020-02-11 17:18:08 +010070# End of APPS
Paul Bakker5121ce52009-01-03 21:22:43 +000071
Paul Elliott79dc6da2023-12-11 17:52:03 +000072ifeq ($(THREADING),pthread)
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020073APPS += ssl/ssl_pthread_server
Paul Bakkerf9c49532013-12-19 15:40:58 +010074endif
75
Gilles Peskinef80a0292021-11-04 15:18:00 +010076ifdef BUILD_DLOPEN
Gilles Peskinea7c247e2021-11-04 12:45:19 +010077APPS += test/dlopen
78endif
79
Andrzej Kurek0211c322018-03-15 05:16:24 -040080ifdef TEST_CPP
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020081APPS += test/cpp_dummy_build
Andrzej Kurek0211c322018-03-15 05:16:24 -040082endif
83
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020084EXES = $(patsubst %,%$(EXEXT),$(APPS))
85
Paul Bakker5121ce52009-01-03 21:22:43 +000086.SILENT:
87
Philippe Antoine48f35f52019-06-27 08:46:45 +020088.PHONY: all clean list fuzz
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020089
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020090all: $(EXES)
Philippe Antoinea864db02019-07-10 20:37:57 +020091ifndef WINDOWS
92# APPS doesn't include the fuzzing programs, which aren't "normal"
93# sample or test programs, and don't build with MSVC which is
94# warning about fopen
95all: fuzz
96endif
Philippe Antoine48f35f52019-06-27 08:46:45 +020097
Gilles Peskined001f582024-09-14 13:05:51 +020098SSL_OPT_APPS = $(filter ssl/%,$(APPS))
99SSL_OPT_APPS += test/query_compile_time_config test/udp_proxy
100# Just the programs needed to run ssl-opt.sh (and compat.sh)
101ssl-opt: $(patsubst %,%$(EXEXT),$(SSL_OPT_APPS))
102.PHONY: ssl-opt
103
Ronald Cron8dc0af22020-06-05 16:00:22 +0200104fuzz: ${MBEDTLS_TEST_OBJS}
Paul Elliott0c847bc2024-01-24 19:08:31 +0000105 $(MAKE) -C fuzz
Paul Bakker5121ce52009-01-03 21:22:43 +0000106
Ronald Cron8dc0af22020-06-05 16:00:22 +0200107${MBEDTLS_TEST_OBJS}:
108 $(MAKE) -C ../tests mbedtls_test
109
Gilles Peskine687d1ab2021-04-22 01:01:56 +0200110.PHONY: generated_files
Ronald Crona747fa62024-12-10 11:29:33 +0100111GENERATED_FILES = ../tf-psa-crypto/programs/psa/psa_constant_names_generated.c test/query_config.c
Gilles Peskine687d1ab2021-04-22 01:01:56 +0200112generated_files: $(GENERATED_FILES)
113
Ronald Crona747fa62024-12-10 11:29:33 +0100114../tf-psa-crypto/programs/psa/psa_constant_names_generated.c: $(gen_file_dep) ../tf-psa-crypto/scripts/generate_psa_constants.py
115../tf-psa-crypto/programs/psa/psa_constant_names_generated.c: $(gen_file_dep) ../tf-psa-crypto/include/psa/crypto_values.h
116../tf-psa-crypto/programs/psa/psa_constant_names_generated.c: $(gen_file_dep) ../tf-psa-crypto/include/psa/crypto_extra.h
117../tf-psa-crypto/programs/psa/psa_constant_names_generated.c: $(gen_file_dep) ../tf-psa-crypto/tests/suites/test_suite_psa_crypto_metadata.data
118../tf-psa-crypto/programs/psa/psa_constant_names_generated.c:
Gilles Peskine687d1ab2021-04-22 01:01:56 +0200119 echo " Gen $@"
Harry Ramseyfb4824b2024-11-04 16:41:22 +0000120 cd ../tf-psa-crypto; $(PYTHON) ./scripts/generate_psa_constants.py
Gilles Peskine687d1ab2021-04-22 01:01:56 +0200121
Gilles Peskine0b62b7a2023-09-08 16:19:13 +0200122test/query_config.c: $(gen_file_dep) ../scripts/generate_query_config.pl
Bence Szépkútibb0cfeb2021-05-28 09:42:25 +0200123## The generated file only depends on the options that are present in mbedtls_config.h,
Gilles Peskine1411c7c2021-04-22 14:50:16 +0200124## not on which options are set. To avoid regenerating this file all the time
Bence Szépkútibb0cfeb2021-05-28 09:42:25 +0200125## when switching between configurations, don't declare mbedtls_config.h as a
Gilles Peskine1411c7c2021-04-22 14:50:16 +0200126## dependency. Remove this file from your working tree if you've just added or
Bence Szépkútibb0cfeb2021-05-28 09:42:25 +0200127## removed an option in mbedtls_config.h.
Gilles Peskine0b62b7a2023-09-08 16:19:13 +0200128#test/query_config.c: $(gen_file_dep) ../include/mbedtls/mbedtls_config.h
129test/query_config.c: $(gen_file_dep) ../scripts/data_files/query_config.fmt
Gilles Peskine687d1ab2021-04-22 01:01:56 +0200130test/query_config.c:
131 echo " Gen $@"
132 $(PERL) ../scripts/generate_query_config.pl
133
Harry Ramsey91c0d462024-11-04 15:06:41 +0000134../tf-psa-crypto/programs/psa/aead_demo$(EXEXT): ../tf-psa-crypto/programs/psa/aead_demo.c $(DEP)
Harry Ramseyaf059412024-11-11 09:57:30 +0000135 echo " CC psa/aead_demo.c"
Harry Ramsey91c0d462024-11-04 15:06:41 +0000136 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ../tf-psa-crypto/programs/psa/aead_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnard398d4592022-01-07 12:26:32 +0100137
Harry Ramsey91c0d462024-11-04 15:06:41 +0000138../tf-psa-crypto/programs/psa/crypto_examples$(EXEXT): ../tf-psa-crypto/programs/psa/crypto_examples.c $(DEP)
Harry Ramseyaf059412024-11-11 09:57:30 +0000139 echo " CC psa/crypto_examples.c"
Harry Ramsey91c0d462024-11-04 15:06:41 +0000140 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ../tf-psa-crypto/programs/psa/crypto_examples.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnard667b5562021-11-22 13:00:17 +0100141
Harry Ramsey91c0d462024-11-04 15:06:41 +0000142../tf-psa-crypto/programs/psa/hmac_demo$(EXEXT): ../tf-psa-crypto/programs/psa/hmac_demo.c $(DEP)
Harry Ramseyaf059412024-11-11 09:57:30 +0000143 echo " CC psa/hmac_demo.c"
Harry Ramsey91c0d462024-11-04 15:06:41 +0000144 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ../tf-psa-crypto/programs/psa/hmac_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnard667b5562021-11-22 13:00:17 +0100145
Harry Ramsey91c0d462024-11-04 15:06:41 +0000146../tf-psa-crypto/programs/psa/key_ladder_demo$(EXEXT): ../tf-psa-crypto/programs/psa/key_ladder_demo.c $(DEP)
Harry Ramseyaf059412024-11-11 09:57:30 +0000147 echo " CC psa/key_ladder_demo.c"
Harry Ramsey91c0d462024-11-04 15:06:41 +0000148 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ../tf-psa-crypto/programs/psa/key_ladder_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Gilles Peskinef0fa4362018-07-16 17:08:43 +0200149
Ronald Crona747fa62024-12-10 11:29:33 +0100150../tf-psa-crypto/programs/psa/psa_constant_names$(EXEXT): ../tf-psa-crypto/programs/psa/psa_constant_names.c ../tf-psa-crypto/programs/psa/psa_constant_names_generated.c $(DEP)
Harry Ramseyaf059412024-11-11 09:57:30 +0000151 echo " CC psa/psa_constant_names.c"
Harry Ramsey91c0d462024-11-04 15:06:41 +0000152 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ../tf-psa-crypto/programs/psa/psa_constant_names.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Gilles Peskine029b5d62018-07-16 23:13:37 +0200153
Harry Ramsey91c0d462024-11-04 15:06:41 +0000154../tf-psa-crypto/programs/psa/psa_hash$(EXEXT): ../tf-psa-crypto/programs/psa/psa_hash.c $(DEP)
Harry Ramseyaf059412024-11-11 09:57:30 +0000155 echo " CC psa/psa_hash.c"
Harry Ramsey91c0d462024-11-04 15:06:41 +0000156 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ../tf-psa-crypto/programs/psa/psa_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Hannes Tschofenigf8b9ebf2023-07-18 13:46:10 +0100157
Felix Conway9949f002025-04-03 15:05:21 +0100158../tf-psa-crypto/programs/test/which_aes$(EXEXT): ../tf-psa-crypto/programs/test/which_aes.c $(DEP)
159 echo " CC test/which_aes.c"
160 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ../tf-psa-crypto/programs/test/which_aes.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
161
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200162ssl/dtls_client$(EXEXT): ssl/dtls_client.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100163 echo " CC ssl/dtls_client.c"
Manuel Pégourié-Gonnard8d4a6132015-06-24 12:16:20 +0200164 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/dtls_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnarde63582a2014-10-14 11:47:21 +0200165
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200166ssl/dtls_server$(EXEXT): ssl/dtls_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100167 echo " CC ssl/dtls_server.c"
Manuel Pégourié-Gonnard8d4a6132015-06-24 12:16:20 +0200168 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/dtls_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnarde63582a2014-10-14 11:47:21 +0200169
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200170ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100171 echo " CC ssl/ssl_client1.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200172 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000173
Gilles Peskinea3ed34f2021-01-05 21:11:16 +0100174SSL_TEST_OBJECTS = test/query_config.o ssl/ssl_test_lib.o
Gilles Peskinec772b182021-01-12 15:55:10 +0100175SSL_TEST_DEPS = $(SSL_TEST_OBJECTS) \
Harry Ramsey2543ec02025-02-11 14:06:44 +0000176 $(FRAMEWORK)/tests/programs/query_config.h \
Gilles Peskinec772b182021-01-12 15:55:10 +0100177 ssl/ssl_test_lib.h \
178 ssl/ssl_test_common_source.c \
179 $(DEP)
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100180
Gilles Peskinea3ed34f2021-01-05 21:11:16 +0100181ssl/ssl_test_lib.o: ssl/ssl_test_lib.c ssl/ssl_test_lib.h $(DEP)
182 echo " CC ssl/ssl_test_lib.c"
183 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c ssl/ssl_test_lib.c -o $@
184
Gilles Peskine0d980b82021-01-05 23:34:27 +0100185ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c $(SSL_TEST_DEPS)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100186 echo " CC ssl/ssl_client2.c"
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100187 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000188
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200189ssl/ssl_server$(EXEXT): ssl/ssl_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100190 echo " CC ssl/ssl_server.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200191 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000192
Gilles Peskine0d980b82021-01-05 23:34:27 +0100193ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c $(SSL_TEST_DEPS)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100194 echo " CC ssl/ssl_server2.c"
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100195 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkerb60b95f2012-09-25 09:05:17 +0000196
Harry Ramsey2543ec02025-02-11 14:06:44 +0000197ssl/ssl_context_info$(EXEXT): ssl/ssl_context_info.c test/query_config.o $(FRAMEWORK)/tests/programs/query_config.h $(DEP)
Piotr Nowickibc876d42020-03-26 12:49:15 +0100198 echo " CC ssl/ssl_context_info.c"
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100199 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_context_info.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Piotr Nowicki9370f902020-03-13 14:43:22 +0100200
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200201ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100202 echo " CC ssl/ssl_fork_server.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200203 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_fork_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker896ac222011-05-20 12:33:05 +0000204
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200205ssl/ssl_pthread_server$(EXEXT): ssl/ssl_pthread_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100206 echo " CC ssl/ssl_pthread_server.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200207 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_pthread_server.c $(LOCAL_LDFLAGS) -lpthread $(LDFLAGS) -o $@
Paul Bakkerf9c49532013-12-19 15:40:58 +0100208
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200209ssl/ssl_mail_client$(EXEXT): ssl/ssl_mail_client.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100210 echo " CC ssl/ssl_mail_client.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200211 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_mail_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker1496d382011-05-23 12:07:29 +0000212
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200213ssl/mini_client$(EXEXT): ssl/mini_client.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100214 echo " CC ssl/mini_client.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200215 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/mini_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnarda6fc5b22014-11-24 14:05:25 +0100216
Gilles Peskine03ab5442021-07-09 15:19:28 +0200217test/cpp_dummy_build.cpp: test/generate_cpp_dummy_build.sh
218 echo " Gen test/cpp_dummy_build.cpp"
219 test/generate_cpp_dummy_build.sh
220
Andrzej Kurek89c048c2018-03-16 07:37:44 -0400221test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
222 echo " CXX test/cpp_dummy_build.cpp"
223 $(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Andrzej Kurek40741f82018-03-14 17:24:01 -0400224
Gilles Peskinef80a0292021-11-04 15:18:00 +0100225ifdef BUILD_DLOPEN
Gilles Peskinea7c247e2021-11-04 12:45:19 +0100226test/dlopen$(EXEXT): test/dlopen.c $(DEP)
227 echo " CC test/dlopen.c"
228# Do not link any test objects (that would bring in a static dependency on
229# libmbedcrypto at least). Do not link with libmbed* (that would defeat the
230# purpose of testing dynamic loading).
Gilles Peskine5dbee582021-11-04 15:07:28 +0100231 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/dlopen.c $(LDFLAGS) $(DLOPEN_LDFLAGS) -o $@
Gilles Peskinea7c247e2021-11-04 12:45:19 +0100232endif
233
Harry Ramsey2543ec02025-02-11 14:06:44 +0000234test/metatest$(EXEXT): $(FRAMEWORK)/tests/programs/metatest.c $(DEP)
235 echo " CC $(FRAMEWORK)/tests/programs/metatest.c"
Gilles Peskinef0b83642025-09-06 16:25:30 +0200236 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -I../library -I../tf-psa-crypto/core -I../tf-psa-crypto/drivers/builtin/include -I../tf-psa-crypto/drivers/builtin/src $(FRAMEWORK)/tests/programs/metatest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Gilles Peskine33406b62023-11-02 18:48:39 +0100237
Harry Ramsey2543ec02025-02-11 14:06:44 +0000238test/query_config.o: test/query_config.c $(FRAMEWORK)/tests/programs/query_config.h $(DEP)
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100239 echo " CC test/query_config.c"
240 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c test/query_config.c -o $@
241
Harry Ramsey2543ec02025-02-11 14:06:44 +0000242test/query_included_headers$(EXEXT): $(FRAMEWORK)/tests/programs/query_included_headers.c $(DEP)
243 echo " CC $(FRAMEWORK)/tests/programs/query_included_headers.c"
244 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $(FRAMEWORK)/tests/programs/query_included_headers.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Gilles Peskinedf6e84a2023-02-22 22:09:51 +0100245
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200246test/selftest$(EXEXT): test/selftest.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100247 echo " CC test/selftest.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200248 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/selftest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000249
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200250test/udp_proxy$(EXEXT): test/udp_proxy.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100251 echo " CC test/udp_proxy.c"
Manuel Pégourié-Gonnard8d4a6132015-06-24 12:16:20 +0200252 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/udp_proxy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnardcb4137b2014-09-04 14:55:28 +0200253
Harry Ramsey2543ec02025-02-11 14:06:44 +0000254test/zeroize$(EXEXT): $(FRAMEWORK)/tests/programs/zeroize.c $(DEP)
255 echo " CC $(FRAMEWORK)/tests/programs/zeroize.c"
256 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $(FRAMEWORK)/tests/programs/zeroize.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Andres Amaya Garcia5ab74a12017-10-24 21:10:45 +0100257
Harry Ramsey2543ec02025-02-11 14:06:44 +0000258test/query_compile_time_config$(EXEXT): $(FRAMEWORK)/tests/programs/query_compile_time_config.c test/query_config.o $(FRAMEWORK)/tests/programs/query_config.h $(DEP)
259 echo " CC $(FRAMEWORK)/tests/programs/query_compile_time_config.c"
260 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $(FRAMEWORK)/tests/programs/query_compile_time_config.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Andres AG509ba692018-10-26 18:41:08 +0100261
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200262util/pem2der$(EXEXT): util/pem2der.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100263 echo " CC util/pem2der.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200264 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/pem2der.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker8adf13b2013-08-25 14:50:09 +0200265
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200266util/strerror$(EXEXT): util/strerror.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100267 echo " CC util/strerror.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200268 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/strerror.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker01cc3942012-05-08 08:36:15 +0000269
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200270x509/cert_app$(EXEXT): x509/cert_app.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100271 echo " CC x509/cert_app.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200272 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker4fc45522010-03-18 20:11:58 +0000273
Manuel Pégourié-Gonnarda7c89032015-06-29 15:47:35 +0200274x509/cert_write$(EXEXT): x509/cert_write.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100275 echo " CC x509/cert_write.c"
Manuel Pégourié-Gonnarda7c89032015-06-29 15:47:35 +0200276 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_write.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
277
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200278x509/crl_app$(EXEXT): x509/crl_app.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100279 echo " CC x509/crl_app.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200280 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/crl_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkera9507c02011-02-12 15:27:28 +0000281
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200282x509/cert_req$(EXEXT): x509/cert_req.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100283 echo " CC x509/cert_req.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200284 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_req.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkerbdb912d2012-02-13 23:11:30 +0000285
Gilles Peskine2c1442e2021-07-26 20:20:54 +0200286x509/load_roots$(EXEXT): x509/load_roots.c $(DEP)
287 echo " CC x509/load_roots.c"
288 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/load_roots.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
289
Manuel Pégourié-Gonnarda7c89032015-06-29 15:47:35 +0200290x509/req_app$(EXEXT): x509/req_app.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100291 echo " CC x509/req_app.c"
Manuel Pégourié-Gonnarda7c89032015-06-29 15:47:35 +0200292 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/req_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
293
Paul Bakker5121ce52009-01-03 21:22:43 +0000294clean:
Paul Bakker62f88dc2012-05-10 21:26:28 +0000295ifndef WINDOWS
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200296 rm -f $(EXES)
Ronald Cron088a1ab2024-07-12 08:02:49 +0200297 rm -f */*.o
Jaeden Amerobefe1e152019-06-03 09:14:14 +0100298 -rm -f ssl/ssl_pthread_server$(EXEXT)
Gilles Peskine03ab5442021-07-09 15:19:28 +0200299 -rm -f test/cpp_dummy_build.cpp test/cpp_dummy_build$(EXEXT)
Gilles Peskinea7c247e2021-11-04 12:45:19 +0100300 -rm -f test/dlopen$(EXEXT)
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200301else
Darryl Green9b9a7902019-08-30 14:51:55 +0100302 if exist *.o del /Q /F *.o
303 if exist *.exe del /Q /F *.exe
Gilles Peskine03ab5442021-07-09 15:19:28 +0200304 if exist test\cpp_dummy_build.cpp del /Q /F test\cpp_dummy_build.cpp
Paul Bakker62f88dc2012-05-10 21:26:28 +0000305endif
Philippe Antoine48f35f52019-06-27 08:46:45 +0200306 $(MAKE) -C fuzz clean
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200307
308list:
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200309 echo $(EXES)