xref: /freebsd/cddl/lib/libzpool/Makefile (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1# $FreeBSD$
2
3ZFSTOP=	${SRCTOP}/sys/contrib/openzfs
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.PATH: ${ZFSTOP}/module/os/linux/zfs
18
19.PATH: ${ZFSTOP}/lib/libzpool
20
21.if exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S)
22.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
23ATOMIC_SRCS=	opensolaris_atomic.S
24ACFLAGS+=	-Wa,--noexecstack
25.else
26.PATH: ${SRCTOP}/sys/cddl/compat/opensolaris/kern
27ATOMIC_SRCS=	opensolaris_atomic.c
28.endif
29
30.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe"
31# Don't waste GOT entries on small data.
32PICFLAG=	-fPIC
33.endif
34
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	btree.c \
65	bqueue.c \
66	cityhash.c \
67	dbuf.c \
68	dbuf_stats.c \
69	ddt.c \
70	ddt_zap.c \
71	dmu.c \
72	dmu_diff.c \
73	dmu_object.c \
74	dmu_objset.c \
75	dmu_recv.c \
76	dmu_redact.c \
77	dmu_send.c \
78	dmu_traverse.c \
79	dmu_tx.c \
80	dmu_zfetch.c \
81	dnode.c \
82	dnode_sync.c \
83	dsl_bookmark.c \
84	dsl_dataset.c \
85	dsl_deadlist.c \
86	dsl_deleg.c \
87	dsl_dir.c \
88	dsl_crypt.c \
89	dsl_pool.c \
90	dsl_prop.c \
91	dsl_scan.c \
92	dsl_synctask.c \
93	dsl_destroy.c \
94	dsl_userhold.c \
95	edonr_zfs.c \
96	entropy_common.c \
97	error_private.c \
98	fm.c \
99	fse_compress.c \
100	fse_decompress.c \
101	gzip.c \
102	hist.c \
103	hkdf.c \
104	huf_compress.c \
105	huf_decompress.c \
106	lzjb.c \
107	lz4.c \
108	lz4_zfs.c \
109	metaslab.c \
110	mmp.c \
111	multilist.c \
112	objlist.c \
113	pathname.c \
114	pool.c \
115	range_tree.c \
116	refcount.c \
117	rrwlock.c \
118	sa.c \
119	sha256.c \
120	skein_zfs.c \
121	spa.c \
122	spa_boot.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_cache.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_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.entropy_common.c=	-fno-tree-vectorize
291CFLAGS.entropy_common.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
292CFLAGS.error_private.c=		-fno-tree-vectorize
293CFLAGS.error_private.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
294CFLAGS.fse_compress.c=		-fno-tree-vectorize
295CFLAGS.fse_compress.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
296CFLAGS.fse_decompress.c=	-fno-tree-vectorize
297CFLAGS.fse_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
298CFLAGS.hist.c=			-fno-tree-vectorize
299CFLAGS.hist.c+=			${NO_WBITWISE_INSTEAD_OF_LOGICAL}
300CFLAGS.huf_compress.c=		-fno-tree-vectorize
301CFLAGS.huf_compress.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
302CFLAGS.huf_decompress.c=	-fno-tree-vectorize
303CFLAGS.huf_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
304CFLAGS.pool.c=			-fno-tree-vectorize
305CFLAGS.pool.c+=			${NO_WBITWISE_INSTEAD_OF_LOGICAL}
306CFLAGS.xxhash.c=		-fno-tree-vectorize
307CFLAGS.xxhash.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
308CFLAGS.zstd_compress.c=		-fno-tree-vectorize
309CFLAGS.zstd_compress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
310CFLAGS.zstd_compress_literals.c=	-fno-tree-vectorize
311CFLAGS.zstd_compress_literals.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
312CFLAGS.zstd_compress_sequences.c=	-fno-tree-vectorize
313CFLAGS.zstd_compress_sequences.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
314CFLAGS.zstd_compress_superblock.c=	-fno-tree-vectorize
315CFLAGS.zstd_compress_superblock.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
316CFLAGS.zstd_double_fast.c=	-fno-tree-vectorize
317CFLAGS.zstd_double_fast.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
318CFLAGS.zstd_fast.c=		-fno-tree-vectorize
319CFLAGS.zstd_fast.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
320CFLAGS.zstd_lazy.c=		-fno-tree-vectorize
321CFLAGS.zstd_lazy.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
322CFLAGS.zstd_ldm.c=		-fno-tree-vectorize
323CFLAGS.zstd_ldm.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
324CFLAGS.zstd_opt.c=		-fno-tree-vectorize
325CFLAGS.zstd_opt.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
326CFLAGS.zstd_ddict.c=		-fno-tree-vectorize
327CFLAGS.zstd_ddict.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
328CFLAGS.zstd_decompress.c=	-fno-tree-vectorize
329CFLAGS.zstd_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
330CFLAGS.zstd_decompress_block.c=	-fno-tree-vectorize
331CFLAGS.zstd_decompress_block.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
332
333.include <bsd.lib.mk>
334