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