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