1
2# To compile on SunOS: add "-lsocket -lnsl" to LDFLAGS
3
4CFLAGS	?= -O2
5WARNING_CFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
6WARNING_CXXFLAGS ?= -Wall -Wextra -Wformat=2 -Wno-format-nonliteral
7LDFLAGS ?=
8
9MBEDTLS_TEST_PATH:=../tests/src
10MBEDTLS_TEST_OBJS:=$(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/*.c ${MBEDTLS_TEST_PATH}/drivers/*.c))
11
12LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../tests/include -I../include -D_FILE_OFFSET_BITS=64
13LOCAL_CXXFLAGS = $(WARNING_CXXFLAGS) -I../include -I../tests/include -D_FILE_OFFSET_BITS=64
14LOCAL_LDFLAGS = ${MBEDTLS_TEST_OBJS} 		\
15		-L../library 			\
16		-lmbedtls$(SHARED_SUFFIX)	\
17		-lmbedx509$(SHARED_SUFFIX)	\
18		-lmbedcrypto$(SHARED_SUFFIX)
19
20ifeq ($(shell uname -s),Linux)
21DLOPEN_LDFLAGS ?= -ldl
22else
23DLOPEN_LDFLAGS ?=
24endif
25
26include ../3rdparty/Makefile.inc
27LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES)
28
29ifndef SHARED
30MBEDLIBS=../library/libmbedcrypto.a ../library/libmbedx509.a ../library/libmbedtls.a
31else
32MBEDLIBS=../library/libmbedcrypto.$(DLEXT) ../library/libmbedx509.$(DLEXT) ../library/libmbedtls.$(DLEXT)
33endif
34DEP=${MBEDLIBS} ${MBEDTLS_TEST_OBJS}
35
36ifdef DEBUG
37LOCAL_CFLAGS += -g3
38endif
39
40# if we're running on Windows, build for Windows
41ifdef WINDOWS
42WINDOWS_BUILD=1
43endif
44
45ifdef WINDOWS_BUILD
46DLEXT=dll
47EXEXT=.exe
48LOCAL_LDFLAGS += -lws2_32 -lbcrypt
49ifdef SHARED
50SHARED_SUFFIX=.$(DLEXT)
51endif
52else
53DLEXT ?= so
54EXEXT=
55SHARED_SUFFIX=
56endif
57
58ifdef WINDOWS
59PYTHON ?= python
60else
61PYTHON ?= $(shell if type python3 >/dev/null 2>/dev/null; then echo python3; else echo python; fi)
62endif
63
64# Only build the dlopen test in shared library builds, and not when building
65# for Windows.
66ifdef BUILD_DLOPEN
67# Don't override the value
68else ifdef WINDOWS_BUILD
69BUILD_DLOPEN =
70else ifdef SHARED
71BUILD_DLOPEN = y
72else
73BUILD_DLOPEN =
74endif
75
76## The following assignment is the list of base names of applications that
77## will be built on Windows. Extra Linux/Unix/POSIX-only applications can
78## be declared by appending with `APPS += ...` afterwards.
79## See the get_app_list function in scripts/generate_visualc_files.pl and
80## make sure to check that it still works if you tweak the format here.
81APPS = \
82	aes/crypt_and_hash \
83	cipher/cipher_aead_demo \
84	hash/generic_sum \
85	hash/hello \
86	hash/md_hmac_demo \
87	pkey/dh_client \
88	pkey/dh_genprime \
89	pkey/dh_server \
90	pkey/ecdh_curve25519 \
91	pkey/ecdsa \
92	pkey/gen_key \
93	pkey/key_app \
94	pkey/key_app_writer \
95	pkey/mpi_demo \
96	pkey/pk_decrypt \
97	pkey/pk_encrypt \
98	pkey/pk_sign \
99	pkey/pk_verify \
100	pkey/rsa_decrypt \
101	pkey/rsa_encrypt \
102	pkey/rsa_genkey \
103	pkey/rsa_sign \
104	pkey/rsa_sign_pss \
105	pkey/rsa_verify \
106	pkey/rsa_verify_pss \
107	psa/aead_demo \
108	psa/crypto_examples \
109	psa/hmac_demo \
110	psa/key_ladder_demo \
111	psa/psa_constant_names \
112	random/gen_entropy \
113	random/gen_random_ctr_drbg \
114	ssl/dtls_client \
115	ssl/dtls_server \
116	ssl/mini_client \
117	ssl/ssl_client1 \
118	ssl/ssl_client2 \
119	ssl/ssl_context_info \
120	ssl/ssl_fork_server \
121	ssl/ssl_mail_client \
122	ssl/ssl_server \
123	ssl/ssl_server2 \
124	test/benchmark \
125	test/query_compile_time_config \
126	test/query_included_headers \
127	test/selftest \
128	test/udp_proxy \
129	test/zeroize \
130	util/pem2der \
131	util/strerror \
132	x509/cert_app \
133	x509/cert_req \
134	x509/cert_write \
135	x509/crl_app \
136	x509/load_roots \
137	x509/req_app \
138# End of APPS
139
140ifdef PTHREAD
141APPS +=	ssl/ssl_pthread_server
142endif
143
144ifdef BUILD_DLOPEN
145APPS +=	test/dlopen
146endif
147
148ifdef TEST_CPP
149APPS += test/cpp_dummy_build
150endif
151
152EXES = $(patsubst %,%$(EXEXT),$(APPS))
153
154.SILENT:
155
156.PHONY: all clean list fuzz
157
158all: $(EXES)
159ifndef WINDOWS
160# APPS doesn't include the fuzzing programs, which aren't "normal"
161# sample or test programs, and don't build with MSVC which is
162# warning about fopen
163all: fuzz
164endif
165
166fuzz: ${MBEDTLS_TEST_OBJS}
167	$(MAKE) -C fuzz THIRDPARTY_INCLUDES=$(THIRDPARTY_INCLUDES)
168
169$(MBEDLIBS):
170	$(MAKE) -C ../library
171
172${MBEDTLS_TEST_OBJS}:
173	$(MAKE) -C ../tests mbedtls_test
174
175.PHONY: generated_files
176GENERATED_FILES = psa/psa_constant_names_generated.c test/query_config.c
177generated_files: $(GENERATED_FILES)
178
179# See root Makefile
180GEN_FILES ?=
181ifdef GEN_FILES
182gen_file_dep =
183else
184gen_file_dep = |
185endif
186
187psa/psa_constant_names_generated.c: $(gen_file_dep) ../scripts/generate_psa_constants.py
188psa/psa_constant_names_generated.c: $(gen_file_dep) ../include/psa/crypto_values.h
189psa/psa_constant_names_generated.c: $(gen_file_dep) ../include/psa/crypto_extra.h
190psa/psa_constant_names_generated.c: $(gen_file_dep) ../tests/suites/test_suite_psa_crypto_metadata.data
191psa/psa_constant_names_generated.c:
192	echo "  Gen   $@"
193	$(PYTHON) ../scripts/generate_psa_constants.py
194
195test/query_config.c: $(gen_file_dep) ../scripts/generate_query_config.pl
196## The generated file only depends on the options that are present in mbedtls_config.h,
197## not on which options are set. To avoid regenerating this file all the time
198## when switching between configurations, don't declare mbedtls_config.h as a
199## dependency. Remove this file from your working tree if you've just added or
200## removed an option in mbedtls_config.h.
201#test/query_config.c: $(gen_file_dep) ../include/mbedtls/mbedtls_config.h
202test/query_config.c: $(gen_file_dep) ../scripts/data_files/query_config.fmt
203test/query_config.c:
204	echo "  Gen   $@"
205	$(PERL) ../scripts/generate_query_config.pl
206
207aes/crypt_and_hash$(EXEXT): aes/crypt_and_hash.c $(DEP)
208	echo "  CC    aes/crypt_and_hash.c"
209	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) aes/crypt_and_hash.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
210
211cipher/cipher_aead_demo$(EXEXT): cipher/cipher_aead_demo.c $(DEP)
212	echo "  CC    cipher/cipher_aead_demo.c"
213	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) cipher/cipher_aead_demo.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
214
215hash/generic_sum$(EXEXT): hash/generic_sum.c $(DEP)
216	echo "  CC    hash/generic_sum.c"
217	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/generic_sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
218
219hash/hello$(EXEXT): hash/hello.c $(DEP)
220	echo "  CC    hash/hello.c"
221	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/hello.c       $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
222
223hash/md_hmac_demo$(EXEXT): hash/md_hmac_demo.c $(DEP)
224	echo "  CC    hash/md_hmac_demo.c"
225	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/md_hmac_demo.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
226
227pkey/dh_client$(EXEXT): pkey/dh_client.c $(DEP)
228	echo "  CC    pkey/dh_client.c"
229	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_client.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
230
231pkey/dh_genprime$(EXEXT): pkey/dh_genprime.c $(DEP)
232	echo "  CC    pkey/dh_genprime.c"
233	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_genprime.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
234
235pkey/dh_server$(EXEXT): pkey/dh_server.c $(DEP)
236	echo "  CC    pkey/dh_server.c"
237	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_server.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
238
239pkey/ecdh_curve25519$(EXEXT): pkey/ecdh_curve25519.c $(DEP)
240	echo "  CC    pkey/ecdh_curve25519.c"
241	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/ecdh_curve25519.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
242
243pkey/ecdsa$(EXEXT): pkey/ecdsa.c $(DEP)
244	echo "  CC    pkey/ecdsa.c"
245	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/ecdsa.c       $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
246
247pkey/gen_key$(EXEXT): pkey/gen_key.c $(DEP)
248	echo "  CC    pkey/gen_key.c"
249	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/gen_key.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
250
251pkey/key_app$(EXEXT): pkey/key_app.c $(DEP)
252	echo "  CC    pkey/key_app.c"
253	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/key_app.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
254
255pkey/key_app_writer$(EXEXT): pkey/key_app_writer.c $(DEP)
256	echo "  CC    pkey/key_app_writer.c"
257	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/key_app_writer.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
258
259pkey/mpi_demo$(EXEXT): pkey/mpi_demo.c $(DEP)
260	echo "  CC    pkey/mpi_demo.c"
261	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/mpi_demo.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
262
263pkey/pk_decrypt$(EXEXT): pkey/pk_decrypt.c $(DEP)
264	echo "  CC    pkey/pk_decrypt.c"
265	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_decrypt.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
266
267pkey/pk_encrypt$(EXEXT): pkey/pk_encrypt.c $(DEP)
268	echo "  CC    pkey/pk_encrypt.c"
269	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_encrypt.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
270
271pkey/pk_sign$(EXEXT): pkey/pk_sign.c $(DEP)
272	echo "  CC    pkey/pk_sign.c"
273	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_sign.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
274
275pkey/pk_verify$(EXEXT): pkey/pk_verify.c $(DEP)
276	echo "  CC    pkey/pk_verify.c"
277	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/pk_verify.c  $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
278
279pkey/rsa_genkey$(EXEXT): pkey/rsa_genkey.c $(DEP)
280	echo "  CC    pkey/rsa_genkey.c"
281	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_genkey.c  $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
282
283pkey/rsa_sign$(EXEXT): pkey/rsa_sign.c $(DEP)
284	echo "  CC    pkey/rsa_sign.c"
285	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_sign.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
286
287pkey/rsa_verify$(EXEXT): pkey/rsa_verify.c $(DEP)
288	echo "  CC    pkey/rsa_verify.c"
289	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_verify.c  $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
290
291pkey/rsa_sign_pss$(EXEXT): pkey/rsa_sign_pss.c $(DEP)
292	echo "  CC    pkey/rsa_sign_pss.c"
293	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_sign_pss.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
294
295pkey/rsa_verify_pss$(EXEXT): pkey/rsa_verify_pss.c $(DEP)
296	echo "  CC    pkey/rsa_verify_pss.c"
297	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_verify_pss.c  $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
298
299pkey/rsa_decrypt$(EXEXT): pkey/rsa_decrypt.c $(DEP)
300	echo "  CC    pkey/rsa_decrypt.c"
301	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_decrypt.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
302
303pkey/rsa_encrypt$(EXEXT): pkey/rsa_encrypt.c $(DEP)
304	echo "  CC    pkey/rsa_encrypt.c"
305	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/rsa_encrypt.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
306
307psa/aead_demo$(EXEXT): psa/aead_demo.c $(DEP)
308	echo "  CC    psa/aead_demo.c"
309	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/aead_demo.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
310
311psa/crypto_examples$(EXEXT): psa/crypto_examples.c $(DEP)
312	echo "  CC    psa/crypto_examples.c"
313	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/crypto_examples.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
314
315psa/hmac_demo$(EXEXT): psa/hmac_demo.c $(DEP)
316	echo "  CC    psa/hmac_demo.c"
317	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/hmac_demo.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
318
319psa/key_ladder_demo$(EXEXT): psa/key_ladder_demo.c $(DEP)
320	echo "  CC    psa/key_ladder_demo.c"
321	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/key_ladder_demo.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
322
323psa/psa_constant_names$(EXEXT): psa/psa_constant_names.c psa/psa_constant_names_generated.c $(DEP)
324	echo "  CC    psa/psa_constant_names.c"
325	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) psa/psa_constant_names.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
326
327random/gen_entropy$(EXEXT): random/gen_entropy.c $(DEP)
328	echo "  CC    random/gen_entropy.c"
329	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_entropy.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
330
331random/gen_random_ctr_drbg$(EXEXT): random/gen_random_ctr_drbg.c $(DEP)
332	echo "  CC    random/gen_random_ctr_drbg.c"
333	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) random/gen_random_ctr_drbg.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
334
335ssl/dtls_client$(EXEXT): ssl/dtls_client.c $(DEP)
336	echo "  CC    ssl/dtls_client.c"
337	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/dtls_client.c  $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
338
339ssl/dtls_server$(EXEXT): ssl/dtls_server.c $(DEP)
340	echo "  CC    ssl/dtls_server.c"
341	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/dtls_server.c  $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
342
343ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c $(DEP)
344	echo "  CC    ssl/ssl_client1.c"
345	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c  $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
346
347SSL_TEST_OBJECTS = test/query_config.o ssl/ssl_test_lib.o
348SSL_TEST_DEPS = $(SSL_TEST_OBJECTS) \
349		test/query_config.h \
350		ssl/ssl_test_lib.h \
351		ssl/ssl_test_common_source.c \
352		$(DEP)
353
354ssl/ssl_test_lib.o: ssl/ssl_test_lib.c ssl/ssl_test_lib.h $(DEP)
355	echo "  CC    ssl/ssl_test_lib.c"
356	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c ssl/ssl_test_lib.c -o $@
357
358ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c $(SSL_TEST_DEPS)
359	echo "  CC    ssl/ssl_client2.c"
360	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
361
362ssl/ssl_server$(EXEXT): ssl/ssl_server.c $(DEP)
363	echo "  CC    ssl/ssl_server.c"
364	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
365
366ssl/ssl_server2$(EXEXT): ssl/ssl_server2.c $(SSL_TEST_DEPS)
367	echo "  CC    ssl/ssl_server2.c"
368	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_server2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
369
370ssl/ssl_context_info$(EXEXT): ssl/ssl_context_info.c test/query_config.o test/query_config.h $(DEP)
371	echo "  CC    ssl/ssl_context_info.c"
372	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_context_info.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
373
374ssl/ssl_fork_server$(EXEXT): ssl/ssl_fork_server.c $(DEP)
375	echo "  CC    ssl/ssl_fork_server.c"
376	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_fork_server.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
377
378ssl/ssl_pthread_server$(EXEXT): ssl/ssl_pthread_server.c $(DEP)
379	echo "  CC    ssl/ssl_pthread_server.c"
380	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_pthread_server.c   $(LOCAL_LDFLAGS) -lpthread  $(LDFLAGS) -o $@
381
382ssl/ssl_mail_client$(EXEXT): ssl/ssl_mail_client.c $(DEP)
383	echo "  CC    ssl/ssl_mail_client.c"
384	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_mail_client.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
385
386ssl/mini_client$(EXEXT): ssl/mini_client.c $(DEP)
387	echo "  CC    ssl/mini_client.c"
388	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/mini_client.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
389
390test/benchmark$(EXEXT): test/benchmark.c $(DEP)
391	echo "  CC    test/benchmark.c"
392	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
393
394test/cpp_dummy_build.cpp: test/generate_cpp_dummy_build.sh
395	echo "  Gen   test/cpp_dummy_build.cpp"
396	test/generate_cpp_dummy_build.sh
397
398test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
399	echo "  CXX   test/cpp_dummy_build.cpp"
400	$(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp   $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
401
402ifdef BUILD_DLOPEN
403test/dlopen$(EXEXT): test/dlopen.c $(DEP)
404	echo "  CC    test/dlopen.c"
405# Do not link any test objects (that would bring in a static dependency on
406# libmbedcrypto at least). Do not link with libmbed* (that would defeat the
407# purpose of testing dynamic loading).
408	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/dlopen.c $(LDFLAGS) $(DLOPEN_LDFLAGS) -o $@
409endif
410
411test/query_config.o: test/query_config.c test/query_config.h $(DEP)
412	echo "  CC    test/query_config.c"
413	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c test/query_config.c -o $@
414
415test/query_included_headers$(EXEXT): test/query_included_headers.c $(DEP)
416	echo "  CC    test/query_included_headers.c"
417	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/query_included_headers.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
418
419test/selftest$(EXEXT): test/selftest.c $(DEP)
420	echo "  CC    test/selftest.c"
421	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/selftest.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
422
423test/udp_proxy$(EXEXT): test/udp_proxy.c $(DEP)
424	echo "  CC    test/udp_proxy.c"
425	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/udp_proxy.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
426
427test/zeroize$(EXEXT): test/zeroize.c $(DEP)
428	echo "  CC    test/zeroize.c"
429	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/zeroize.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
430
431test/query_compile_time_config$(EXEXT): test/query_compile_time_config.c test/query_config.o test/query_config.h $(DEP)
432	echo "  CC    test/query_compile_time_config.c"
433	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/query_compile_time_config.c test/query_config.o $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
434
435util/pem2der$(EXEXT): util/pem2der.c $(DEP)
436	echo "  CC    util/pem2der.c"
437	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/pem2der.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
438
439util/strerror$(EXEXT): util/strerror.c $(DEP)
440	echo "  CC    util/strerror.c"
441	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) util/strerror.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
442
443x509/cert_app$(EXEXT): x509/cert_app.c $(DEP)
444	echo "  CC    x509/cert_app.c"
445	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_app.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
446
447x509/cert_write$(EXEXT): x509/cert_write.c $(DEP)
448	echo "  CC    x509/cert_write.c"
449	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_write.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
450
451x509/crl_app$(EXEXT): x509/crl_app.c $(DEP)
452	echo "  CC    x509/crl_app.c"
453	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/crl_app.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
454
455x509/cert_req$(EXEXT): x509/cert_req.c $(DEP)
456	echo "  CC    x509/cert_req.c"
457	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/cert_req.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
458
459x509/load_roots$(EXEXT): x509/load_roots.c $(DEP)
460	echo "  CC    x509/load_roots.c"
461	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/load_roots.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
462
463x509/req_app$(EXEXT): x509/req_app.c $(DEP)
464	echo "  CC    x509/req_app.c"
465	$(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/req_app.c    $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
466
467clean:
468ifndef WINDOWS
469	rm -f $(EXES)
470	-rm -f ssl/ssl_pthread_server$(EXEXT)
471	-rm -f test/cpp_dummy_build.cpp test/cpp_dummy_build$(EXEXT)
472	-rm -f test/dlopen$(EXEXT)
473else
474	if exist *.o del /Q /F *.o
475	if exist *.exe del /Q /F *.exe
476	if exist test\cpp_dummy_build.cpp del /Q /F test\cpp_dummy_build.cpp
477endif
478	$(MAKE) -C fuzz clean
479
480neat: clean
481ifndef WINDOWS
482	rm -f $(GENERATED_FILES)
483else
484	for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f
485endif
486
487list:
488	echo $(EXES)
489