xref: /freebsd/cddl/lib/libicp_rescue/Makefile (revision 5b56413d04e608379c9a306373554a8e4d321bc0)
1.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
2
3PACKAGE=	utilities
4LIB=	icp_rescue
5LIBADD=
6
7.if ${MACHINE_ARCH} == "amd64"
8ASM_SOURCES_C = asm-x86_64/aes/aeskey.c
9ASM_SOURCES_AS = \
10        asm-x86_64/aes/aes_amd64.S \
11        asm-x86_64/aes/aes_aesni.S \
12        asm-x86_64/modes/gcm_pclmulqdq.S \
13        asm-x86_64/modes/aesni-gcm-x86_64.S \
14        asm-x86_64/sha2/sha256-x86_64.S \
15        asm-x86_64/sha2/sha512-x86_64.S \
16        asm-x86_64/blake3/blake3_avx2.S \
17        asm-x86_64/blake3/blake3_avx512.S \
18        asm-x86_64/blake3/blake3_sse2.S \
19        asm-x86_64/blake3/blake3_sse41.S
20
21CFLAGS+= -D__amd64 -D_SYS_STACK_H
22.elif ${MACHINE_CPUARCH} == "arm"
23ASM_SOURCES_C =
24ASM_SOURCES_AS = \
25        asm-arm/sha2/sha256-armv7.S \
26        asm-arm/sha2/sha512-armv7.S
27.elif ${MACHINE_ARCH} == "aarch64"
28ASM_SOURCES_C =
29ASM_SOURCES_AS = \
30        asm-aarch64/blake3/b3_aarch64_sse2.S \
31        asm-aarch64/blake3/b3_aarch64_sse41.S \
32        asm-aarch64/sha2/sha256-armv8.S \
33        asm-aarch64/sha2/sha512-armv8.S
34.elif ${MACHINE_ARCH} == "powerpc64"
35ASM_SOURCES_C =
36ASM_SOURCES_AS = \
37        asm-ppc64/sha2/sha256-ppc.S \
38        asm-ppc64/sha2/sha512-ppc.S \
39        asm-ppc64/sha2/sha256-p8.S \
40        asm-ppc64/sha2/sha512-p8.S
41.elif ${MACHINE_ARCH} == "powerpc64le"
42ASM_SOURCES_C =
43ASM_SOURCES_AS = \
44        asm-ppc64/blake3/b3_ppc64le_sse2.S \
45        asm-ppc64/blake3/b3_ppc64le_sse41.S \
46        asm-ppc64/sha2/sha256-ppc.S \
47        asm-ppc64/sha2/sha512-ppc.S \
48        asm-ppc64/sha2/sha256-p8.S \
49        asm-ppc64/sha2/sha512-p8.S
50.else
51ASM_SOURCES_C =
52ASM_SOURCES_AS =
53.endif
54
55KERNEL_C = \
56        spi/kcf_spi.c \
57        api/kcf_ctxops.c \
58        api/kcf_cipher.c \
59        api/kcf_mac.c \
60        algs/aes/aes_impl_aesni.c \
61        algs/aes/aes_impl_generic.c \
62        algs/aes/aes_impl_x86-64.c \
63        algs/aes/aes_impl.c \
64        algs/aes/aes_modes.c \
65        algs/blake3/blake3.c \
66        algs/blake3/blake3_generic.c \
67        algs/blake3/blake3_impl.c \
68        algs/edonr/edonr.c \
69        algs/modes/modes.c \
70        algs/modes/gcm_generic.c \
71        algs/modes/gcm_pclmulqdq.c \
72        algs/modes/gcm.c \
73        algs/modes/ccm.c \
74        algs/sha2/sha2_generic.c \
75        algs/sha2/sha256_impl.c \
76        algs/sha2/sha512_impl.c \
77        algs/skein/skein_block.c \
78        illumos-crypto.c \
79        io/aes.c \
80        io/sha2_mod.c \
81        core/kcf_sched.c \
82        core/kcf_prov_lib.c \
83        core/kcf_callprov.c \
84        core/kcf_mech_tabs.c \
85        core/kcf_prov_tabs.c \
86        $(ASM_SOURCES_C)
87
88.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zfs
89KERNEL_C+=	zfs_impl.c
90
91SRCS= $(ASM_SOURCES_AS) $(KERNEL_C)
92
93WARNS?=	2
94SHLIB_MAJOR= 3
95CSTD=	c99
96CFLAGS+= -DIN_BASE
97CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
98CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
99CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
100CFLAGS+= -I${SRCTOP}/sys
101CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
102CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
103CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
104CFLAGS+= -DHAVE_ISSETUGID -UHAVE_AVX -DRESCUE
105CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
106
107CFLAGS.aes_amd64.S+= -DLOCORE
108CFLAGS.aes_aesni.S+= -DLOCORE
109CFLAGS.gcm_pclmulqdq.S+= -DLOCORE
110CFLAGS.aesni-gcm-x86_64.S+= -DLOCORE
111CFLAGS.ghash-x86_64.S+= -DLOCORE
112CFLAGS.sha256-x86_64.S+= -DLOCORE
113CFLAGS.sha512-x86_64.S+= -DLOCORE
114CFLAGS.gcm.c+= -UCAN_USE_GCM_ASM
115CFLAGS.blake3_avx2.S = -DLOCORE
116CFLAGS.blake3_avx512.S = -DLOCORE
117CFLAGS.blake3_sse2.S = -DLOCORE
118CFLAGS.blake3_sse41.S = -DLOCORE
119CFLAGS.b3_aarch64_sse2.S = -DLOCORE
120CFLAGS.b3_aarch64_sse41.S = -DLOCORE
121CFLAGS.sha256-armv7.S = -DLOCORE
122CFLAGS.sha512-armv7.S = -DLOCORE
123CFLAGS.sha256-armv8.S = -DLOCORE
124CFLAGS.sha512-armv8.S = -DLOCORE
125CFLAGS.b3_ppc64le_sse2.S = -DLOCORE
126CFLAGS.b3_ppc64le_sse41.S = -DLOCORE
127CFLAGS.sha256-ppc.S = -DLOCORE
128CFLAGS.sha256-p8.S = -DLOCORE
129CFLAGS.sha512-ppc.S = -DLOCORE
130CFLAGS.sha512-p8.S = -DLOCORE
131
132LDFLAGS.bfd+= -Wl,-znoexecstack
133
134.include <bsd.lib.mk>
135