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