xref: /freebsd/contrib/bearssl/mk/mkrules.sh (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1#! /bin/sh
2
3# ========================================================================
4#
5# Copyright (c) 2017 Thomas Pornin <pornin@bolet.org>
6#
7# Permission is hereby granted, free of charge, to any person obtaining
8# a copy of this software and associated documentation files (the
9# "Software"), to deal in the Software without restriction, including
10# without limitation the rights to use, copy, modify, merge, publish,
11# distribute, sublicense, and/or sell copies of the Software, and to
12# permit persons to whom the Software is furnished to do so, subject to
13# the following conditions:
14#
15# The above copyright notice and this permission notice shall be
16# included in all copies or substantial portions of the Software.
17#
18# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25# SOFTWARE.
26#
27# ========================================================================
28#
29# This script is used to generate the 'Rules.mk' file from the list
30# of source file included below. If the list changes (e.g. to add a
31# new source file), then add it here and rerun this script.
32#
33# ========================================================================
34
35# Solaris compatibility: switch to a more POSIX-compliant /bin/sh.
36if [ -z "$BR_SCRIPT_LOOP" ] ; then
37	BR_SCRIPT_LOOP=yes
38	export BR_SCRIPT_LOOP
39	if [ -x /usr/xpg6/bin/sh ] ; then
40		exec /usr/xpg6/bin/sh "$0" "$@"
41	fi
42	if [ -x /usr/xpg4/bin/sh ] ; then
43		exec /usr/xpg4/bin/sh "$0" "$@"
44	fi
45fi
46
47# Exit on first error.
48set -e
49
50# Source files. Please keep in alphabetical order.
51coresrc=" \
52	src/settings.c \
53	src/aead/ccm.c \
54	src/aead/eax.c \
55	src/aead/gcm.c \
56	src/codec/ccopy.c \
57	src/codec/dec16be.c \
58	src/codec/dec16le.c \
59	src/codec/dec32be.c \
60	src/codec/dec32le.c \
61	src/codec/dec64be.c \
62	src/codec/dec64le.c \
63	src/codec/enc16be.c \
64	src/codec/enc16le.c \
65	src/codec/enc32be.c \
66	src/codec/enc32le.c \
67	src/codec/enc64be.c \
68	src/codec/enc64le.c \
69	src/codec/pemdec.c \
70	src/codec/pemenc.c \
71	src/ec/ec_all_m15.c \
72	src/ec/ec_all_m31.c \
73	src/ec/ec_c25519_i15.c \
74	src/ec/ec_c25519_i31.c \
75	src/ec/ec_c25519_m15.c \
76	src/ec/ec_c25519_m31.c \
77	src/ec/ec_c25519_m62.c \
78	src/ec/ec_c25519_m64.c \
79	src/ec/ec_curve25519.c \
80	src/ec/ec_default.c \
81	src/ec/ec_keygen.c \
82	src/ec/ec_p256_m15.c \
83	src/ec/ec_p256_m31.c \
84	src/ec/ec_p256_m62.c \
85	src/ec/ec_p256_m64.c \
86	src/ec/ec_prime_i15.c \
87	src/ec/ec_prime_i31.c \
88	src/ec/ec_pubkey.c \
89	src/ec/ec_secp256r1.c \
90	src/ec/ec_secp384r1.c \
91	src/ec/ec_secp521r1.c \
92	src/ec/ecdsa_atr.c \
93	src/ec/ecdsa_default_sign_asn1.c \
94	src/ec/ecdsa_default_sign_raw.c \
95	src/ec/ecdsa_default_vrfy_asn1.c \
96	src/ec/ecdsa_default_vrfy_raw.c \
97	src/ec/ecdsa_i15_bits.c \
98	src/ec/ecdsa_i15_sign_asn1.c \
99	src/ec/ecdsa_i15_sign_raw.c \
100	src/ec/ecdsa_i15_vrfy_asn1.c \
101	src/ec/ecdsa_i15_vrfy_raw.c \
102	src/ec/ecdsa_i31_bits.c \
103	src/ec/ecdsa_i31_sign_asn1.c \
104	src/ec/ecdsa_i31_sign_raw.c \
105	src/ec/ecdsa_i31_vrfy_asn1.c \
106	src/ec/ecdsa_i31_vrfy_raw.c \
107	src/ec/ecdsa_rta.c \
108	src/hash/dig_oid.c \
109	src/hash/dig_size.c \
110	src/hash/ghash_ctmul.c \
111	src/hash/ghash_ctmul32.c \
112	src/hash/ghash_ctmul64.c \
113	src/hash/ghash_pclmul.c \
114	src/hash/ghash_pwr8.c \
115	src/hash/md5.c \
116	src/hash/md5sha1.c \
117	src/hash/mgf1.c \
118	src/hash/multihash.c \
119	src/hash/sha1.c \
120	src/hash/sha2big.c \
121	src/hash/sha2small.c \
122	src/int/i15_add.c \
123	src/int/i15_bitlen.c \
124	src/int/i15_decmod.c \
125	src/int/i15_decode.c \
126	src/int/i15_decred.c \
127	src/int/i15_encode.c \
128	src/int/i15_fmont.c \
129	src/int/i15_iszero.c \
130	src/int/i15_moddiv.c \
131	src/int/i15_modpow.c \
132	src/int/i15_modpow2.c \
133	src/int/i15_montmul.c \
134	src/int/i15_mulacc.c \
135	src/int/i15_muladd.c \
136	src/int/i15_ninv15.c \
137	src/int/i15_reduce.c \
138	src/int/i15_rshift.c \
139	src/int/i15_sub.c \
140	src/int/i15_tmont.c \
141	src/int/i31_add.c \
142	src/int/i31_bitlen.c \
143	src/int/i31_decmod.c \
144	src/int/i31_decode.c \
145	src/int/i31_decred.c \
146	src/int/i31_encode.c \
147	src/int/i31_fmont.c \
148	src/int/i31_iszero.c \
149	src/int/i31_moddiv.c \
150	src/int/i31_modpow.c \
151	src/int/i31_modpow2.c \
152	src/int/i31_montmul.c \
153	src/int/i31_mulacc.c \
154	src/int/i31_muladd.c \
155	src/int/i31_ninv31.c \
156	src/int/i31_reduce.c \
157	src/int/i31_rshift.c \
158	src/int/i31_sub.c \
159	src/int/i31_tmont.c \
160	src/int/i32_add.c \
161	src/int/i32_bitlen.c \
162	src/int/i32_decmod.c \
163	src/int/i32_decode.c \
164	src/int/i32_decred.c \
165	src/int/i32_div32.c \
166	src/int/i32_encode.c \
167	src/int/i32_fmont.c \
168	src/int/i32_iszero.c \
169	src/int/i32_modpow.c \
170	src/int/i32_montmul.c \
171	src/int/i32_mulacc.c \
172	src/int/i32_muladd.c \
173	src/int/i32_ninv32.c \
174	src/int/i32_reduce.c \
175	src/int/i32_sub.c \
176	src/int/i32_tmont.c \
177	src/int/i62_modpow2.c \
178	src/kdf/hkdf.c \
179	src/kdf/shake.c \
180	src/mac/hmac.c \
181	src/mac/hmac_ct.c \
182	src/rand/aesctr_drbg.c \
183	src/rand/hmac_drbg.c \
184	src/rand/sysrng.c \
185	src/rsa/rsa_default_keygen.c \
186	src/rsa/rsa_default_modulus.c \
187	src/rsa/rsa_default_oaep_decrypt.c \
188	src/rsa/rsa_default_oaep_encrypt.c \
189	src/rsa/rsa_default_pkcs1_sign.c \
190	src/rsa/rsa_default_pkcs1_vrfy.c \
191	src/rsa/rsa_default_priv.c \
192	src/rsa/rsa_default_privexp.c \
193	src/rsa/rsa_default_pss_sign.c \
194	src/rsa/rsa_default_pss_vrfy.c \
195	src/rsa/rsa_default_pub.c \
196	src/rsa/rsa_default_pubexp.c \
197	src/rsa/rsa_i15_keygen.c \
198	src/rsa/rsa_i15_modulus.c \
199	src/rsa/rsa_i15_oaep_decrypt.c \
200	src/rsa/rsa_i15_oaep_encrypt.c \
201	src/rsa/rsa_i15_pkcs1_sign.c \
202	src/rsa/rsa_i15_pkcs1_vrfy.c \
203	src/rsa/rsa_i15_priv.c \
204	src/rsa/rsa_i15_privexp.c \
205	src/rsa/rsa_i15_pss_sign.c \
206	src/rsa/rsa_i15_pss_vrfy.c \
207	src/rsa/rsa_i15_pub.c \
208	src/rsa/rsa_i15_pubexp.c \
209	src/rsa/rsa_i31_keygen.c \
210	src/rsa/rsa_i31_keygen_inner.c \
211	src/rsa/rsa_i31_modulus.c \
212	src/rsa/rsa_i31_oaep_decrypt.c \
213	src/rsa/rsa_i31_oaep_encrypt.c \
214	src/rsa/rsa_i31_pkcs1_sign.c \
215	src/rsa/rsa_i31_pkcs1_vrfy.c \
216	src/rsa/rsa_i31_priv.c \
217	src/rsa/rsa_i31_privexp.c \
218	src/rsa/rsa_i31_pss_sign.c \
219	src/rsa/rsa_i31_pss_vrfy.c \
220	src/rsa/rsa_i31_pub.c \
221	src/rsa/rsa_i31_pubexp.c \
222	src/rsa/rsa_i32_oaep_decrypt.c \
223	src/rsa/rsa_i32_oaep_encrypt.c \
224	src/rsa/rsa_i32_pkcs1_sign.c \
225	src/rsa/rsa_i32_pkcs1_vrfy.c \
226	src/rsa/rsa_i32_priv.c \
227	src/rsa/rsa_i32_pss_sign.c \
228	src/rsa/rsa_i32_pss_vrfy.c \
229	src/rsa/rsa_i32_pub.c \
230	src/rsa/rsa_i62_keygen.c \
231	src/rsa/rsa_i62_oaep_decrypt.c \
232	src/rsa/rsa_i62_oaep_encrypt.c \
233	src/rsa/rsa_i62_pkcs1_sign.c \
234	src/rsa/rsa_i62_pkcs1_vrfy.c \
235	src/rsa/rsa_i62_priv.c \
236	src/rsa/rsa_i62_pss_sign.c \
237	src/rsa/rsa_i62_pss_vrfy.c \
238	src/rsa/rsa_i62_pub.c \
239	src/rsa/rsa_oaep_pad.c \
240	src/rsa/rsa_oaep_unpad.c \
241	src/rsa/rsa_pkcs1_sig_pad.c \
242	src/rsa/rsa_pkcs1_sig_unpad.c \
243	src/rsa/rsa_pss_sig_pad.c \
244	src/rsa/rsa_pss_sig_unpad.c \
245	src/rsa/rsa_ssl_decrypt.c \
246	src/ssl/prf.c \
247	src/ssl/prf_md5sha1.c \
248	src/ssl/prf_sha256.c \
249	src/ssl/prf_sha384.c \
250	src/ssl/ssl_ccert_single_ec.c \
251	src/ssl/ssl_ccert_single_rsa.c \
252	src/ssl/ssl_client.c \
253	src/ssl/ssl_client_default_rsapub.c \
254	src/ssl/ssl_client_full.c \
255	src/ssl/ssl_engine.c \
256	src/ssl/ssl_engine_default_aescbc.c \
257	src/ssl/ssl_engine_default_aesccm.c \
258	src/ssl/ssl_engine_default_aesgcm.c \
259	src/ssl/ssl_engine_default_chapol.c \
260	src/ssl/ssl_engine_default_descbc.c \
261	src/ssl/ssl_engine_default_ec.c \
262	src/ssl/ssl_engine_default_ecdsa.c \
263	src/ssl/ssl_engine_default_rsavrfy.c \
264	src/ssl/ssl_hashes.c \
265	src/ssl/ssl_hs_client.c \
266	src/ssl/ssl_hs_server.c \
267	src/ssl/ssl_io.c \
268	src/ssl/ssl_keyexport.c \
269	src/ssl/ssl_lru.c \
270	src/ssl/ssl_rec_cbc.c \
271	src/ssl/ssl_rec_ccm.c \
272	src/ssl/ssl_rec_chapol.c \
273	src/ssl/ssl_rec_gcm.c \
274	src/ssl/ssl_scert_single_ec.c \
275	src/ssl/ssl_scert_single_rsa.c \
276	src/ssl/ssl_server.c \
277	src/ssl/ssl_server_full_ec.c \
278	src/ssl/ssl_server_full_rsa.c \
279	src/ssl/ssl_server_mine2c.c \
280	src/ssl/ssl_server_mine2g.c \
281	src/ssl/ssl_server_minf2c.c \
282	src/ssl/ssl_server_minf2g.c \
283	src/ssl/ssl_server_minr2g.c \
284	src/ssl/ssl_server_minu2g.c \
285	src/ssl/ssl_server_minv2g.c \
286	src/symcipher/aes_big_cbcdec.c \
287	src/symcipher/aes_big_cbcenc.c \
288	src/symcipher/aes_big_ctr.c \
289	src/symcipher/aes_big_ctrcbc.c \
290	src/symcipher/aes_big_dec.c \
291	src/symcipher/aes_big_enc.c \
292	src/symcipher/aes_common.c \
293	src/symcipher/aes_ct.c \
294	src/symcipher/aes_ct64.c \
295	src/symcipher/aes_ct64_cbcdec.c \
296	src/symcipher/aes_ct64_cbcenc.c \
297	src/symcipher/aes_ct64_ctr.c \
298	src/symcipher/aes_ct64_ctrcbc.c \
299	src/symcipher/aes_ct64_dec.c \
300	src/symcipher/aes_ct64_enc.c \
301	src/symcipher/aes_ct_cbcdec.c \
302	src/symcipher/aes_ct_cbcenc.c \
303	src/symcipher/aes_ct_ctr.c \
304	src/symcipher/aes_ct_ctrcbc.c \
305	src/symcipher/aes_ct_dec.c \
306	src/symcipher/aes_ct_enc.c \
307	src/symcipher/aes_pwr8.c \
308	src/symcipher/aes_pwr8_cbcdec.c \
309	src/symcipher/aes_pwr8_cbcenc.c \
310	src/symcipher/aes_pwr8_ctr.c \
311	src/symcipher/aes_pwr8_ctrcbc.c \
312	src/symcipher/aes_small_cbcdec.c \
313	src/symcipher/aes_small_cbcenc.c \
314	src/symcipher/aes_small_ctr.c \
315	src/symcipher/aes_small_ctrcbc.c \
316	src/symcipher/aes_small_dec.c \
317	src/symcipher/aes_small_enc.c \
318	src/symcipher/aes_x86ni.c \
319	src/symcipher/aes_x86ni_cbcdec.c \
320	src/symcipher/aes_x86ni_cbcenc.c \
321	src/symcipher/aes_x86ni_ctr.c \
322	src/symcipher/aes_x86ni_ctrcbc.c \
323	src/symcipher/chacha20_ct.c \
324	src/symcipher/chacha20_sse2.c \
325	src/symcipher/des_ct.c \
326	src/symcipher/des_ct_cbcdec.c \
327	src/symcipher/des_ct_cbcenc.c \
328	src/symcipher/des_support.c \
329	src/symcipher/des_tab.c \
330	src/symcipher/des_tab_cbcdec.c \
331	src/symcipher/des_tab_cbcenc.c \
332	src/symcipher/poly1305_ctmul.c \
333	src/symcipher/poly1305_ctmul32.c \
334	src/symcipher/poly1305_ctmulq.c \
335	src/symcipher/poly1305_i15.c \
336	src/x509/asn1enc.c \
337	src/x509/encode_ec_pk8der.c \
338	src/x509/encode_ec_rawder.c \
339	src/x509/encode_rsa_pk8der.c \
340	src/x509/encode_rsa_rawder.c \
341	src/x509/skey_decoder.c \
342	src/x509/x509_decoder.c \
343	src/x509/x509_knownkey.c \
344	src/x509/x509_minimal.c \
345	src/x509/x509_minimal_full.c"
346
347# Source files for the 'brssl' command-line tool.
348toolssrc=" \
349	tools/brssl.c \
350	tools/certs.c \
351	tools/chain.c \
352	tools/client.c \
353	tools/errors.c \
354	tools/files.c \
355	tools/impl.c \
356	tools/keys.c \
357	tools/names.c \
358	tools/server.c \
359	tools/skey.c \
360	tools/sslio.c \
361	tools/ta.c \
362	tools/twrch.c \
363	tools/vector.c \
364	tools/verify.c \
365	tools/xmem.c"
366
367# Source files the the 'testcrypto' command-line tool.
368testcryptosrc=" \
369	test/test_crypto.c"
370
371# Source files the the 'testspeed' command-line tool.
372testspeedsrc=" \
373	test/test_speed.c"
374
375# Source files the the 'testx509' command-line tool.
376testx509src=" \
377	test/test_x509.c"
378
379# Public header files.
380headerspub=" \
381	inc/bearssl.h \
382	inc/bearssl_aead.h \
383	inc/bearssl_block.h \
384	inc/bearssl_ec.h \
385	inc/bearssl_hash.h \
386	inc/bearssl_hmac.h \
387	inc/bearssl_kdf.h \
388	inc/bearssl_pem.h \
389	inc/bearssl_prf.h \
390	inc/bearssl_rand.h \
391	inc/bearssl_rsa.h \
392	inc/bearssl_ssl.h \
393	inc/bearssl_x509.h"
394
395# Private header files.
396headerspriv=" \
397	src/config.h \
398	src/inner.h"
399
400# Header files for the 'brssl' command-line tool.
401headerstools=" \
402	tools/brssl.h"
403
404# T0 compiler source code.
405t0compsrc=" \
406	T0/BlobWriter.cs \
407	T0/CPU.cs \
408	T0/CodeElement.cs \
409	T0/CodeElementJump.cs \
410	T0/CodeElementUInt.cs \
411	T0/CodeElementUIntExpr.cs \
412	T0/CodeElementUIntInt.cs \
413	T0/CodeElementUIntUInt.cs \
414	T0/ConstData.cs \
415	T0/Opcode.cs \
416	T0/OpcodeCall.cs \
417	T0/OpcodeConst.cs \
418	T0/OpcodeGetLocal.cs \
419	T0/OpcodeJump.cs \
420	T0/OpcodeJumpIf.cs \
421	T0/OpcodeJumpIfNot.cs \
422	T0/OpcodeJumpUncond.cs \
423	T0/OpcodePutLocal.cs \
424	T0/OpcodeRet.cs \
425	T0/SType.cs \
426	T0/T0Comp.cs \
427	T0/TPointerBase.cs \
428	T0/TPointerBlob.cs \
429	T0/TPointerExpr.cs \
430	T0/TPointerNull.cs \
431	T0/TPointerXT.cs \
432	T0/TValue.cs \
433	T0/Word.cs \
434	T0/WordBuilder.cs \
435	T0/WordData.cs \
436	T0/WordInterpreted.cs \
437	T0/WordNative.cs"
438
439t0compkern=" \
440	T0/kern.t0"
441
442# Function to turn slashes into $P (macro for path separator).
443escsep() {
444	printf '%s' "$1" | sed 's/\//$P/g'
445}
446
447# Create rules file.
448rm -f Rules.mk
449cat > Rules.mk <<EOF
450# Automatically generated rules. Use 'mkrules.sh' to modify/regenerate.
451EOF
452
453(printf "\nOBJ ="
454for f in $coresrc ; do
455	printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
456done
457printf "\nOBJBRSSL ="
458for f in $toolssrc ; do
459	printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
460done
461printf "\nOBJTESTCRYPTO ="
462for f in $testcryptosrc ; do
463	printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
464done
465printf "\nOBJTESTSPEED ="
466for f in $testspeedsrc ; do
467	printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
468done
469printf "\nOBJTESTX509 ="
470for f in $testx509src ; do
471	printf ' \\\n $(OBJDIR)$P%s' "$(basename "$f" .c)\$O"
472done
473printf "\nHEADERSPUB ="
474for f in $headerspub ; do
475	printf " %s" "$(escsep "$f")"
476done
477printf "\nHEADERSPRIV = %s" '$(HEADERSPUB)'
478for f in $headerspriv ; do
479	printf " %s" "$(escsep "$f")"
480done
481printf "\nHEADERSTOOLS = %s" '$(HEADERSPUB)'
482for f in $headerstools ; do
483	printf " %s" "$(escsep "$f")"
484done
485printf "\nT0SRC ="
486for f in $t0compsrc ; do
487	printf " %s" "$(escsep "$f")"
488done
489printf "\nT0KERN ="
490for f in $t0kernsrc ; do
491	printf " %s" "$(escsep "$f")"
492done
493printf "\n") >> Rules.mk
494
495cat >> Rules.mk <<EOF
496
497all: \$(STATICLIB) \$(DLL) \$(TOOLS) \$(TESTS)
498
499no:
500
501lib: \$(BEARSSLLIB)
502
503dll: \$(BEARSSLDLL)
504
505tools: \$(BRSSL)
506
507tests: \$(TESTCRYPTO) \$(TESTSPEED) \$(TESTX509)
508
509T0: kT0
510
511kT0: \$(T0COMP) src\$Pssl\$Pssl_hs_common.t0 src\$Pssl\$Pssl_hs_client.t0 src\$Pssl\$Pssl_hs_server.t0 src\$Px509\$Pasn1.t0 src\$Px509\$Pskey_decoder.t0 src\$Px509\$Px509_decoder.t0 src\$Px509\$Px509_minimal.t0
512	\$(RUNT0COMP) -o src\$Pcodec\$Ppemdec -r br_pem_decoder src\$Pcodec\$Ppemdec.t0
513	\$(RUNT0COMP) -o src\$Pssl\$Pssl_hs_client -r br_ssl_hs_client src\$Pssl\$Pssl_hs_common.t0 src\$Pssl\$Pssl_hs_client.t0
514	\$(RUNT0COMP) -o src\$Pssl\$Pssl_hs_server -r br_ssl_hs_server src\$Pssl\$Pssl_hs_common.t0 src\$Pssl\$Pssl_hs_server.t0
515	\$(RUNT0COMP) -o src\$Px509\$Pskey_decoder -r br_skey_decoder src\$Px509\$Pasn1.t0 src\$Px509\$Pskey_decoder.t0
516	\$(RUNT0COMP) -o src\$Px509\$Px509_decoder -r br_x509_decoder src\$Px509\$Pasn1.t0 src\$Px509\$Px509_decoder.t0
517	\$(RUNT0COMP) -o src\$Px509\$Px509_minimal -r br_x509_minimal src\$Px509\$Pasn1.t0 src\$Px509\$Px509_minimal.t0
518
519\$(T0COMP): \$(T0SRC) \$(T0KERN)
520	\$(MKT0COMP)
521
522clean:
523	-\$(RM) \$(OBJDIR)\$P*\$O
524	-\$(RM) \$(BEARSSLLIB) \$(BEARSSLDLL) \$(BRSSL) \$(TESTCRYPTO) \$(TESTSPEED) \$(TESTX509)
525
526\$(OBJDIR):
527	-\$(MKDIR) \$(OBJDIR)
528
529\$(BEARSSLLIB): \$(OBJDIR) \$(OBJ)
530	\$(AR) \$(ARFLAGS) \$(AROUT)\$(BEARSSLLIB) \$(OBJ)
531
532\$(BEARSSLDLL): \$(OBJDIR) \$(OBJ)
533	\$(LDDLL) \$(LDDLLFLAGS) \$(LDDLLOUT)\$(BEARSSLDLL) \$(OBJ)
534
535\$(BRSSL): \$(BEARSSLLIB) \$(OBJBRSSL)
536	\$(LD) \$(LDFLAGS) \$(LDOUT)\$(BRSSL) \$(OBJBRSSL) \$(BEARSSLLIB)
537
538\$(TESTCRYPTO): \$(BEARSSLLIB) \$(OBJTESTCRYPTO)
539	\$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTCRYPTO) \$(OBJTESTCRYPTO) \$(BEARSSLLIB)
540
541\$(TESTSPEED): \$(BEARSSLLIB) \$(OBJTESTSPEED)
542	\$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTSPEED) \$(OBJTESTSPEED) \$(BEARSSLLIB)
543
544\$(TESTX509): \$(BEARSSLLIB) \$(OBJTESTX509)
545	\$(LD) \$(LDFLAGS) \$(LDOUT)\$(TESTX509) \$(OBJTESTX509) \$(BEARSSLLIB)
546EOF
547
548(for f in $coresrc ; do
549	b="$(basename "$f" .c)\$O"
550	g="$(escsep "$f")"
551	printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
552done
553
554for f in $toolssrc ; do
555	b="$(basename "$f" .c)\$O"
556	g="$(escsep "$f")"
557	printf '\n$(OBJDIR)$P%s: %s $(HEADERSTOOLS)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
558done
559
560for f in $testcryptosrc $testspeedsrc ; do
561	b="$(basename "$f" .c)\$O"
562	g="$(escsep "$f")"
563	printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
564done
565
566for f in $testx509src ; do
567	b="$(basename "$f" .c)\$O"
568	g="$(escsep "$f")"
569	printf '\n$(OBJDIR)$P%s: %s $(HEADERSPRIV)\n\t$(CC) $(CFLAGS) $(INCFLAGS) -DSRCDIRNAME=".." $(CCOUT)$(OBJDIR)$P%s %s\n' "$b" "$g" "$b" "$g"
570done) >> Rules.mk
571