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 14 15.PATH: ${ZFSTOP}/module/os/linux/zfs 16 17.PATH: ${ZFSTOP}/lib/libzpool 18 19.if exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S) 20.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH} 21ATOMIC_SRCS= opensolaris_atomic.S 22ACFLAGS+= -Wa,--noexecstack 23.else 24.PATH: ${SRCTOP}/sys/cddl/compat/opensolaris/kern 25ATOMIC_SRCS= opensolaris_atomic.c 26.endif 27 28.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe" 29# Don't waste GOT entries on small data. 30PICFLAG= -fPIC 31.endif 32 33LIB= zpool 34 35USER_C = \ 36 kernel.c \ 37 taskq.c \ 38 util.c 39 40KERNEL_C = \ 41 zfeature_common.c \ 42 zfs_comutil.c \ 43 zfs_deleg.c \ 44 zfs_fletcher.c \ 45 zfs_fletcher_superscalar.c \ 46 zfs_fletcher_superscalar4.c \ 47 zfs_namecheck.c \ 48 zfs_prop.c \ 49 zfs_zstd.c \ 50 zpool_prop.c \ 51 zprop_common.c \ 52 abd.c \ 53 abd_os.c \ 54 aggsum.c \ 55 arc.c \ 56 arc_os.c \ 57 blkptr.c \ 58 bplist.c \ 59 bpobj.c \ 60 bptree.c \ 61 btree.c \ 62 bqueue.c \ 63 cityhash.c \ 64 dbuf.c \ 65 dbuf_stats.c \ 66 ddt.c \ 67 ddt_zap.c \ 68 dmu.c \ 69 dmu_diff.c \ 70 dmu_object.c \ 71 dmu_objset.c \ 72 dmu_recv.c \ 73 dmu_redact.c \ 74 dmu_send.c \ 75 dmu_traverse.c \ 76 dmu_tx.c \ 77 dmu_zfetch.c \ 78 dnode.c \ 79 dnode_sync.c \ 80 dsl_bookmark.c \ 81 dsl_dataset.c \ 82 dsl_deadlist.c \ 83 dsl_deleg.c \ 84 dsl_dir.c \ 85 dsl_crypt.c \ 86 dsl_pool.c \ 87 dsl_prop.c \ 88 dsl_scan.c \ 89 dsl_synctask.c \ 90 dsl_destroy.c \ 91 dsl_userhold.c \ 92 edonr_zfs.c \ 93 hkdf.c \ 94 fm.c \ 95 gzip.c \ 96 lzjb.c \ 97 lz4.c \ 98 lz4_zfs.c \ 99 metaslab.c \ 100 mmp.c \ 101 multilist.c \ 102 objlist.c \ 103 pathname.c \ 104 range_tree.c \ 105 refcount.c \ 106 rrwlock.c \ 107 sa.c \ 108 sha256.c \ 109 skein_zfs.c \ 110 spa.c \ 111 spa_boot.c \ 112 spa_checkpoint.c \ 113 spa_config.c \ 114 spa_errlog.c \ 115 spa_history.c \ 116 spa_log_spacemap.c \ 117 spa_misc.c \ 118 spa_stats.c \ 119 space_map.c \ 120 space_reftree.c \ 121 txg.c \ 122 trace.c \ 123 uberblock.c \ 124 unique.c \ 125 vdev.c \ 126 vdev_cache.c \ 127 vdev_draid.c \ 128 vdev_draid_rand.c \ 129 vdev_file.c \ 130 vdev_indirect_births.c \ 131 vdev_indirect.c \ 132 vdev_indirect_mapping.c \ 133 vdev_initialize.c \ 134 vdev_label.c \ 135 vdev_mirror.c \ 136 vdev_missing.c \ 137 vdev_queue.c \ 138 vdev_raidz.c \ 139 vdev_raidz_math_aarch64_neon.c \ 140 vdev_raidz_math_aarch64_neonx2.c \ 141 vdev_raidz_math_avx2.c \ 142 vdev_raidz_math_avx512bw.c \ 143 vdev_raidz_math_avx512f.c \ 144 vdev_raidz_math.c \ 145 vdev_raidz_math_scalar.c \ 146 vdev_rebuild.c \ 147 vdev_removal.c \ 148 vdev_root.c \ 149 vdev_trim.c \ 150 zap.c \ 151 zap_leaf.c \ 152 zap_micro.c \ 153 zcp.c \ 154 zcp_get.c \ 155 zcp_global.c \ 156 zcp_iter.c \ 157 zcp_set.c \ 158 zcp_synctask.c \ 159 zfeature.c \ 160 zfs_byteswap.c \ 161 zfs_debug.c \ 162 zfs_fm.c \ 163 zfs_fuid.c \ 164 zfs_sa.c \ 165 zfs_znode.c \ 166 zfs_racct.c \ 167 zfs_ratelimit.c \ 168 zfs_rlock.c \ 169 zil.c \ 170 zio.c \ 171 zio_checksum.c \ 172 zio_compress.c \ 173 zio_crypt.c \ 174 zio_inject.c \ 175 zle.c \ 176 zrlock.c \ 177 zstd.c \ 178 zthr.c 179 180ARCH_C = 181.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" 182ARCH_C += vdev_raidz_math_sse2.c \ 183 vdev_raidz_math_ssse3.c \ 184 zfs_fletcher_intel.c \ 185 zfs_fletcher_sse.c 186CFLAGS += -DHAVE_SSE2 -DHAVE_SSE3 187.endif 188.if ${MACHINE_ARCH} == "amd64" 189ARCH_C += zfs_fletcher_avx512.c 190CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F \ 191 -DHAVE_AVX512BW 192.endif 193.if ${MACHINE_CPUARCH} == "aarch64" 194ARCH_C += zfs_fletcher_aarch64_neon.c 195.endif 196 197LUA_C = \ 198 lapi.c \ 199 lauxlib.c \ 200 lbaselib.c \ 201 lcode.c \ 202 lcompat.c \ 203 lcorolib.c \ 204 lctype.c \ 205 ldebug.c \ 206 ldo.c \ 207 lfunc.c \ 208 lgc.c \ 209 llex.c \ 210 lmem.c \ 211 lobject.c \ 212 lopcodes.c \ 213 lparser.c \ 214 lstate.c \ 215 lstring.c \ 216 lstrlib.c \ 217 ltable.c \ 218 ltablib.c \ 219 ltm.c \ 220 lvm.c \ 221 lzio.c 222 223UNICODE_C = u8_textprep.c uconv.c 224 225SRCS= ${USER_C} ${KERNEL_C} ${LUA_C} ${UNICODE_C} ${ARCH_C} 226 227WARNS?= 2 228CFLAGS+= \ 229 -DIN_BASE \ 230 -I${ZFSTOP}/include \ 231 -I${ZFSTOP}/lib/libspl/include \ 232 -I${ZFSTOP}/lib/libspl/include/os/freebsd \ 233 -I${SRCTOP}/sys \ 234 -I${ZFSTOP}/include/os/freebsd/zfs \ 235 -I${SRCTOP}/cddl/compat/opensolaris/include \ 236 -I${ZFSTOP}/module/icp/include \ 237 -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \ 238 -DHAVE_ISSETUGID \ 239 -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \ 240 -I${SRCTOP}/sys/modules/zfs \ 241 -I${ZFSTOP}/include/os/freebsd/zfs \ 242 -DLIB_ZPOOL_BUILD -DZFS_DEBUG \ 243 244# XXX: pthread doesn't have mutex_owned() equivalent, so we need to look 245# into libthr private structures. That's sooo evil, but it's only for 246# ZFS debugging tools needs. 247CFLAGS+= -DWANTS_MUTEX_OWNED 248CFLAGS+= -I${SRCTOP}/lib/libpthread/thread 249CFLAGS+= -I${SRCTOP}/lib/libpthread/sys 250CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include 251CFLAGS.gcc+= -fms-extensions 252 253LIBADD= md pthread z spl icp nvpair avl umem 254 255# atomic.S doesn't like profiling. 256MK_PROFILE= no 257 258CSTD= c99 259 260# Since there are many asserts in this library, it makes no sense to compile 261# it without debugging. 262 263CFLAGS+= -g -DDEBUG=1 264 265CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith 266CFLAGS.zstd.c+= -fno-tree-vectorize 267 268.include <bsd.lib.mk> 269