xref: /freebsd/sys/modules/blake2/Makefile (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1
2.PATH:	${SRCTOP}/sys/contrib/libb2
3.PATH:	${SRCTOP}/sys/crypto/blake2
4.PATH:	${SRCTOP}/sys/opencrypto
5.PATH:	${SRCTOP}/contrib/llvm-project/clang/lib/Headers
6
7KMOD	= blake2
8
9# Vendor sources
10SRCS	+= blake2.h
11SRCS	+= blake2-impl.h
12SRCS	+= blake2-config.h
13
14SRCS	+= blake2-dispatch.c
15SRCS	+= blake2bp.c
16SRCS	+= blake2sp.c
17
18CFLAGS	+= -I${SRCTOP}/sys/contrib/libb2
19CFLAGS	+= -I${SRCTOP}/sys/crypto/blake2
20
21# x86 specific optimization headers:
22SRCS	+= blake2b-load-sse2.h
23SRCS	+= blake2b-load-sse41.h
24SRCS	+= blake2b-round.h
25
26SRCS	+= blake2s-load-sse2.h
27SRCS	+= blake2s-load-sse41.h
28SRCS	+= blake2s-load-xop.h
29SRCS	+= blake2s-round.h
30
31# C files to build a dispatched fat implementation on x86
32SRCS_IN	+= blake2b-sse2.c
33SRCS_IN	+= blake2b-ssse3.c
34SRCS_IN	+= blake2b-sse41.c
35SRCS_IN	+= blake2b-avx.c
36SRCS_IN	+= blake2b-xop.c
37SRCS_IN	+= blake2s-sse2.c
38SRCS_IN	+= blake2s-ssse3.c
39SRCS_IN	+= blake2s-sse41.c
40SRCS_IN	+= blake2s-avx.c
41SRCS_IN	+= blake2s-xop.c
42
43OBJS+=	${SRCS_IN:S/.c/.o/g}
44
45CFLAGS.blake2b-sse2.c	+= -DSUFFIX=_sse2 -msse2
46CFLAGS.blake2s-sse2.c	+= -DSUFFIX=_sse2 -msse2
47
48CFLAGS.blake2b-ssse3.c	+= -DSUFFIX=_ssse3 -msse2 -mssse3
49CFLAGS.blake2s-ssse3.c	+= -DSUFFIX=_ssse3 -msse2 -mssse3
50
51CFLAGS.blake2b-sse41.c	+= -DSUFFIX=_sse41 -msse2 -mssse3 -msse4.1
52CFLAGS.blake2s-sse41.c	+= -DSUFFIX=_sse41 -msse2 -mssse3 -msse4.1
53
54CFLAGS.blake2b-avx.c	+= -DSUFFIX=_avx -msse2 -mssse3 -msse4.1 -mavx
55CFLAGS.blake2s-avx.c	+= -DSUFFIX=_avx -msse2 -mssse3 -msse4.1 -mavx
56
57CFLAGS.blake2b-xop.c	+= -DSUFFIX=_xop -msse2 -mssse3 -msse4.1 -mavx -mxop
58CFLAGS.blake2s-xop.c	+= -DSUFFIX=_xop -msse2 -mssse3 -msse4.1 -mavx -mxop
59
60.for src in ${SRCS_IN}
61${src:S/.c/.o/}: ${src}
62	${CC} -c ${CFLAGS:N-nostdinc} ${CFLAGS.${src}} ${WERROR} ${PROF} \
63	    -D_MM_MALLOC_H_INCLUDED -Wno-unused-function ${.IMPSRC}
64	${CTFCONVERT_CMD}
65
66${src:S/.c/.o/}: intrin.h emmintrin.h tmmintrin.h smmintrin.h immintrin.h \
67    x86intrin.h ${SRCS:M*.h}
68.endfor
69
70# FreeBSD-specific sources:
71SRCS	+= blake2_kfreebsd.h
72SRCS	+= config.h
73
74SRCS	+= stddef.h
75SRCS	+= stdint.h
76SRCS	+= stdio.h
77SRCS	+= stdlib.h
78SRCS	+= string.h
79
80SRCS	+= blake2_cryptodev.c
81
82SRCS	+= opt_param.h cryptodev_if.h bus_if.h device_if.h
83
84WARNS	?= 6
85
86.include <bsd.kmod.mk>
87
88CWARNFLAGS.blake2-dispatch.c	+=	-Wno-unused-const-variable
89CWARNFLAGS.blake2s-ref.c	+= 	-Wno-cast-qual -Wno-unused-function
90CWARNFLAGS			+=	-Wno-cast-qual
91