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