xref: /freebsd/cddl/lib/libzpool/Makefile (revision 9bc300465e48e19d794d88d0c158a2adb92c7197)
1ZFSTOP=	${SRCTOP}/sys/contrib/openzfs
2
3# ZFS_COMMON_SRCS
4.PATH: ${ZFSTOP}/module/zfs
5.PATH: ${ZFSTOP}/module/zcommon
6.PATH: ${ZFSTOP}/module/unicode
7# LUA_SRCS
8.PATH: ${ZFSTOP}/module/lua
9# ZSTD_SRCS
10.PATH: ${ZFSTOP}/module/zstd
11.PATH: ${ZFSTOP}/module/zstd/lib/common
12.PATH: ${ZFSTOP}/module/zstd/lib/compress
13.PATH: ${ZFSTOP}/module/zstd/lib/decompress
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
33PACKAGE=	zfs
34LIB=		zpool
35
36USER_C = \
37	kernel.c \
38	taskq.c \
39	util.c
40
41KERNEL_C = \
42	zfeature_common.c \
43	zfs_comutil.c \
44	zfs_deleg.c \
45	zfs_fletcher.c \
46	zfs_fletcher_superscalar.c \
47	zfs_fletcher_superscalar4.c \
48	zfs_namecheck.c \
49	zfs_prop.c \
50	zfs_zstd.c \
51	zpool_prop.c \
52	zprop_common.c \
53	abd.c \
54	abd_os.c \
55	aggsum.c \
56	arc.c \
57	arc_os.c \
58        blake3_zfs.c \
59	blkptr.c \
60	bplist.c \
61	bpobj.c \
62	bptree.c \
63	bqueue.c \
64	btree.c \
65	brt.c \
66	cityhash.c \
67	dbuf.c \
68	dbuf_stats.c \
69	ddt.c \
70	ddt_stats.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
290CFLAGS.gcc+=	-Wno-pointer-to-int-cast
291
292# Pointer values are used as debugging "tags" to mark reference count
293# ownerships and in some cases the tag reference is dropped after an
294# object is freed.
295CFLAGS.dbuf.c=			${NO_WUSE_AFTER_FREE}
296CFLAGS.entropy_common.c=	-fno-tree-vectorize
297CFLAGS.entropy_common.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
298CFLAGS.error_private.c=		-fno-tree-vectorize
299CFLAGS.error_private.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
300CFLAGS.fse_compress.c=		-fno-tree-vectorize
301CFLAGS.fse_compress.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
302CFLAGS.fse_decompress.c=	-fno-tree-vectorize
303CFLAGS.fse_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
304CFLAGS.hist.c=			-fno-tree-vectorize
305CFLAGS.hist.c+=			${NO_WBITWISE_INSTEAD_OF_LOGICAL}
306CFLAGS.huf_compress.c=		-fno-tree-vectorize
307CFLAGS.huf_compress.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
308CFLAGS.huf_decompress.c=	-fno-tree-vectorize
309CFLAGS.huf_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
310CFLAGS.pool.c=			-fno-tree-vectorize
311CFLAGS.pool.c+=			${NO_WBITWISE_INSTEAD_OF_LOGICAL}
312CFLAGS.xxhash.c=		-fno-tree-vectorize
313CFLAGS.xxhash.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
314CFLAGS.zstd_compress.c=		-fno-tree-vectorize
315CFLAGS.zstd_compress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
316CFLAGS.zstd_compress_literals.c=	-fno-tree-vectorize
317CFLAGS.zstd_compress_literals.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
318CFLAGS.zstd_compress_sequences.c=	-fno-tree-vectorize
319CFLAGS.zstd_compress_sequences.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
320CFLAGS.zstd_compress_superblock.c=	-fno-tree-vectorize
321CFLAGS.zstd_compress_superblock.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
322CFLAGS.zstd_double_fast.c=	-fno-tree-vectorize
323CFLAGS.zstd_double_fast.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
324CFLAGS.zstd_fast.c=		-fno-tree-vectorize
325CFLAGS.zstd_fast.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
326CFLAGS.zstd_lazy.c=		-fno-tree-vectorize
327CFLAGS.zstd_lazy.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
328CFLAGS.zstd_ldm.c=		-fno-tree-vectorize
329CFLAGS.zstd_ldm.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
330CFLAGS.zstd_opt.c=		-fno-tree-vectorize
331CFLAGS.zstd_opt.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
332CFLAGS.zstd_ddict.c=		-fno-tree-vectorize
333CFLAGS.zstd_ddict.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
334CFLAGS.zstd_decompress.c=	-fno-tree-vectorize
335CFLAGS.zstd_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
336CFLAGS.zstd_decompress_block.c=	-fno-tree-vectorize
337CFLAGS.zstd_decompress_block.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
338
339.include <bsd.lib.mk>
340