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