Makefile revision 1.15
1#	$OpenBSD: Makefile,v 1.15 2022/12/02 17:34:26 tb Exp $
2
3PROGS +=	bn_add_sub
4PROGS +=	bn_cmp
5PROGS +=	bn_isqrt
6PROGS +=	bn_mod_exp
7PROGS +=	bn_mod_exp2_mont
8PROGS +=	bn_mod_exp_zero
9PROGS +=	bn_mod_sqrt
10PROGS +=	bn_mont
11PROGS +=	bn_primes
12PROGS +=	bn_rand_interval
13PROGS +=	bn_to_string
14PROGS +=	bn_unit
15
16STATIC_LINK +=	bn_isqrt
17STATIC_LINK +=	bn_mod_exp
18STATIC_LINK +=	bn_mod_exp_zero
19STATIC_LINK +=	bn_primes
20STATIC_LINK +=	bn_rand_interval
21STATIC_LINK +=	bn_to_string
22
23LDADD =		-lcrypto
24DPADD =		${LIBCRYPTO}
25WARNINGS =	Yes
26CFLAGS +=	-Wall -Wundef -Werror
27CFLAGS +=	-I${.CURDIR}/../../../../lib/libcrypto/bn/
28
29.for p in ${PROGS}
30REGRESS_TARGETS +=	run-$p
31.PHONY: 		run-$p
32
33run-$p: $p
34	./$p
35.endfor
36
37# Verify that the bn_isqrt -C output isn't changed by accident.
38isqrt-print-tables: bn_isqrt
39	@./bn_isqrt -C
40.PHONY: isqrt-print-tables
41
42CLEANFILES += bn_isqrt_gen_tables.txt.tmp bn_isqrt_gen_tables.txt
43bn_isqrt_gen_tables.txt: bn_isqrt
44	${.MAKE} -C ${.CURDIR} isqrt-print-tables > $@.tmp
45	mv -f $@.tmp $@
46
47REGRESS_TARGETS +=	run-bn_isqrt_check_tables
48.PHONY:			run-bn_isqrt_check_tables
49run-bn_isqrt_check_tables: bn_isqrt_gen_tables.txt
50	diff -pu ${.CURDIR}/bn_isqrt_tables.txt bn_isqrt_gen_tables.txt
51
52# Keep bn_test last since it is special
53PROGS +=	bn_test
54STATIC_LINK +=	bn_test
55CLEANFILES +=	bn_test.out bc.out
56
57REGRESS_TARGETS +=	run-bn_test
58.PHONY: 		run-bn_test
59run-bn_test bntest.out: bn_test
60	./bn_test -out bn_test.out
61
62REGRESS_TARGETS +=	run-bc
63.PHONY: 		run-bc
64run-bc: bn_test.out
65	bc < $> | tee bc.out | grep -v '^0$$'
66	! grep -v '^test ' <bc.out | grep -v '^0$$'
67
68.for p in ${STATIC_LINK}
69LDADD_$p +=	${CRYPTO_INT}
70.endfor
71
72.include <bsd.regress.mk>
73