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