1.if !defined(WITH_CTF) 2WITH_CTF=1 3.endif 4 5.include <bsd.sys.mk> 6 7SRCDIR=${.CURDIR} 8INCDIR=${.CURDIR:H}/include 9 10KMOD= openzfs 11 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 29 30 31 32CFLAGS+= -I${.OBJDIR:H}/include 33CFLAGS+= -I${INCDIR} 34CFLAGS+= -I${INCDIR}/os/freebsd 35CFLAGS+= -I${INCDIR}/os/freebsd/spl 36CFLAGS+= -I${INCDIR}/os/freebsd/zfs 37CFLAGS+= -I${SRCDIR}/zstd/include 38CFLAGS+= -I${SRCDIR}/icp/include 39CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h 40 41CFLAGS+= -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 44 45.if ${MACHINE_ARCH} == "amd64" 46CFLAGS+= -D__x86_64 -DHAVE_SSE2 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 \ 47 -DHAVE_AVX -DHAVE_AVX2 -DHAVE_AVX512F -DHAVE_AVX512VL 48.endif 49 50.if defined(WITH_DEBUG) && ${WITH_DEBUG} == "true" 51CFLAGS+= -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 59CFLAGS += -DNDEBUG 60.endif 61 62.if defined(WITH_VFS_DEBUG) && ${WITH_VFS_DEBUG} == "true" 63# kernel must also be built with this option for this to work 64CFLAGS+= -DDEBUG_VFS_LOCKS 65.endif 66 67.if defined(WITH_GCOV) && ${WITH_GCOV} == "true" 68CFLAGS+= -fprofile-arcs -ftest-coverage 69.endif 70 71DEBUG_FLAGS=-g 72 73.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ 74 ${MACHINE_ARCH} == "arm" 75CFLAGS+= -DBITS_PER_LONG=32 76.else 77CFLAGS+= -DBITS_PER_LONG=64 78.endif 79 80SRCS= vnode_if.h device_if.h bus_if.h 81 82#avl 83SRCS+= avl.c 84 85# icp 86SRCS+= edonr.c 87 88#icp/algs/blake3 89SRCS+= blake3.c \ 90 blake3_generic.c \ 91 blake3_impl.c \ 92 blake3_x86-64.c 93 94#icp/asm-aarch64/blake3 95SRCS+= b3_aarch64_sse2.S \ 96 b3_aarch64_sse41.S 97 98#icp/asm-ppc64/blake3 99SRCS+= b3_ppc64le_sse2.S \ 100 b3_ppc64le_sse41.S 101 102#icp/asm-x86_64/blake3 103SRCS+= blake3_avx2.S \ 104 blake3_avx512.S \ 105 blake3_sse2.S \ 106 blake3_sse41.S 107 108#lua 109SRCS+= 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 133 134#nvpair 135SRCS+= nvpair.c \ 136 fnvpair.c \ 137 nvpair_alloc_spl.c \ 138 nvpair_alloc_fixed.c 139 140#os/freebsd/spl 141SRCS+= 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 163 164 165.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ 166 ${MACHINE_ARCH} == "arm" 167SRCS+= spl_atomic.c 168.endif 169 170#os/freebsd/zfs 171SRCS+= 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 194 195#unicode 196SRCS+= uconv.c \ 197 u8_textprep.c 198 199#zcommon 200SRCS+= 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 213 214#zfs 215SRCS+= 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 343 344#zstd 345SRCS+= 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 367 368beforeinstall: 369.if ${MK_DEBUG_FILES} != "no" 370 mtree -eu \ 371 -f /etc/mtree/BSD.debug.dist \ 372 -p ${DESTDIR}/usr/lib 373.endif 374 375.include <bsd.kmod.mk> 376 377 378CFLAGS.gcc+= -Wno-pointer-to-int-cast 379 380CFLAGS.lapi.c= -Wno-cast-qual 381CFLAGS.lcompat.c= -Wno-cast-qual 382CFLAGS.lobject.c= -Wno-cast-qual 383CFLAGS.ltable.c= -Wno-cast-qual 384CFLAGS.lvm.c= -Wno-cast-qual 385CFLAGS.nvpair.c= -DHAVE_RPC_TYPES -Wno-cast-qual 386CFLAGS.spl_string.c= -Wno-cast-qual 387CFLAGS.spl_vm.c= -Wno-cast-qual 388CFLAGS.spl_zlib.c= -Wno-cast-qual 389CFLAGS.abd.c= -Wno-cast-qual 390CFLAGS.zfs_log.c= -Wno-cast-qual 391CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith 392CFLAGS.u8_textprep.c= -Wno-cast-qual 393CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith 394CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith 395CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith 396CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith 397CFLAGS.zprop_common.c= -Wno-cast-qual 398CFLAGS.ddt.c= -Wno-cast-qual 399CFLAGS.dmu.c= -Wno-cast-qual 400CFLAGS.dmu_traverse.c= -Wno-cast-qual 401CFLAGS.dsl_dir.c= -Wno-cast-qual 402CFLAGS.dsl_deadlist.c= -Wno-cast-qual 403CFLAGS.dsl_prop.c= -Wno-cast-qual 404CFLAGS.edonr.c=-Wno-cast-qual 405CFLAGS.fm.c= -Wno-cast-qual 406CFLAGS.lz4_zfs.c= -Wno-cast-qual 407CFLAGS.spa.c= -Wno-cast-qual 408CFLAGS.spa_misc.c= -Wno-cast-qual 409CFLAGS.sysctl_os.c= -include ../zfs_config.h 410CFLAGS.vdev_draid.c= -Wno-cast-qual 411CFLAGS.vdev_raidz.c= -Wno-cast-qual 412CFLAGS.vdev_raidz_math.c= -Wno-cast-qual 413CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual 414CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier 415CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier 416CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier 417CFLAGS.zap_leaf.c= -Wno-cast-qual 418CFLAGS.zap_micro.c= -Wno-cast-qual 419CFLAGS.zcp.c= -Wno-cast-qual 420CFLAGS.zfs_fm.c= -Wno-cast-qual 421CFLAGS.zfs_ioctl.c= -Wno-cast-qual 422CFLAGS.zil.c= -Wno-cast-qual 423CFLAGS.zio.c= -Wno-cast-qual 424CFLAGS.zrlock.c= -Wno-cast-qual 425CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith 426CFLAGS.entropy_common.c= -fno-tree-vectorize -U__BMI__ 427CFLAGS.error_private.c= -fno-tree-vectorize -U__BMI__ 428CFLAGS.fse_decompress.c= -fno-tree-vectorize -U__BMI__ 429CFLAGS.pool.c= -fno-tree-vectorize -U__BMI__ 430CFLAGS.xxhash.c= -fno-tree-vectorize -U__BMI__ 431CFLAGS.zstd_common.c= -fno-tree-vectorize -U__BMI__ 432CFLAGS.fse_compress.c= -fno-tree-vectorize -U__BMI__ 433CFLAGS.hist.c= -fno-tree-vectorize -U__BMI__ 434CFLAGS.huf_compress.c= -fno-tree-vectorize -U__BMI__ 435CFLAGS.zstd_compress.c= -fno-tree-vectorize -U__BMI__ 436CFLAGS.zstd_compress_literals.c= -fno-tree-vectorize -U__BMI__ 437CFLAGS.zstd_compress_sequences.c= -fno-tree-vectorize -U__BMI__ 438CFLAGS.zstd_compress_superblock.c= -fno-tree-vectorize -U__BMI__ 439CFLAGS.zstd_double_fast.c= -fno-tree-vectorize -U__BMI__ 440CFLAGS.zstd_fast.c= -fno-tree-vectorize -U__BMI__ 441CFLAGS.zstd_lazy.c= -fno-tree-vectorize -U__BMI__ 442CFLAGS.zstd_ldm.c= -fno-tree-vectorize -U__BMI__ 443CFLAGS.zstd_opt.c= -fno-tree-vectorize -U__BMI__ 444CFLAGS.huf_decompress.c= -fno-tree-vectorize -U__BMI__ 445CFLAGS.zstd_ddict.c= -fno-tree-vectorize -U__BMI__ 446CFLAGS.zstd_decompress.c= -fno-tree-vectorize -U__BMI__ 447CFLAGS.zstd_decompress_block.c= -fno-tree-vectorize -U__BMI__ 448