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