blob: dcdb8f36db00a1e64767c0794c88f8e8227229f7 [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001
2# To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS
Paul Bakker5121ce52009-01-03 21:22:43 +00003
Alon Bar-Levf7a9f302015-02-18 17:55:05 +02004CFLAGS ?= -O2
Paul Elliott9e3256a2020-12-17 18:17:32 +00005WARNING_CFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
6WARNING_CXXFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
Alon Bar-Levada41052015-02-18 17:47:52 +02007LDFLAGS ?=
Alon Bar-Levf7a9f302015-02-18 17:55:05 +02008
Ronald Cron8dc0af22020-06-05 16:00:22 +02009MBEDTLS_TEST_PATH:=../tests/src
Steven Cooremana70d5882020-07-16 20:26:18 +020010MBEDTLS_TEST_OBJS:=$(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/*.c ${MBEDTLS_TEST_PATH}/drivers/*.c))
Ronald Cron8dc0af22020-06-05 16:00:22 +020011
12LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../tests/include -I../include -D_FILE_OFFSET_BITS=64
Mateusz Starzyk1aec6462021-02-08 15:34:42 +010013LOCAL_CXXFLAGS = $(WARNING_CXXFLAGS) -I../include -I../tests/include -D_FILE_OFFSET_BITS=64
Ronald Cron8dc0af22020-06-05 16:00:22 +020014LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} \
15 -L../library \
Manuel Pégourié-Gonnard21e1ac22015-06-25 08:45:12 +020016 -lmbedtls$(SHARED_SUFFIX) \
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020017 -lmbedx509$(SHARED_SUFFIX) \
Manuel Pégourié-Gonnard21e1ac22015-06-25 08:45:12 +020018 -lmbedcrypto$(SHARED_SUFFIX)
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020019
Christoph M. Wintersteiger6ea2dea12019-01-21 17:26:19 +000020include ../3rdparty/Makefile.inc
21LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES)
Jaeden Amero30b340a2018-10-25 17:37:00 +010022
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020023ifndef SHARED
Ronald Cron8dc0af22020-06-05 16:00:22 +020024MBEDLIBS=../library/libmbedcrypto.a ../library/libmbedx509.a ../library/libmbedtls.a
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020025else
Ronald Cron8dc0af22020-06-05 16:00:22 +020026MBEDLIBS=../library/libmbedcrypto.$(DLEXT) ../library/libmbedx509.$(DLEXT) ../library/libmbedtls.$(DLEXT)
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020027endif
Ronald Cron8dc0af22020-06-05 16:00:22 +020028DEP=${MBEDLIBS} ${MBEDTLS_TEST_OBJS}
Christoph M. Wintersteiger977d89a2018-10-25 12:47:03 +010029
Paul Bakkerc7ffd362012-04-05 12:08:29 +000030ifdef DEBUG
Alon Bar-Levf7a9f302015-02-18 17:55:05 +020031LOCAL_CFLAGS += -g3
Paul Bakkerc7ffd362012-04-05 12:08:29 +000032endif
33
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +020034# if we're running on Windows, build for Windows
Paul Bakkercd5b5292012-05-10 20:49:10 +000035ifdef WINDOWS
Alon Bar-Lev18ba0cc2015-02-14 01:04:58 +020036WINDOWS_BUILD=1
37endif
38
39ifdef WINDOWS_BUILD
40DLEXT=dll
41EXEXT=.exe
Alon Bar-Levada41052015-02-18 17:47:52 +020042LOCAL_LDFLAGS += -lws2_32
Alon Bar-Lev18ba0cc2015-02-14 01:04:58 +020043ifdef SHARED
44SHARED_SUFFIX=.$(DLEXT)
45endif
Gilles Peskine687d1ab2021-04-22 01:01:56 +020046PYTHON ?= python
Manuel Pégourié-Gonnard8d4a6132015-06-24 12:16:20 +020047else
Andres Amaya Garcia420f0cc2018-03-27 19:17:21 +010048DLEXT ?= so
Manuel Pégourié-Gonnard8d4a6132015-06-24 12:16:20 +020049EXEXT=
50SHARED_SUFFIX=
Gilles Peskine687d1ab2021-04-22 01:01:56 +020051PYTHON ?= $(shell if type python3 >/dev/null 2>/dev/null; then echo python3; else echo python; fi)
Paul Bakkercd5b5292012-05-10 20:49:10 +000052endif
53
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020054## The following assignment is the list of base names of applications that
55## will be built on Windows. Extra Linux/Unix/POSIX-only applications can
56## be declared by appending with `APPS += ...` afterwards.
57## See the get_app_list function in scripts/generate_visualc_files.pl and
58## make sure to check that it still works if you tweak the format here.
Gilles Peskine8de196a2020-02-11 17:18:08 +010059APPS = \
Gilles Peskineb0fa9d22021-04-22 20:07:44 +020060 aes/crypt_and_hash \
61 hash/generic_sum \
62 hash/hello \
63 pkey/dh_client \
64 pkey/dh_genprime \
65 pkey/dh_server \
66 pkey/ecdh_curve25519 \
67 pkey/ecdsa \
68 pkey/gen_key \
69 pkey/key_app \
70 pkey/key_app_writer \
71 pkey/mpi_demo \
72 pkey/pk_decrypt \
73 pkey/pk_encrypt \
74 pkey/pk_sign \
75 pkey/pk_verify \
76 pkey/rsa_decrypt \
77 pkey/rsa_encrypt \
78 pkey/rsa_genkey \
79 pkey/rsa_sign \
80 pkey/rsa_sign_pss \
81 pkey/rsa_verify \
82 pkey/rsa_verify_pss \
83 psa/crypto_examples \
84 psa/key_ladder_demo \
85 psa/psa_constant_names \
86 random/gen_entropy \
87 random/gen_random_ctr_drbg \
88 ssl/dtls_client \
89 ssl/dtls_server \
90 ssl/mini_client \
91 ssl/ssl_client1 \
92 ssl/ssl_client2 \
93 ssl/ssl_context_info \
94 ssl/ssl_fork_server \
95 ssl/ssl_mail_client \
96 ssl/ssl_server \
97 ssl/ssl_server2 \
98 test/benchmark \
99 test/query_compile_time_config \
100 test/selftest \
101 test/udp_proxy \
102 test/zeroize \
103 util/pem2der \
104 util/strerror \
105 x509/cert_app \
106 x509/cert_req \
107 x509/cert_write \
108 x509/crl_app \
109 x509/req_app \
Gilles Peskine8de196a2020-02-11 17:18:08 +0100110# End of APPS
Paul Bakker5121ce52009-01-03 21:22:43 +0000111
Paul Bakkerf9c49532013-12-19 15:40:58 +0100112ifdef PTHREAD
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200113APPS += ssl/ssl_pthread_server
Paul Bakkerf9c49532013-12-19 15:40:58 +0100114endif
115
Andrzej Kurek0211c322018-03-15 05:16:24 -0400116ifdef TEST_CPP
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200117APPS += test/cpp_dummy_build
Andrzej Kurek0211c322018-03-15 05:16:24 -0400118endif
119
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200120EXES = $(patsubst %,%$(EXEXT),$(APPS))
121
Paul Bakker5121ce52009-01-03 21:22:43 +0000122.SILENT:
123
Philippe Antoine48f35f52019-06-27 08:46:45 +0200124.PHONY: all clean list fuzz
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200125
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200126all: $(EXES)
Philippe Antoinea864db02019-07-10 20:37:57 +0200127ifndef WINDOWS
128# APPS doesn't include the fuzzing programs, which aren't "normal"
129# sample or test programs, and don't build with MSVC which is
130# warning about fopen
131all: fuzz
132endif
Philippe Antoine48f35f52019-06-27 08:46:45 +0200133
Ronald Cron8dc0af22020-06-05 16:00:22 +0200134fuzz: ${MBEDTLS_TEST_OBJS}
Janos Follath4f055f42019-08-20 15:12:54 +0100135 $(MAKE) -C fuzz THIRDPARTY_INCLUDES=$(THIRDPARTY_INCLUDES)
Paul Bakker5121ce52009-01-03 21:22:43 +0000136
Ronald Cron8dc0af22020-06-05 16:00:22 +0200137$(MBEDLIBS):
Manuel Pégourié-Gonnardfc367082015-06-26 16:50:24 +0200138 $(MAKE) -C ../library
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200139
Ronald Cron8dc0af22020-06-05 16:00:22 +0200140${MBEDTLS_TEST_OBJS}:
141 $(MAKE) -C ../tests mbedtls_test
142
Gilles Peskine687d1ab2021-04-22 01:01:56 +0200143.PHONY: generated_files
144GENERATED_FILES = psa/psa_constant_names_generated.c test/query_config.c
145generated_files: $(GENERATED_FILES)
146
147psa/psa_constant_names_generated.c: ../scripts/generate_psa_constants.py
148psa/psa_constant_names_generated.c: ../include/psa/crypto_values.h
149psa/psa_constant_names_generated.c: ../include/psa/crypto_extra.h
150psa/psa_constant_names_generated.c: ../tests/suites/test_suite_psa_crypto_metadata.data
151psa/psa_constant_names_generated.c:
152 echo " Gen $@"
153 $(PYTHON) ../scripts/generate_psa_constants.py
154
155test/query_config.c: ../scripts/generate_query_config.pl
Gilles Peskine1411c7c2021-04-22 14:50:16 +0200156## The generated file only depends on the options that are present in config.h,
157## not on which options are set. To avoid regenerating this file all the time
158## when switching between configurations, don't declare config.h as a
159## dependency. Remove this file from your working tree if you've just added or
160## removed an option in config.h.
161#test/query_config.c: ../include/mbedtls/config.h
Gilles Peskine687d1ab2021-04-22 01:01:56 +0200162test/query_config.c: ../scripts/data_files/query_config.fmt
163test/query_config.c:
164 echo " Gen $@"
165 $(PERL) ../scripts/generate_query_config.pl
166
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200167aes/crypt_and_hash$(EXEXT): aes/crypt_and_hash.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100168 echo " CC aes/crypt_and_hash.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200169 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/crypt_and_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker20a78082011-01-21 09:32:12 +0000170
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200171hash/hello$(EXEXT): hash/hello.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100172 echo " CC hash/hello.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200173 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/hello.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000174
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200175hash/generic_sum$(EXEXT): hash/generic_sum.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100176 echo " CC hash/generic_sum.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200177 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/generic_sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkerfb6c7e22011-01-21 10:21:11 +0000178
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200179pkey/dh_client$(EXEXT): pkey/dh_client.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100180 echo " CC pkey/dh_client.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200181 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000182
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200183pkey/dh_genprime$(EXEXT): pkey/dh_genprime.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100184 echo " CC pkey/dh_genprime.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200185 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_genprime.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000186
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200187pkey/dh_server$(EXEXT): pkey/dh_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100188 echo " CC pkey/dh_server.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200189 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000190
Manuel Pégourié-Gonnard3eb8c342015-10-09 12:11:14 +0100191pkey/ecdh_curve25519$(EXEXT): pkey/ecdh_curve25519.c $(DEP)
192 echo " CC pkey/ecdh_curve25519.c"
193 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/ecdh_curve25519.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
194
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200195pkey/ecdsa$(EXEXT): pkey/ecdsa.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100196 echo " CC pkey/ecdsa.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200197 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/ecdsa.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnardaa431612013-08-09 17:10:27 +0200198
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200199pkey/gen_key$(EXEXT): pkey/gen_key.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100200 echo " CC pkey/gen_key.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200201 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/gen_key.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker15b9b3a2013-09-23 12:05:44 +0200202
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200203pkey/key_app$(EXEXT): pkey/key_app.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100204 echo " CC pkey/key_app.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200205 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/key_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkered56b222011-07-13 11:26:43 +0000206
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200207pkey/key_app_writer$(EXEXT): pkey/key_app_writer.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100208 echo " CC pkey/key_app_writer.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200209 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/key_app_writer.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkerbdb912d2012-02-13 23:11:30 +0000210
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200211pkey/mpi_demo$(EXEXT): pkey/mpi_demo.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100212 echo " CC pkey/mpi_demo.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200213 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/mpi_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000214
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200215pkey/pk_decrypt$(EXEXT): pkey/pk_decrypt.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100216 echo " CC pkey/pk_decrypt.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200217 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker940f9ce2013-09-18 15:34:57 +0200218
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200219pkey/pk_encrypt$(EXEXT): pkey/pk_encrypt.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100220 echo " CC pkey/pk_encrypt.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200221 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker940f9ce2013-09-18 15:34:57 +0200222
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200223pkey/pk_sign$(EXEXT): pkey/pk_sign.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100224 echo " CC pkey/pk_sign.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200225 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker940f9ce2013-09-18 15:34:57 +0200226
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200227pkey/pk_verify$(EXEXT): pkey/pk_verify.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100228 echo " CC pkey/pk_verify.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200229 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker940f9ce2013-09-18 15:34:57 +0200230
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200231pkey/rsa_genkey$(EXEXT): pkey/rsa_genkey.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100232 echo " CC pkey/rsa_genkey.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200233 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_genkey.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000234
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200235pkey/rsa_sign$(EXEXT): pkey/rsa_sign.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100236 echo " CC pkey/rsa_sign.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200237 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_sign.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000238
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200239pkey/rsa_verify$(EXEXT): pkey/rsa_verify.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100240 echo " CC pkey/rsa_verify.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200241 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_verify.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000242
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200243pkey/rsa_sign_pss$(EXEXT): pkey/rsa_sign_pss.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100244 echo " CC pkey/rsa_sign_pss.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200245 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_sign_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkere77db2e2011-03-25 14:01:32 +0000246
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200247pkey/rsa_verify_pss$(EXEXT): pkey/rsa_verify_pss.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100248 echo " CC pkey/rsa_verify_pss.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200249 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_verify_pss.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkere77db2e2011-03-25 14:01:32 +0000250
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200251pkey/rsa_decrypt$(EXEXT): pkey/rsa_decrypt.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100252 echo " CC pkey/rsa_decrypt.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200253 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_decrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker7bc05ff2011-08-09 10:30:36 +0000254
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200255pkey/rsa_encrypt$(EXEXT): pkey/rsa_encrypt.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100256 echo " CC pkey/rsa_encrypt.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200257 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_encrypt.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker7bc05ff2011-08-09 10:30:36 +0000258
Gilles Peskinef0fa4362018-07-16 17:08:43 +0200259psa/key_ladder_demo$(EXEXT): psa/key_ladder_demo.c $(DEP)
260 echo " CC psa/key_ladder_demo.c"
261 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/key_ladder_demo.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
262
Gilles Peskine4a707402021-02-24 21:45:38 +0100263psa/psa_constant_names$(EXEXT): psa/psa_constant_names.c psa/psa_constant_names_generated.c $(DEP)
Gilles Peskine029b5d62018-07-16 23:13:37 +0200264 echo " CC psa/psa_constant_names.c"
265 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/psa_constant_names.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
266
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200267random/gen_entropy$(EXEXT): random/gen_entropy.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100268 echo " CC random/gen_entropy.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200269 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_entropy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker6083fd22011-12-03 21:45:14 +0000270
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200271random/gen_random_ctr_drbg$(EXEXT): random/gen_random_ctr_drbg.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100272 echo " CC random/gen_random_ctr_drbg.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200273 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_random_ctr_drbg.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkerfc36d162011-01-27 16:50:02 +0000274
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200275ssl/dtls_client$(EXEXT): ssl/dtls_client.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100276 echo " CC ssl/dtls_client.c"
Manuel Pégourié-Gonnard8d4a6132015-06-24 12:16:20 +0200277 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/dtls_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnarde63582a2014-10-14 11:47:21 +0200278
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200279ssl/dtls_server$(EXEXT): ssl/dtls_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100280 echo " CC ssl/dtls_server.c"
Manuel Pégourié-Gonnard8d4a6132015-06-24 12:16:20 +0200281 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/dtls_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnarde63582a2014-10-14 11:47:21 +0200282
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200283ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100284 echo " CC ssl/ssl_client1.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200285 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000286
Gilles Peskinea3ed34f2021-01-05 21:11:16 +0100287SSL_TEST_OBJECTS = test/query_config.o ssl/ssl_test_lib.o
Gilles Peskinec772b182021-01-12 15:55:10 +0100288SSL_TEST_DEPS = $(SSL_TEST_OBJECTS) \
289 test/query_config.h \
290 ssl/ssl_test_lib.h \
291 ssl/ssl_test_common_source.c \
292 $(DEP)
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100293
Gilles Peskinea3ed34f2021-01-05 21:11:16 +0100294ssl/ssl_test_lib.o: ssl/ssl_test_lib.c ssl/ssl_test_lib.h $(DEP)
295 echo " CC ssl/ssl_test_lib.c"
296 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c ssl/ssl_test_lib.c -o $@
297
Gilles Peskine0d980b82021-01-05 23:34:27 +0100298ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c $(SSL_TEST_DEPS)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100299 echo " CC ssl/ssl_client2.c"
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100300 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000301
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200302ssl/ssl_server$(EXEXT): ssl/ssl_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100303 echo " CC ssl/ssl_server.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200304 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000305
Gilles Peskine0d980b82021-01-05 23:34:27 +0100306ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c $(SSL_TEST_DEPS)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100307 echo " CC ssl/ssl_server2.c"
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100308 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkerb60b95f2012-09-25 09:05:17 +0000309
Gilles Peskinec772b182021-01-12 15:55:10 +0100310ssl/ssl_context_info$(EXEXT): ssl/ssl_context_info.c test/query_config.o test/query_config.h $(DEP)
Piotr Nowickibc876d42020-03-26 12:49:15 +0100311 echo " CC ssl/ssl_context_info.c"
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100312 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_context_info.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Piotr Nowicki9370f902020-03-13 14:43:22 +0100313
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200314ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100315 echo " CC ssl/ssl_fork_server.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200316 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_fork_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker896ac222011-05-20 12:33:05 +0000317
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200318ssl/ssl_pthread_server$(EXEXT): ssl/ssl_pthread_server.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100319 echo " CC ssl/ssl_pthread_server.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200320 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_pthread_server.c $(LOCAL_LDFLAGS) -lpthread $(LDFLAGS) -o $@
Paul Bakkerf9c49532013-12-19 15:40:58 +0100321
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200322ssl/ssl_mail_client$(EXEXT): ssl/ssl_mail_client.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100323 echo " CC ssl/ssl_mail_client.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200324 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_mail_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker1496d382011-05-23 12:07:29 +0000325
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200326ssl/mini_client$(EXEXT): ssl/mini_client.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100327 echo " CC ssl/mini_client.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200328 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/mini_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnarda6fc5b22014-11-24 14:05:25 +0100329
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200330test/benchmark$(EXEXT): test/benchmark.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100331 echo " CC test/benchmark.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200332 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000333
Andrzej Kurek89c048c2018-03-16 07:37:44 -0400334test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
335 echo " CXX test/cpp_dummy_build.cpp"
336 $(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Andrzej Kurek40741f82018-03-14 17:24:01 -0400337
Gilles Peskinec772b182021-01-12 15:55:10 +0100338test/query_config.o: test/query_config.c test/query_config.h $(DEP)
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100339 echo " CC test/query_config.c"
340 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c test/query_config.c -o $@
341
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200342test/selftest$(EXEXT): test/selftest.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100343 echo " CC test/selftest.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200344 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/selftest.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker5121ce52009-01-03 21:22:43 +0000345
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200346test/udp_proxy$(EXEXT): test/udp_proxy.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100347 echo " CC test/udp_proxy.c"
Manuel Pégourié-Gonnard8d4a6132015-06-24 12:16:20 +0200348 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/udp_proxy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Manuel Pégourié-Gonnardcb4137b2014-09-04 14:55:28 +0200349
Andres Amaya Garcia5ab74a12017-10-24 21:10:45 +0100350test/zeroize$(EXEXT): test/zeroize.c $(DEP)
351 echo " CC test/zeroize.c"
352 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/zeroize.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
353
Gilles Peskinec772b182021-01-12 15:55:10 +0100354test/query_compile_time_config$(EXEXT): test/query_compile_time_config.c test/query_config.o test/query_config.h $(DEP)
Andres AG509ba692018-10-26 18:41:08 +0100355 echo " CC test/query_compile_time_config.c"
Gilles Peskinef06a54c2021-01-05 20:59:50 +0100356 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/query_compile_time_config.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Andres AG509ba692018-10-26 18:41:08 +0100357
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200358util/pem2der$(EXEXT): util/pem2der.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100359 echo " CC util/pem2der.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200360 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/pem2der.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker8adf13b2013-08-25 14:50:09 +0200361
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200362util/strerror$(EXEXT): util/strerror.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100363 echo " CC util/strerror.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200364 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/strerror.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker01cc3942012-05-08 08:36:15 +0000365
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200366x509/cert_app$(EXEXT): x509/cert_app.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100367 echo " CC x509/cert_app.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200368 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakker4fc45522010-03-18 20:11:58 +0000369
Manuel Pégourié-Gonnarda7c89032015-06-29 15:47:35 +0200370x509/cert_write$(EXEXT): x509/cert_write.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100371 echo " CC x509/cert_write.c"
Manuel Pégourié-Gonnarda7c89032015-06-29 15:47:35 +0200372 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_write.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
373
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200374x509/crl_app$(EXEXT): x509/crl_app.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100375 echo " CC x509/crl_app.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200376 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/crl_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkera9507c02011-02-12 15:27:28 +0000377
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200378x509/cert_req$(EXEXT): x509/cert_req.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100379 echo " CC x509/cert_req.c"
Alon Bar-Levf7a9f302015-02-18 17:55:05 +0200380 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_req.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
Paul Bakkerbdb912d2012-02-13 23:11:30 +0000381
Manuel Pégourié-Gonnarda7c89032015-06-29 15:47:35 +0200382x509/req_app$(EXEXT): x509/req_app.c $(DEP)
Manuel Pégourié-Gonnard78ec2b02015-07-08 22:12:06 +0100383 echo " CC x509/req_app.c"
Manuel Pégourié-Gonnarda7c89032015-06-29 15:47:35 +0200384 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/req_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
385
itayzafrira3ff8a62018-07-10 10:10:21 +0300386psa/crypto_examples$(EXEXT): psa/crypto_examples.c $(DEP)
387 echo " CC psa/crypto_examples.c"
388 $(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/crypto_examples.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
389
Paul Bakker5121ce52009-01-03 21:22:43 +0000390clean:
Paul Bakker62f88dc2012-05-10 21:26:28 +0000391ifndef WINDOWS
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200392 rm -f $(EXES)
Jaeden Amerobefe1e152019-06-03 09:14:14 +0100393 -rm -f ssl/ssl_pthread_server$(EXEXT)
394 -rm -f test/cpp_dummy_build$(EXEXT)
Manuel Pégourié-Gonnard5c59a4f2015-06-24 13:06:24 +0200395else
Darryl Green9b9a7902019-08-30 14:51:55 +0100396 if exist *.o del /Q /F *.o
397 if exist *.exe del /Q /F *.exe
Paul Bakker62f88dc2012-05-10 21:26:28 +0000398endif
Philippe Antoine48f35f52019-06-27 08:46:45 +0200399 $(MAKE) -C fuzz clean
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200400
Gilles Peskine687d1ab2021-04-22 01:01:56 +0200401neat: clean
402ifndef WINDOWS
403 rm -f $(GENERATED_FILES)
404else
405 for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f
406endif
407
Manuel Pégourié-Gonnard1b578782013-09-16 13:33:42 +0200408list:
Gilles Peskineb0fa9d22021-04-22 20:07:44 +0200409 echo $(EXES)