xref: /freebsd/cddl/lib/libzpool/Makefile (revision 81e0e7b9e36d6a25b3af6482811318e085537d2f)
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	blkptr.c \
60	bplist.c \
61	bpobj.c \
62	bptree.c \
63	btree.c \
64	bqueue.c \
65	cityhash.c \
66	dbuf.c \
67	dbuf_stats.c \
68	ddt.c \
69	ddt_zap.c \
70	dmu.c \
71	dmu_diff.c \
72	dmu_object.c \
73	dmu_objset.c \
74	dmu_recv.c \
75	dmu_redact.c \
76	dmu_send.c \
77	dmu_traverse.c \
78	dmu_tx.c \
79	dmu_zfetch.c \
80	dnode.c \
81	dnode_sync.c \
82	dsl_bookmark.c \
83	dsl_dataset.c \
84	dsl_deadlist.c \
85	dsl_deleg.c \
86	dsl_dir.c \
87	dsl_crypt.c \
88	dsl_pool.c \
89	dsl_prop.c \
90	dsl_scan.c \
91	dsl_synctask.c \
92	dsl_destroy.c \
93	dsl_userhold.c \
94	edonr_zfs.c \
95	entropy_common.c \
96	error_private.c \
97	fm.c \
98	fse_compress.c \
99	fse_decompress.c \
100	gzip.c \
101	hist.c \
102	hkdf.c \
103	huf_compress.c \
104	huf_decompress.c \
105	lzjb.c \
106	lz4.c \
107	lz4_zfs.c \
108	metaslab.c \
109	mmp.c \
110	multilist.c \
111	objlist.c \
112	pathname.c \
113	pool.c \
114	range_tree.c \
115	refcount.c \
116	rrwlock.c \
117	sa.c \
118	sha256.c \
119	skein_zfs.c \
120	spa.c \
121	spa_boot.c \
122	spa_checkpoint.c \
123	spa_config.c \
124	spa_errlog.c \
125	spa_history.c \
126	spa_log_spacemap.c \
127	spa_misc.c \
128	spa_stats.c \
129	space_map.c \
130	space_reftree.c \
131	txg.c \
132	trace.c \
133	uberblock.c \
134	unique.c \
135	vdev.c \
136	vdev_cache.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_debug.c \
173	zfs_fm.c \
174	zfs_fuid.c \
175	zfs_sa.c \
176	zfs_znode.c \
177	zfs_racct.c \
178	zfs_ratelimit.c \
179	zfs_rlock.c \
180	zil.c \
181	zio.c \
182	zio_checksum.c \
183	zio_compress.c \
184	zio_crypt.c \
185	zio_inject.c \
186	zle.c \
187	zrlock.c \
188	zstd_common.c \
189	zstd_compress.c \
190	zstd_compress_literals.c \
191	zstd_compress_sequences.c \
192	zstd_compress_superblock.c \
193	zstd_ddict.c \
194	zstd_decompress.c \
195	zstd_decompress_block.c \
196	zstd_double_fast.c \
197	zstd_fast.c \
198	zstd_lazy.c \
199	zstd_ldm.c \
200	zstd_opt.c \
201	zthr.c
202
203ARCH_C =
204.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
205ARCH_C += 	vdev_raidz_math_sse2.c \
206		vdev_raidz_math_ssse3.c \
207		zfs_fletcher_intel.c \
208		zfs_fletcher_sse.c
209CFLAGS +=  -DHAVE_SSE2 	-DHAVE_SSE3
210.endif
211.if ${MACHINE_ARCH} == "amd64"
212ARCH_C +=	zfs_fletcher_avx512.c
213CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F \
214	-DHAVE_AVX512BW
215.endif
216.if ${MACHINE_CPUARCH} == "aarch64"
217ARCH_C +=	zfs_fletcher_aarch64_neon.c
218.endif
219
220LUA_C = \
221	lapi.c \
222	lauxlib.c \
223	lbaselib.c \
224	lcode.c \
225	lcompat.c \
226	lcorolib.c \
227	lctype.c \
228	ldebug.c \
229	ldo.c \
230	lfunc.c \
231	lgc.c \
232	llex.c \
233	lmem.c \
234	lobject.c \
235	lopcodes.c \
236	lparser.c \
237	lstate.c \
238	lstring.c \
239	lstrlib.c \
240	ltable.c \
241	ltablib.c \
242	ltm.c \
243	lvm.c \
244	lzio.c
245
246UNICODE_C = u8_textprep.c uconv.c
247
248SRCS=		${USER_C} ${KERNEL_C} ${LUA_C} ${UNICODE_C} ${ARCH_C}
249
250WARNS?=		2
251CFLAGS+= \
252	-DIN_BASE \
253	-I${ZFSTOP}/include \
254	-I${ZFSTOP}/lib/libspl/include \
255	-I${ZFSTOP}/lib/libspl/include/os/freebsd \
256	-I${SRCTOP}/sys \
257	-I${ZFSTOP}/include/os/freebsd/zfs \
258	-I${SRCTOP}/cddl/compat/opensolaris/include \
259	-I${ZFSTOP}/module/icp/include \
260	-include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \
261	-DHAVE_ISSETUGID \
262	-include ${SRCTOP}/sys/modules/zfs/zfs_config.h \
263	-I${SRCTOP}/sys/modules/zfs \
264	-I${ZFSTOP}/include/os/freebsd/zfs \
265	-DLIB_ZPOOL_BUILD -DZFS_DEBUG \
266
267# XXX: pthread doesn't have mutex_owned() equivalent, so we need to look
268#      into libthr private structures. That's sooo evil, but it's only for
269#      ZFS debugging tools needs.
270CFLAGS+=	-DWANTS_MUTEX_OWNED
271CFLAGS+=	-I${SRCTOP}/lib/libpthread/thread
272CFLAGS+=	-I${SRCTOP}/lib/libpthread/sys
273CFLAGS+=	-I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include
274CFLAGS.gcc+=	-fms-extensions
275
276LIBADD=		md pthread z spl icp nvpair avl umem
277
278# atomic.S doesn't like profiling.
279MK_PROFILE=	no
280
281CSTD=	c99
282
283# Since there are many asserts in this library, it makes no sense to compile
284# it without debugging.
285
286CFLAGS+=	-g -DDEBUG=1
287
288CFLAGS.entropy_common.c=	-fno-tree-vectorize
289CFLAGS.entropy_common.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
290CFLAGS.error_private.c=		-fno-tree-vectorize
291CFLAGS.error_private.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
292CFLAGS.fse_compress.c=		-fno-tree-vectorize
293CFLAGS.fse_compress.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
294CFLAGS.fse_decompress.c=	-fno-tree-vectorize
295CFLAGS.fse_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
296CFLAGS.hist.c=			-fno-tree-vectorize
297CFLAGS.hist.c+=			${NO_WBITWISE_INSTEAD_OF_LOGICAL}
298CFLAGS.huf_compress.c=		-fno-tree-vectorize
299CFLAGS.huf_compress.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
300CFLAGS.huf_decompress.c=	-fno-tree-vectorize
301CFLAGS.huf_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
302CFLAGS.pool.c=			-fno-tree-vectorize
303CFLAGS.pool.c+=			${NO_WBITWISE_INSTEAD_OF_LOGICAL}
304CFLAGS.xxhash.c=		-fno-tree-vectorize
305CFLAGS.xxhash.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
306CFLAGS.zstd_compress.c=		-fno-tree-vectorize
307CFLAGS.zstd_compress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
308CFLAGS.zstd_compress_literals.c=	-fno-tree-vectorize
309CFLAGS.zstd_compress_literals.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
310CFLAGS.zstd_compress_sequences.c=	-fno-tree-vectorize
311CFLAGS.zstd_compress_sequences.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
312CFLAGS.zstd_compress_superblock.c=	-fno-tree-vectorize
313CFLAGS.zstd_compress_superblock.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
314CFLAGS.zstd_double_fast.c=	-fno-tree-vectorize
315CFLAGS.zstd_double_fast.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
316CFLAGS.zstd_fast.c=		-fno-tree-vectorize
317CFLAGS.zstd_fast.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
318CFLAGS.zstd_lazy.c=		-fno-tree-vectorize
319CFLAGS.zstd_lazy.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
320CFLAGS.zstd_ldm.c=		-fno-tree-vectorize
321CFLAGS.zstd_ldm.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
322CFLAGS.zstd_opt.c=		-fno-tree-vectorize
323CFLAGS.zstd_opt.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
324CFLAGS.zstd_ddict.c=		-fno-tree-vectorize
325CFLAGS.zstd_ddict.c+=		${NO_WBITWISE_INSTEAD_OF_LOGICAL}
326CFLAGS.zstd_decompress.c=	-fno-tree-vectorize
327CFLAGS.zstd_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
328CFLAGS.zstd_decompress_block.c=	-fno-tree-vectorize
329CFLAGS.zstd_decompress_block.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
330
331.include <bsd.lib.mk>
332