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}/lua \ 14 ${SRCDIR}/nvpair \ 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 23 24 25 26CFLAGS+= -I${.OBJDIR:H}/include 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+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h 33 34CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS -D__BSD_VISIBLE=1 \ 35 -DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \ 36 -D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DSMP -DHAVE_KSID -DCOMPAT_FREEBSD11 37 38.if ${MACHINE_ARCH} == "amd64" 39CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F -DHAVE_SSSE3 40.endif 41 42.if defined(WITH_DEBUG) && ${WITH_DEBUG} == "true" 43CFLAGS+= -DZFS_DEBUG -g 44.if defined(WITH_INVARIANTS) && ${WITH_INVARIANTS} == "true" 45 CFLAGS+= -DINVARIANTS -DWITNESS -DOPENSOLARIS_WITNESS 46.endif 47.if defined(WITH_O0) && ${WITH_O0} == "true" 48 CFLAGS+= -O0 49.endif 50.else 51CFLAGS += -DNDEBUG 52.endif 53 54.if defined(WITH_VFS_DEBUG) && ${WITH_VFS_DEBUG} == "true" 55# kernel must also be built with this option for this to work 56CFLAGS+= -DDEBUG_VFS_LOCKS 57.endif 58 59.if defined(WITH_GCOV) && ${WITH_GCOV} == "true" 60CFLAGS+= -fprofile-arcs -ftest-coverage 61.endif 62 63DEBUG_FLAGS=-g 64 65.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ 66 ${MACHINE_ARCH} == "arm" 67CFLAGS+= -DBITS_PER_LONG=32 68.else 69CFLAGS+= -DBITS_PER_LONG=64 70.endif 71 72SRCS= vnode_if.h device_if.h bus_if.h 73 74# avl 75SRCS+= avl.c 76 77# icp 78SRCS+= edonr.c 79 80#lua 81SRCS+= lapi.c \ 82 lauxlib.c \ 83 lbaselib.c \ 84 lcode.c \ 85 lcompat.c \ 86 lcorolib.c \ 87 lctype.c \ 88 ldebug.c \ 89 ldo.c \ 90 lfunc.c \ 91 lgc.c \ 92 llex.c \ 93 lmem.c \ 94 lobject.c \ 95 lopcodes.c \ 96 lparser.c \ 97 lstate.c \ 98 lstring.c \ 99 lstrlib.c \ 100 ltable.c \ 101 ltablib.c \ 102 ltm.c \ 103 lvm.c \ 104 lzio.c 105 106#nvpair 107SRCS+= nvpair.c \ 108 fnvpair.c \ 109 nvpair_alloc_spl.c \ 110 nvpair_alloc_fixed.c 111 112#os/freebsd/spl 113SRCS+= acl_common.c \ 114 callb.c \ 115 list.c \ 116 sha256c.c \ 117 sha512c.c \ 118 spl_acl.c \ 119 spl_cmn_err.c \ 120 spl_dtrace.c \ 121 spl_kmem.c \ 122 spl_kstat.c \ 123 spl_misc.c \ 124 spl_policy.c \ 125 spl_procfs_list.c \ 126 spl_string.c \ 127 spl_sunddi.c \ 128 spl_sysevent.c \ 129 spl_taskq.c \ 130 spl_uio.c \ 131 spl_vfs.c \ 132 spl_vm.c \ 133 spl_zlib.c \ 134 spl_zone.c 135 136 137.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ 138 ${MACHINE_ARCH} == "arm" 139SRCS+= spl_atomic.c 140.endif 141 142#os/freebsd/zfs 143SRCS+= abd_os.c \ 144 arc_os.c \ 145 crypto_os.c \ 146 dmu_os.c \ 147 hkdf.c \ 148 kmod_core.c \ 149 spa_os.c \ 150 sysctl_os.c \ 151 vdev_file.c \ 152 vdev_geom.c \ 153 vdev_label_os.c \ 154 zfs_acl.c \ 155 zfs_ctldir.c \ 156 zfs_debug.c \ 157 zfs_dir.c \ 158 zfs_ioctl_compat.c \ 159 zfs_ioctl_os.c \ 160 zfs_racct.c \ 161 zfs_vfsops.c \ 162 zfs_vnops_os.c \ 163 zfs_znode.c \ 164 zio_crypt.c \ 165 zvol_os.c 166 167#unicode 168SRCS+= uconv.c \ 169 u8_textprep.c 170 171#zcommon 172SRCS+= zfeature_common.c \ 173 zfs_comutil.c \ 174 zfs_deleg.c \ 175 zfs_fletcher.c \ 176 zfs_fletcher_avx512.c \ 177 zfs_fletcher_intel.c \ 178 zfs_fletcher_sse.c \ 179 zfs_fletcher_superscalar.c \ 180 zfs_fletcher_superscalar4.c \ 181 zfs_namecheck.c \ 182 zfs_prop.c \ 183 zpool_prop.c \ 184 zprop_common.c 185 186#zfs 187SRCS+= abd.c \ 188 aggsum.c \ 189 arc.c \ 190 blkptr.c \ 191 bplist.c \ 192 bpobj.c \ 193 btree.c \ 194 cityhash.c \ 195 dbuf.c \ 196 dbuf_stats.c \ 197 bptree.c \ 198 bqueue.c \ 199 dataset_kstats.c \ 200 ddt.c \ 201 ddt_zap.c \ 202 dmu.c \ 203 dmu_diff.c \ 204 dmu_object.c \ 205 dmu_objset.c \ 206 dmu_recv.c \ 207 dmu_redact.c \ 208 dmu_send.c \ 209 dmu_traverse.c \ 210 dmu_tx.c \ 211 dmu_zfetch.c \ 212 dnode.c \ 213 dnode_sync.c \ 214 dsl_dataset.c \ 215 dsl_deadlist.c \ 216 dsl_deleg.c \ 217 dsl_bookmark.c \ 218 dsl_dir.c \ 219 dsl_crypt.c \ 220 dsl_destroy.c \ 221 dsl_pool.c \ 222 dsl_prop.c \ 223 dsl_scan.c \ 224 dsl_synctask.c \ 225 dsl_userhold.c \ 226 edonr_zfs.c \ 227 fm.c \ 228 gzip.c \ 229 lzjb.c \ 230 lz4.c \ 231 metaslab.c \ 232 mmp.c \ 233 multilist.c \ 234 objlist.c \ 235 pathname.c \ 236 range_tree.c \ 237 refcount.c \ 238 rrwlock.c \ 239 sa.c \ 240 sha256.c \ 241 skein_zfs.c \ 242 spa.c \ 243 spa_boot.c \ 244 spa_checkpoint.c \ 245 spa_config.c \ 246 spa_errlog.c \ 247 spa_history.c \ 248 spa_log_spacemap.c \ 249 spa_misc.c \ 250 spa_stats.c \ 251 space_map.c \ 252 space_reftree.c \ 253 txg.c \ 254 uberblock.c \ 255 unique.c \ 256 vdev.c \ 257 vdev_cache.c \ 258 vdev_draid.c \ 259 vdev_draid_rand.c \ 260 vdev_indirect.c \ 261 vdev_indirect_births.c \ 262 vdev_indirect_mapping.c \ 263 vdev_initialize.c \ 264 vdev_label.c \ 265 vdev_mirror.c \ 266 vdev_missing.c \ 267 vdev_queue.c \ 268 vdev_raidz.c \ 269 vdev_raidz_math.c \ 270 vdev_raidz_math_scalar.c \ 271 vdev_raidz_math_avx2.c \ 272 vdev_raidz_math_avx512bw.c \ 273 vdev_raidz_math_avx512f.c \ 274 vdev_raidz_math_sse2.c \ 275 vdev_raidz_math_ssse3.c \ 276 vdev_rebuild.c \ 277 vdev_removal.c \ 278 vdev_root.c \ 279 vdev_trim.c \ 280 zap.c \ 281 zap_leaf.c \ 282 zap_micro.c \ 283 zcp.c \ 284 zcp_get.c \ 285 zcp_global.c \ 286 zcp_iter.c \ 287 zcp_set.c \ 288 zcp_synctask.c \ 289 zfeature.c \ 290 zfs_byteswap.c \ 291 zfs_file_os.c \ 292 zfs_fm.c \ 293 zfs_fuid.c \ 294 zfs_ioctl.c \ 295 zfs_log.c \ 296 zfs_onexit.c \ 297 zfs_quota.c \ 298 zfs_ratelimit.c \ 299 zfs_replay.c \ 300 zfs_rlock.c \ 301 zfs_sa.c \ 302 zfs_vnops.c \ 303 zil.c \ 304 zio.c \ 305 zio_checksum.c \ 306 zio_compress.c \ 307 zio_inject.c \ 308 zle.c \ 309 zrlock.c \ 310 zthr.c \ 311 zvol.c 312 313#zstd 314SRCS+= zfs_zstd.c \ 315 zstd.c 316 317beforeinstall: 318.if ${MK_DEBUG_FILES} != "no" 319 mtree -eu \ 320 -f /etc/mtree/BSD.debug.dist \ 321 -p ${DESTDIR}/usr/lib 322.endif 323 324.include <bsd.kmod.mk> 325 326 327CFLAGS.gcc+= -Wno-pointer-to-int-cast 328 329CFLAGS.lapi.c= -Wno-cast-qual 330CFLAGS.lcompat.c= -Wno-cast-qual 331CFLAGS.lobject.c= -Wno-cast-qual 332CFLAGS.ltable.c= -Wno-cast-qual 333CFLAGS.lvm.c= -Wno-cast-qual 334CFLAGS.nvpair.c= -DHAVE_RPC_TYPES -Wno-cast-qual 335CFLAGS.spl_string.c= -Wno-cast-qual 336CFLAGS.spl_vm.c= -Wno-cast-qual 337CFLAGS.spl_zlib.c= -Wno-cast-qual 338CFLAGS.abd.c= -Wno-cast-qual 339CFLAGS.zfs_log.c= -Wno-cast-qual 340CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith 341CFLAGS.u8_textprep.c= -Wno-cast-qual 342CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith 343CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith 344CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith 345CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith 346CFLAGS.zprop_common.c= -Wno-cast-qual 347CFLAGS.ddt.c= -Wno-cast-qual 348CFLAGS.dmu.c= -Wno-cast-qual 349CFLAGS.dmu_traverse.c= -Wno-cast-qual 350CFLAGS.dsl_dir.c= -Wno-cast-qual 351CFLAGS.dsl_deadlist.c= -Wno-cast-qual 352CFLAGS.dsl_prop.c= -Wno-cast-qual 353CFLAGS.edonr.c=-Wno-cast-qual 354CFLAGS.fm.c= -Wno-cast-qual 355CFLAGS.lz4.c= -Wno-cast-qual 356CFLAGS.spa.c= -Wno-cast-qual 357CFLAGS.spa_misc.c= -Wno-cast-qual 358CFLAGS.sysctl_os.c= -include ../zfs_config.h 359CFLAGS.vdev_draid.c= -Wno-cast-qual 360CFLAGS.vdev_raidz.c= -Wno-cast-qual 361CFLAGS.vdev_raidz_math.c= -Wno-cast-qual 362CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual 363CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier 364CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier 365CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier 366CFLAGS.zap_leaf.c= -Wno-cast-qual 367CFLAGS.zap_micro.c= -Wno-cast-qual 368CFLAGS.zcp.c= -Wno-cast-qual 369CFLAGS.zfs_fm.c= -Wno-cast-qual 370CFLAGS.zfs_ioctl.c= -Wno-cast-qual 371CFLAGS.zil.c= -Wno-cast-qual 372CFLAGS.zio.c= -Wno-cast-qual 373CFLAGS.zrlock.c= -Wno-cast-qual 374CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith 375CFLAGS.zstd.c= -fno-tree-vectorize -U__BMI__ 376