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