ZTS: Fix io_uring support check
[zfs.git] / module / Makefile.bsd
blob589ca60b29be85ef1d4bc242f1c7c89764e9b4ca
1 .if !defined(WITH_CTF)
2 WITH_CTF=1
3 .endif
5 .include <bsd.sys.mk>
7 SRCDIR=${.CURDIR}
8 INCDIR=${.CURDIR:H}/include
10 KMOD=   openzfs
12 .PATH:  ${SRCDIR}/avl \
13         ${SRCDIR}/icp/algs/blake3 \
14         ${SRCDIR}/icp/asm-aarch64/blake3 \
15         ${SRCDIR}/icp/asm-ppc64/blake3 \
16         ${SRCDIR}/icp/asm-x86_64/blake3 \
17         ${SRCDIR}/lua \
18         ${SRCDIR}/nvpair \
19         ${SRCDIR}/icp/algs/edonr \
20         ${SRCDIR}/os/freebsd/spl \
21         ${SRCDIR}/os/freebsd/zfs \
22         ${SRCDIR}/unicode \
23         ${SRCDIR}/zcommon \
24         ${SRCDIR}/zfs \
25         ${SRCDIR}/zstd \
26         ${SRCDIR}/zstd/lib/common \
27         ${SRCDIR}/zstd/lib/compress \
28         ${SRCDIR}/zstd/lib/decompress
32 CFLAGS+= -I${.OBJDIR:H}/include
33 CFLAGS+= -I${INCDIR}
34 CFLAGS+= -I${INCDIR}/os/freebsd
35 CFLAGS+= -I${INCDIR}/os/freebsd/spl
36 CFLAGS+= -I${INCDIR}/os/freebsd/zfs
37 CFLAGS+= -I${SRCDIR}/zstd/include
38 CFLAGS+= -I${SRCDIR}/icp/include
39 CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h
41 CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS  -D__BSD_VISIBLE=1 \
42          -DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \
43          -D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DSMP -DCOMPAT_FREEBSD11
45 .if ${MACHINE_ARCH} == "amd64"
46 CFLAGS+= -D__x86_64 -DHAVE_SSE2 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 \
47          -DHAVE_AVX -DHAVE_AVX2 -DHAVE_AVX512F -DHAVE_AVX512VL
48 .endif
50 .if defined(WITH_DEBUG) && ${WITH_DEBUG} == "true"
51 CFLAGS+= -DZFS_DEBUG -g
52 .if defined(WITH_INVARIANTS) && ${WITH_INVARIANTS} == "true"
53  CFLAGS+= -DINVARIANTS -DWITNESS -DOPENSOLARIS_WITNESS
54 .endif
55 .if defined(WITH_O0) && ${WITH_O0} == "true"
56  CFLAGS+= -O0
57 .endif
58 .else
59 CFLAGS += -DNDEBUG
60 .endif
62 .if defined(WITH_VFS_DEBUG) && ${WITH_VFS_DEBUG} == "true"
63 # kernel must also be built with this option for this to work
64 CFLAGS+= -DDEBUG_VFS_LOCKS
65 .endif
67 .if defined(WITH_GCOV) && ${WITH_GCOV} == "true"
68 CFLAGS+=         -fprofile-arcs -ftest-coverage
69 .endif
71 DEBUG_FLAGS=-g
73 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
74         ${MACHINE_ARCH} == "arm"
75 CFLAGS+= -DBITS_PER_LONG=32
76 .else
77 CFLAGS+= -DBITS_PER_LONG=64
78 .endif
80 SRCS=   vnode_if.h device_if.h bus_if.h
82 #avl
83 SRCS+=  avl.c
85 # icp
86 SRCS+=  edonr.c
88 #icp/algs/blake3
89 SRCS+=  blake3.c \
90         blake3_generic.c \
91         blake3_impl.c \
92         blake3_x86-64.c
94 #icp/asm-aarch64/blake3
95 SRCS+=  b3_aarch64_sse2.S \
96         b3_aarch64_sse41.S
98 #icp/asm-ppc64/blake3
99 SRCS+=  b3_ppc64le_sse2.S \
100         b3_ppc64le_sse41.S
102 #icp/asm-x86_64/blake3
103 SRCS+=  blake3_avx2.S \
104         blake3_avx512.S \
105         blake3_sse2.S \
106         blake3_sse41.S
108 #lua
109 SRCS+=  lapi.c \
110         lauxlib.c \
111         lbaselib.c \
112         lcode.c \
113         lcompat.c \
114         lcorolib.c \
115         lctype.c \
116         ldebug.c \
117         ldo.c \
118         lfunc.c \
119         lgc.c \
120         llex.c \
121         lmem.c \
122         lobject.c \
123         lopcodes.c \
124         lparser.c \
125         lstate.c \
126         lstring.c \
127         lstrlib.c \
128         ltable.c \
129         ltablib.c \
130         ltm.c \
131         lvm.c \
132         lzio.c
134 #nvpair
135 SRCS+=  nvpair.c \
136         fnvpair.c \
137         nvpair_alloc_spl.c \
138         nvpair_alloc_fixed.c
140 #os/freebsd/spl
141 SRCS+=  acl_common.c \
142         callb.c \
143         list.c \
144         sha256c.c \
145         sha512c.c \
146         spl_acl.c \
147         spl_cmn_err.c \
148         spl_dtrace.c \
149         spl_kmem.c \
150         spl_kstat.c \
151         spl_misc.c \
152         spl_policy.c \
153         spl_procfs_list.c \
154         spl_string.c \
155         spl_sunddi.c \
156         spl_sysevent.c \
157         spl_taskq.c \
158         spl_uio.c \
159         spl_vfs.c \
160         spl_vm.c \
161         spl_zlib.c \
162         spl_zone.c
165 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
166         ${MACHINE_ARCH} == "arm"
167 SRCS+= spl_atomic.c
168 .endif
170 #os/freebsd/zfs
171 SRCS+=  abd_os.c \
172         arc_os.c \
173         crypto_os.c \
174         dmu_os.c \
175         hkdf.c \
176         kmod_core.c \
177         spa_os.c \
178         sysctl_os.c \
179         vdev_file.c \
180         vdev_geom.c \
181         vdev_label_os.c \
182         zfs_acl.c \
183         zfs_ctldir.c \
184         zfs_debug.c \
185         zfs_dir.c \
186         zfs_ioctl_compat.c \
187         zfs_ioctl_os.c \
188         zfs_racct.c \
189         zfs_vfsops.c \
190         zfs_vnops_os.c \
191         zfs_znode.c \
192         zio_crypt.c \
193         zvol_os.c
195 #unicode
196 SRCS+=  uconv.c \
197         u8_textprep.c
199 #zcommon
200 SRCS+=  zfeature_common.c \
201         zfs_comutil.c \
202         zfs_deleg.c \
203         zfs_fletcher.c \
204         zfs_fletcher_avx512.c \
205         zfs_fletcher_intel.c \
206         zfs_fletcher_sse.c \
207         zfs_fletcher_superscalar.c \
208         zfs_fletcher_superscalar4.c \
209         zfs_namecheck.c \
210         zfs_prop.c \
211         zpool_prop.c \
212         zprop_common.c
214 #zfs
215 SRCS+=  abd.c \
216         aggsum.c \
217         arc.c \
218         blake3_zfs.c \
219         blkptr.c \
220         bplist.c \
221         bpobj.c \
222         btree.c \
223         cityhash.c \
224         dbuf.c \
225         dbuf_stats.c \
226         bptree.c \
227         bqueue.c \
228         dataset_kstats.c \
229         ddt.c \
230         ddt_zap.c \
231         dmu.c \
232         dmu_diff.c \
233         dmu_object.c \
234         dmu_objset.c \
235         dmu_recv.c \
236         dmu_redact.c \
237         dmu_send.c \
238         dmu_traverse.c \
239         dmu_tx.c \
240         dmu_zfetch.c \
241         dnode.c \
242         dnode_sync.c \
243         dsl_dataset.c \
244         dsl_deadlist.c \
245         dsl_deleg.c \
246         dsl_bookmark.c \
247         dsl_dir.c \
248         dsl_crypt.c \
249         dsl_destroy.c \
250         dsl_pool.c \
251         dsl_prop.c \
252         dsl_scan.c \
253         dsl_synctask.c \
254         dsl_userhold.c \
255         edonr_zfs.c \
256         fm.c \
257         gzip.c \
258         lzjb.c \
259         lz4.c \
260         lz4_zfs.c \
261         metaslab.c \
262         mmp.c \
263         multilist.c \
264         objlist.c \
265         pathname.c \
266         range_tree.c \
267         refcount.c \
268         rrwlock.c \
269         sa.c \
270         sha256.c \
271         skein_zfs.c \
272         spa.c \
273         spa_boot.c \
274         spa_checkpoint.c \
275         spa_config.c \
276         spa_errlog.c \
277         spa_history.c \
278         spa_log_spacemap.c \
279         spa_misc.c \
280         spa_stats.c \
281         space_map.c \
282         space_reftree.c \
283         txg.c \
284         uberblock.c \
285         unique.c \
286         vdev.c \
287         vdev_cache.c \
288         vdev_draid.c \
289         vdev_draid_rand.c \
290         vdev_indirect.c \
291         vdev_indirect_births.c \
292         vdev_indirect_mapping.c \
293         vdev_initialize.c \
294         vdev_label.c \
295         vdev_mirror.c \
296         vdev_missing.c \
297         vdev_queue.c \
298         vdev_raidz.c \
299         vdev_raidz_math.c \
300         vdev_raidz_math_scalar.c \
301         vdev_raidz_math_avx2.c \
302         vdev_raidz_math_avx512bw.c \
303         vdev_raidz_math_avx512f.c \
304         vdev_raidz_math_sse2.c \
305         vdev_raidz_math_ssse3.c \
306         vdev_rebuild.c \
307         vdev_removal.c \
308         vdev_root.c \
309         vdev_trim.c \
310         zap.c \
311         zap_leaf.c \
312         zap_micro.c \
313         zcp.c \
314         zcp_get.c \
315         zcp_global.c \
316         zcp_iter.c \
317         zcp_set.c \
318         zcp_synctask.c \
319         zfeature.c \
320         zfs_byteswap.c \
321         zfs_chksum.c \
322         zfs_file_os.c \
323         zfs_fm.c \
324         zfs_fuid.c \
325         zfs_ioctl.c \
326         zfs_log.c \
327         zfs_onexit.c \
328         zfs_quota.c \
329         zfs_ratelimit.c \
330         zfs_replay.c \
331         zfs_rlock.c \
332         zfs_sa.c \
333         zfs_vnops.c \
334         zil.c \
335         zio.c \
336         zio_checksum.c \
337         zio_compress.c \
338         zio_inject.c \
339         zle.c \
340         zrlock.c \
341         zthr.c \
342         zvol.c
344 #zstd
345 SRCS+=  zfs_zstd.c \
346         entropy_common.c \
347         error_private.c \
348         fse_decompress.c \
349         pool.c \
350         zstd_common.c \
351         fse_compress.c \
352         hist.c \
353         huf_compress.c \
354         zstd_compress.c \
355         zstd_compress_literals.c \
356         zstd_compress_sequences.c \
357         zstd_compress_superblock.c \
358         zstd_double_fast.c \
359         zstd_fast.c \
360         zstd_lazy.c \
361         zstd_ldm.c \
362         zstd_opt.c \
363         huf_decompress.c \
364         zstd_ddict.c \
365         zstd_decompress.c \
366         zstd_decompress_block.c
368 beforeinstall:
369 .if ${MK_DEBUG_FILES} != "no"
370         mtree -eu \
371             -f /etc/mtree/BSD.debug.dist \
372             -p ${DESTDIR}/usr/lib
373 .endif
375 .include <bsd.kmod.mk>
378 CFLAGS.gcc+= -Wno-pointer-to-int-cast
380 CFLAGS.lapi.c= -Wno-cast-qual
381 CFLAGS.lcompat.c= -Wno-cast-qual
382 CFLAGS.lobject.c= -Wno-cast-qual
383 CFLAGS.ltable.c= -Wno-cast-qual
384 CFLAGS.lvm.c= -Wno-cast-qual
385 CFLAGS.nvpair.c= -DHAVE_RPC_TYPES -Wno-cast-qual
386 CFLAGS.spl_string.c= -Wno-cast-qual
387 CFLAGS.spl_vm.c= -Wno-cast-qual
388 CFLAGS.spl_zlib.c= -Wno-cast-qual
389 CFLAGS.abd.c= -Wno-cast-qual
390 CFLAGS.zfs_log.c= -Wno-cast-qual
391 CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith
392 CFLAGS.u8_textprep.c= -Wno-cast-qual
393 CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith
394 CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith
395 CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith
396 CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith
397 CFLAGS.zprop_common.c= -Wno-cast-qual
398 CFLAGS.ddt.c= -Wno-cast-qual
399 CFLAGS.dmu.c= -Wno-cast-qual
400 CFLAGS.dmu_traverse.c= -Wno-cast-qual
401 CFLAGS.dsl_dir.c= -Wno-cast-qual
402 CFLAGS.dsl_deadlist.c= -Wno-cast-qual
403 CFLAGS.dsl_prop.c= -Wno-cast-qual
404 CFLAGS.edonr.c=-Wno-cast-qual
405 CFLAGS.fm.c= -Wno-cast-qual
406 CFLAGS.lz4_zfs.c= -Wno-cast-qual
407 CFLAGS.spa.c= -Wno-cast-qual
408 CFLAGS.spa_misc.c= -Wno-cast-qual
409 CFLAGS.sysctl_os.c= -include ../zfs_config.h
410 CFLAGS.vdev_draid.c= -Wno-cast-qual
411 CFLAGS.vdev_raidz.c= -Wno-cast-qual
412 CFLAGS.vdev_raidz_math.c= -Wno-cast-qual
413 CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual
414 CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
415 CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
416 CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
417 CFLAGS.zap_leaf.c= -Wno-cast-qual
418 CFLAGS.zap_micro.c= -Wno-cast-qual
419 CFLAGS.zcp.c= -Wno-cast-qual
420 CFLAGS.zfs_fm.c= -Wno-cast-qual
421 CFLAGS.zfs_ioctl.c= -Wno-cast-qual
422 CFLAGS.zil.c= -Wno-cast-qual
423 CFLAGS.zio.c= -Wno-cast-qual
424 CFLAGS.zrlock.c= -Wno-cast-qual
425 CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
426 CFLAGS.entropy_common.c= -fno-tree-vectorize -U__BMI__
427 CFLAGS.error_private.c= -fno-tree-vectorize -U__BMI__
428 CFLAGS.fse_decompress.c= -fno-tree-vectorize -U__BMI__
429 CFLAGS.pool.c= -fno-tree-vectorize -U__BMI__
430 CFLAGS.xxhash.c= -fno-tree-vectorize -U__BMI__
431 CFLAGS.zstd_common.c= -fno-tree-vectorize -U__BMI__
432 CFLAGS.fse_compress.c= -fno-tree-vectorize -U__BMI__
433 CFLAGS.hist.c= -fno-tree-vectorize -U__BMI__
434 CFLAGS.huf_compress.c= -fno-tree-vectorize -U__BMI__
435 CFLAGS.zstd_compress.c= -fno-tree-vectorize -U__BMI__
436 CFLAGS.zstd_compress_literals.c= -fno-tree-vectorize -U__BMI__
437 CFLAGS.zstd_compress_sequences.c= -fno-tree-vectorize -U__BMI__
438 CFLAGS.zstd_compress_superblock.c= -fno-tree-vectorize -U__BMI__
439 CFLAGS.zstd_double_fast.c= -fno-tree-vectorize -U__BMI__
440 CFLAGS.zstd_fast.c= -fno-tree-vectorize -U__BMI__
441 CFLAGS.zstd_lazy.c= -fno-tree-vectorize -U__BMI__
442 CFLAGS.zstd_ldm.c= -fno-tree-vectorize -U__BMI__
443 CFLAGS.zstd_opt.c= -fno-tree-vectorize -U__BMI__
444 CFLAGS.huf_decompress.c= -fno-tree-vectorize -U__BMI__
445 CFLAGS.zstd_ddict.c= -fno-tree-vectorize -U__BMI__
446 CFLAGS.zstd_decompress.c= -fno-tree-vectorize -U__BMI__
447 CFLAGS.zstd_decompress_block.c= -fno-tree-vectorize -U__BMI__