1# $FreeBSD$ 2 3ZFSTOP= ${SRCTOP}/sys/contrib/openzfs 4 5# ZFS_COMMON_SRCS 6.PATH: ${ZFSTOP}/module/zfs 7.PATH: ${ZFSTOP}/module/zcommon 8.PATH: ${ZFSTOP}/module/unicode 9# LUA_SRCS 10.PATH: ${ZFSTOP}/module/lua 11# ZSTD_SRCS 12.PATH: ${ZFSTOP}/module/zstd 13.PATH: ${ZFSTOP}/module/zstd/lib/common 14.PATH: ${ZFSTOP}/module/zstd/lib/compress 15.PATH: ${ZFSTOP}/module/zstd/lib/decompress 16 17.PATH: ${ZFSTOP}/module/os/linux/zfs 18 19.PATH: ${ZFSTOP}/lib/libzpool 20 21.if exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S) 22.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH} 23ATOMIC_SRCS= opensolaris_atomic.S 24ACFLAGS+= -Wa,--noexecstack 25.else 26.PATH: ${SRCTOP}/sys/cddl/compat/opensolaris/kern 27ATOMIC_SRCS= opensolaris_atomic.c 28.endif 29 30.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe" 31# Don't waste GOT entries on small data. 32PICFLAG= -fPIC 33.endif 34 35PACKAGE= zfs 36LIB= zpool 37 38USER_C = \ 39 kernel.c \ 40 taskq.c \ 41 util.c 42 43KERNEL_C = \ 44 zfeature_common.c \ 45 zfs_comutil.c \ 46 zfs_deleg.c \ 47 zfs_fletcher.c \ 48 zfs_fletcher_superscalar.c \ 49 zfs_fletcher_superscalar4.c \ 50 zfs_namecheck.c \ 51 zfs_prop.c \ 52 zfs_zstd.c \ 53 zpool_prop.c \ 54 zprop_common.c \ 55 abd.c \ 56 abd_os.c \ 57 aggsum.c \ 58 arc.c \ 59 arc_os.c \ 60 blake3_zfs.c \ 61 blkptr.c \ 62 bplist.c \ 63 bpobj.c \ 64 bptree.c \ 65 bqueue.c \ 66 btree.c \ 67 brt.c \ 68 cityhash.c \ 69 dbuf.c \ 70 dbuf_stats.c \ 71 ddt.c \ 72 ddt_zap.c \ 73 dmu.c \ 74 dmu_diff.c \ 75 dmu_object.c \ 76 dmu_objset.c \ 77 dmu_recv.c \ 78 dmu_redact.c \ 79 dmu_send.c \ 80 dmu_traverse.c \ 81 dmu_tx.c \ 82 dmu_zfetch.c \ 83 dnode.c \ 84 dnode_sync.c \ 85 dsl_bookmark.c \ 86 dsl_dataset.c \ 87 dsl_deadlist.c \ 88 dsl_deleg.c \ 89 dsl_dir.c \ 90 dsl_crypt.c \ 91 dsl_pool.c \ 92 dsl_prop.c \ 93 dsl_scan.c \ 94 dsl_synctask.c \ 95 dsl_destroy.c \ 96 dsl_userhold.c \ 97 edonr_zfs.c \ 98 entropy_common.c \ 99 error_private.c \ 100 fm.c \ 101 fse_compress.c \ 102 fse_decompress.c \ 103 gzip.c \ 104 hist.c \ 105 hkdf.c \ 106 huf_compress.c \ 107 huf_decompress.c \ 108 lzjb.c \ 109 lz4.c \ 110 lz4_zfs.c \ 111 metaslab.c \ 112 mmp.c \ 113 multilist.c \ 114 objlist.c \ 115 pathname.c \ 116 pool.c \ 117 range_tree.c \ 118 refcount.c \ 119 rrwlock.c \ 120 sa.c \ 121 sha2_zfs.c \ 122 skein_zfs.c \ 123 spa.c \ 124 spa_checkpoint.c \ 125 spa_config.c \ 126 spa_errlog.c \ 127 spa_history.c \ 128 spa_log_spacemap.c \ 129 spa_misc.c \ 130 spa_stats.c \ 131 space_map.c \ 132 space_reftree.c \ 133 txg.c \ 134 trace.c \ 135 uberblock.c \ 136 unique.c \ 137 vdev.c \ 138 vdev_draid.c \ 139 vdev_draid_rand.c \ 140 vdev_file.c \ 141 vdev_indirect_births.c \ 142 vdev_indirect.c \ 143 vdev_indirect_mapping.c \ 144 vdev_initialize.c \ 145 vdev_label.c \ 146 vdev_mirror.c \ 147 vdev_missing.c \ 148 vdev_queue.c \ 149 vdev_raidz.c \ 150 vdev_raidz_math_aarch64_neon.c \ 151 vdev_raidz_math_aarch64_neonx2.c \ 152 vdev_raidz_math_avx2.c \ 153 vdev_raidz_math_avx512bw.c \ 154 vdev_raidz_math_avx512f.c \ 155 vdev_raidz_math.c \ 156 vdev_raidz_math_scalar.c \ 157 vdev_rebuild.c \ 158 vdev_removal.c \ 159 vdev_root.c \ 160 vdev_trim.c \ 161 xxhash.c \ 162 zap.c \ 163 zap_leaf.c \ 164 zap_micro.c \ 165 zcp.c \ 166 zcp_get.c \ 167 zcp_global.c \ 168 zcp_iter.c \ 169 zcp_set.c \ 170 zcp_synctask.c \ 171 zfeature.c \ 172 zfs_byteswap.c \ 173 zfs_chksum.c \ 174 zfs_debug.c \ 175 zfs_fm.c \ 176 zfs_fuid.c \ 177 zfs_sa.c \ 178 zfs_znode.c \ 179 zfs_racct.c \ 180 zfs_ratelimit.c \ 181 zfs_rlock.c \ 182 zil.c \ 183 zio.c \ 184 zio_checksum.c \ 185 zio_compress.c \ 186 zio_crypt.c \ 187 zio_inject.c \ 188 zle.c \ 189 zrlock.c \ 190 zstd_common.c \ 191 zstd_compress.c \ 192 zstd_compress_literals.c \ 193 zstd_compress_sequences.c \ 194 zstd_compress_superblock.c \ 195 zstd_ddict.c \ 196 zstd_decompress.c \ 197 zstd_decompress_block.c \ 198 zstd_double_fast.c \ 199 zstd_fast.c \ 200 zstd_lazy.c \ 201 zstd_ldm.c \ 202 zstd_opt.c \ 203 zthr.c 204 205ARCH_C = 206.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" 207ARCH_C += vdev_raidz_math_sse2.c \ 208 vdev_raidz_math_ssse3.c \ 209 zfs_fletcher_intel.c \ 210 zfs_fletcher_sse.c 211CFLAGS += -DHAVE_SSE2 -DHAVE_SSE3 212.endif 213.if ${MACHINE_ARCH} == "amd64" 214ARCH_C += zfs_fletcher_avx512.c 215CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F \ 216 -DHAVE_AVX512BW 217.endif 218.if ${MACHINE_CPUARCH} == "aarch64" 219ARCH_C += zfs_fletcher_aarch64_neon.c 220.endif 221 222LUA_C = \ 223 lapi.c \ 224 lauxlib.c \ 225 lbaselib.c \ 226 lcode.c \ 227 lcompat.c \ 228 lcorolib.c \ 229 lctype.c \ 230 ldebug.c \ 231 ldo.c \ 232 lfunc.c \ 233 lgc.c \ 234 llex.c \ 235 lmem.c \ 236 lobject.c \ 237 lopcodes.c \ 238 lparser.c \ 239 lstate.c \ 240 lstring.c \ 241 lstrlib.c \ 242 ltable.c \ 243 ltablib.c \ 244 ltm.c \ 245 lvm.c \ 246 lzio.c 247 248UNICODE_C = u8_textprep.c uconv.c 249 250SRCS= ${USER_C} ${KERNEL_C} ${LUA_C} ${UNICODE_C} ${ARCH_C} 251 252WARNS?= 2 253CFLAGS+= \ 254 -DIN_BASE \ 255 -I${ZFSTOP}/include \ 256 -I${ZFSTOP}/lib/libspl/include \ 257 -I${ZFSTOP}/lib/libspl/include/os/freebsd \ 258 -I${SRCTOP}/sys \ 259 -I${ZFSTOP}/include/os/freebsd/zfs \ 260 -I${SRCTOP}/cddl/compat/opensolaris/include \ 261 -I${ZFSTOP}/module/icp/include \ 262 -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \ 263 -DHAVE_ISSETUGID \ 264 -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \ 265 -I${SRCTOP}/sys/modules/zfs \ 266 -I${ZFSTOP}/include/os/freebsd/zfs \ 267 -DLIB_ZPOOL_BUILD -DZFS_DEBUG \ 268 269# XXX: pthread doesn't have mutex_owned() equivalent, so we need to look 270# into libthr private structures. That's sooo evil, but it's only for 271# ZFS debugging tools needs. 272CFLAGS+= -DWANTS_MUTEX_OWNED 273CFLAGS+= -I${SRCTOP}/lib/libpthread/thread 274CFLAGS+= -I${SRCTOP}/lib/libpthread/sys 275CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include 276CFLAGS.gcc+= -fms-extensions 277 278LIBADD= md pthread z spl icp nvpair avl umem 279 280# atomic.S doesn't like profiling. 281MK_PROFILE= no 282 283CSTD= c99 284 285# Since there are many asserts in this library, it makes no sense to compile 286# it without debugging. 287 288CFLAGS+= -g -DDEBUG=1 289 290# Pointer values are used as debugging "tags" to mark reference count 291# ownerships and in some cases the tag reference is dropped after an 292# object is freed. 293CFLAGS.dbuf.c= ${NO_WUSE_AFTER_FREE} 294CFLAGS.entropy_common.c= -fno-tree-vectorize 295CFLAGS.entropy_common.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 296CFLAGS.error_private.c= -fno-tree-vectorize 297CFLAGS.error_private.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 298CFLAGS.fse_compress.c= -fno-tree-vectorize 299CFLAGS.fse_compress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 300CFLAGS.fse_decompress.c= -fno-tree-vectorize 301CFLAGS.fse_decompress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 302CFLAGS.hist.c= -fno-tree-vectorize 303CFLAGS.hist.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 304CFLAGS.huf_compress.c= -fno-tree-vectorize 305CFLAGS.huf_compress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 306CFLAGS.huf_decompress.c= -fno-tree-vectorize 307CFLAGS.huf_decompress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 308CFLAGS.pool.c= -fno-tree-vectorize 309CFLAGS.pool.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 310CFLAGS.xxhash.c= -fno-tree-vectorize 311CFLAGS.xxhash.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 312CFLAGS.zstd_compress.c= -fno-tree-vectorize 313CFLAGS.zstd_compress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 314CFLAGS.zstd_compress_literals.c= -fno-tree-vectorize 315CFLAGS.zstd_compress_literals.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 316CFLAGS.zstd_compress_sequences.c= -fno-tree-vectorize 317CFLAGS.zstd_compress_sequences.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 318CFLAGS.zstd_compress_superblock.c= -fno-tree-vectorize 319CFLAGS.zstd_compress_superblock.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 320CFLAGS.zstd_double_fast.c= -fno-tree-vectorize 321CFLAGS.zstd_double_fast.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 322CFLAGS.zstd_fast.c= -fno-tree-vectorize 323CFLAGS.zstd_fast.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 324CFLAGS.zstd_lazy.c= -fno-tree-vectorize 325CFLAGS.zstd_lazy.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 326CFLAGS.zstd_ldm.c= -fno-tree-vectorize 327CFLAGS.zstd_ldm.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 328CFLAGS.zstd_opt.c= -fno-tree-vectorize 329CFLAGS.zstd_opt.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 330CFLAGS.zstd_ddict.c= -fno-tree-vectorize 331CFLAGS.zstd_ddict.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 332CFLAGS.zstd_decompress.c= -fno-tree-vectorize 333CFLAGS.zstd_decompress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 334CFLAGS.zstd_decompress_block.c= -fno-tree-vectorize 335CFLAGS.zstd_decompress_block.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 336 337.include <bsd.lib.mk> 338