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