xref: /freebsd/cddl/lib/libzpool/Makefile (revision 02e9120893770924227138ba49df1edb3896112a)
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_label_os.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