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