Makefile revision 1.19
1#	$OpenBSD: Makefile,v 1.19 2023/01/21 13:24:39 jsing 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_mul
12PROGS +=	bn_primes
13PROGS +=	bn_rand_interval
14PROGS +=	bn_shift
15PROGS +=	bn_test
16PROGS +=	bn_to_string
17PROGS +=	bn_unit
18
19STATIC_LINK +=	bn_isqrt
20STATIC_LINK +=	bn_mod_exp
21STATIC_LINK +=	bn_mod_exp_zero
22STATIC_LINK +=	bn_primes
23STATIC_LINK +=	bn_rand_interval
24STATIC_LINK +=	bn_test
25STATIC_LINK +=	bn_to_string
26
27LDADD =		-lcrypto
28DPADD =		${LIBCRYPTO}
29WARNINGS =	Yes
30CFLAGS +=	-Wall -Wundef -Werror
31CFLAGS +=	-I${.CURDIR}/../../../../lib/libcrypto/bn/
32
33# Use default targets from bsd.regress.mk unless overridden below
34REGRESS_TARGETS = ${PROGS:S/^/run-regress-/}
35
36# Verify that the bn_isqrt -C output isn't changed by accident.
37isqrt-print-tables: bn_isqrt
38	@./bn_isqrt -C
39.PHONY: isqrt-print-tables
40
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
50CLEANFILES += bn_isqrt_gen_tables.txt.tmp bn_isqrt_gen_tables.txt
51
52# bn_test is special, so override bsd.regress.mk's run-regress-bn_test
53run-regress-bn_test bntest.out: bn_test
54	./bn_test -out bn_test.out
55
56REGRESS_TARGETS +=	run-bc
57.PHONY: 		run-bc
58run-bc: bn_test.out
59	bc < $> | tee bc.out | grep -v '^0$$'
60	! grep -v '^test ' <bc.out | grep -v '^0$$'
61
62CLEANFILES +=	bn_test.out bc.out
63
64benchmark: bn_mul bn_shift
65	./bn_mul --benchmark
66	./bn_shift --benchmark
67.PHONY: benchmark
68
69.for p in ${STATIC_LINK}
70LDADD_$p +=	${CRYPTO_INT}
71.endfor
72
73.include <bsd.regress.mk>
74