summaryrefslogtreecommitdiff
path: root/regress/lib/libcrypto/bn/Makefile
blob: 2852b2e469475558bdb437fd3ab397e8d0ead053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#	$OpenBSD: Makefile,v 1.21 2023/01/31 05:13:28 jsing Exp $

PROGS +=	bn_add_sub
PROGS +=	bn_cmp
PROGS +=	bn_isqrt
PROGS +=	bn_mod_exp
PROGS +=	bn_mod_exp2_mont
PROGS +=	bn_mod_exp_zero
PROGS +=	bn_mod_sqrt
PROGS +=	bn_mont
PROGS +=	bn_mul_div
PROGS +=	bn_primes
PROGS +=	bn_rand_interval
PROGS +=	bn_shift
PROGS +=	bn_test
PROGS +=	bn_to_string
PROGS +=	bn_unit

STATIC_LINK +=	bn_isqrt
STATIC_LINK +=	bn_mod_exp
STATIC_LINK +=	bn_mod_exp_zero
STATIC_LINK +=	bn_primes
STATIC_LINK +=	bn_rand_interval
STATIC_LINK +=	bn_test
STATIC_LINK +=	bn_to_string

LDADD =		-lcrypto
DPADD =		${LIBCRYPTO}
WARNINGS =	Yes
CFLAGS +=	-Wall -Wundef -Werror
CFLAGS +=	-I${.CURDIR}/../../../../lib/libcrypto/bn/
CFLAGS +=	-I${.CURDIR}/../../../../lib/libcrypto/bn/arch/${MACHINE_CPU}/

# Use default targets from bsd.regress.mk unless overridden below
REGRESS_TARGETS = ${PROGS:S/^/run-regress-/}

# Verify that the bn_isqrt -C output isn't changed by accident.
isqrt-print-tables: bn_isqrt
	@./bn_isqrt -C
.PHONY: isqrt-print-tables

bn_isqrt_gen_tables.txt: bn_isqrt
	${.MAKE} -C ${.CURDIR} isqrt-print-tables > $@.tmp
	mv -f $@.tmp $@

REGRESS_TARGETS +=	run-bn_isqrt_check_tables
.PHONY:			run-bn_isqrt_check_tables
run-bn_isqrt_check_tables: bn_isqrt_gen_tables.txt
	diff -pu ${.CURDIR}/bn_isqrt_tables.txt bn_isqrt_gen_tables.txt

CLEANFILES += bn_isqrt_gen_tables.txt.tmp bn_isqrt_gen_tables.txt

# bn_test is special, so override bsd.regress.mk's run-regress-bn_test
run-regress-bn_test bntest.out: bn_test
	./bn_test -out bn_test.out

REGRESS_TARGETS +=	run-bc
.PHONY: 		run-bc
run-bc: bn_test.out
	bc < $> | tee bc.out | grep -v '^0$$'
	! grep -v '^test ' <bc.out | grep -v '^0$$'

CLEANFILES +=	bn_test.out bc.out

benchmark: bn_mul_div bn_shift
	./bn_mul_div --benchmark
	./bn_shift --benchmark
.PHONY: benchmark

.for p in ${STATIC_LINK}
LDADD_$p +=	${CRYPTO_INT}
.endfor

.include <bsd.regress.mk>