xref: /freebsd/cddl/lib/libzpool/Makefile (revision 3ff01b231dfa83d518854c63e7c9cd1debd1139e)
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
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
33LIB=		zpool
34
35USER_C = \
36	kernel.c \
37	taskq.c \
38	util.c
39
40KERNEL_C = \
41	zfeature_common.c \
42	zfs_comutil.c \
43	zfs_deleg.c \
44	zfs_fletcher.c \
45	zfs_fletcher_superscalar.c \
46	zfs_fletcher_superscalar4.c \
47	zfs_namecheck.c \
48	zfs_prop.c \
49	zfs_zstd.c \
50	zpool_prop.c \
51	zprop_common.c \
52	abd.c \
53	abd_os.c \
54	aggsum.c \
55	arc.c \
56	arc_os.c \
57	blkptr.c \
58	bplist.c \
59	bpobj.c \
60	bptree.c \
61	btree.c \
62	bqueue.c \
63	cityhash.c \
64	dbuf.c \
65	dbuf_stats.c \
66	ddt.c \
67	ddt_zap.c \
68	dmu.c \
69	dmu_diff.c \
70	dmu_object.c \
71	dmu_objset.c \
72	dmu_recv.c \
73	dmu_redact.c \
74	dmu_send.c \
75	dmu_traverse.c \
76	dmu_tx.c \
77	dmu_zfetch.c \
78	dnode.c \
79	dnode_sync.c \
80	dsl_bookmark.c \
81	dsl_dataset.c \
82	dsl_deadlist.c \
83	dsl_deleg.c \
84	dsl_dir.c \
85	dsl_crypt.c \
86	dsl_pool.c \
87	dsl_prop.c \
88	dsl_scan.c \
89	dsl_synctask.c \
90	dsl_destroy.c \
91	dsl_userhold.c \
92	edonr_zfs.c \
93	hkdf.c \
94	fm.c \
95	gzip.c \
96	lzjb.c \
97	lz4.c \
98	metaslab.c \
99	mmp.c \
100	multilist.c \
101	objlist.c \
102	pathname.c \
103	range_tree.c \
104	refcount.c \
105	rrwlock.c \
106	sa.c \
107	sha256.c \
108	skein_zfs.c \
109	spa.c \
110	spa_boot.c \
111	spa_checkpoint.c \
112	spa_config.c \
113	spa_errlog.c \
114	spa_history.c \
115	spa_log_spacemap.c \
116	spa_misc.c \
117	spa_stats.c \
118	space_map.c \
119	space_reftree.c \
120	txg.c \
121	trace.c \
122	uberblock.c \
123	unique.c \
124	vdev.c \
125	vdev_cache.c \
126	vdev_draid.c \
127	vdev_draid_rand.c \
128	vdev_file.c \
129	vdev_indirect_births.c \
130	vdev_indirect.c \
131	vdev_indirect_mapping.c \
132	vdev_initialize.c \
133	vdev_label.c \
134	vdev_mirror.c \
135	vdev_missing.c \
136	vdev_queue.c \
137	vdev_raidz.c \
138	vdev_raidz_math_aarch64_neon.c \
139	vdev_raidz_math_aarch64_neonx2.c \
140	vdev_raidz_math_avx2.c \
141	vdev_raidz_math_avx512bw.c \
142	vdev_raidz_math_avx512f.c \
143	vdev_raidz_math.c \
144	vdev_raidz_math_scalar.c \
145	vdev_rebuild.c \
146	vdev_removal.c \
147	vdev_root.c \
148	vdev_trim.c \
149	zap.c \
150	zap_leaf.c \
151	zap_micro.c \
152	zcp.c \
153	zcp_get.c \
154	zcp_global.c \
155	zcp_iter.c \
156	zcp_set.c \
157	zcp_synctask.c \
158	zfeature.c \
159	zfs_byteswap.c \
160	zfs_debug.c \
161	zfs_fm.c \
162	zfs_fuid.c \
163	zfs_sa.c \
164	zfs_znode.c \
165	zfs_racct.c \
166	zfs_ratelimit.c \
167	zfs_rlock.c \
168	zil.c \
169	zio.c \
170	zio_checksum.c \
171	zio_compress.c \
172	zio_crypt.c \
173	zio_inject.c \
174	zle.c \
175	zrlock.c \
176	zstd.c \
177	zthr.c
178
179ARCH_C =
180.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
181ARCH_C += 	vdev_raidz_math_sse2.c \
182		vdev_raidz_math_ssse3.c \
183		zfs_fletcher_intel.c \
184		zfs_fletcher_sse.c
185CFLAGS +=  -DHAVE_SSE2 	-DHAVE_SSE3
186.endif
187.if ${MACHINE_ARCH} == "amd64"
188ARCH_C +=	zfs_fletcher_avx512.c
189CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F \
190	-DHAVE_AVX512BW
191.endif
192.if ${MACHINE_CPUARCH} == "aarch64"
193ARCH_C +=	zfs_fletcher_aarch64_neon.c
194.endif
195
196LUA_C = \
197	lapi.c \
198	lauxlib.c \
199	lbaselib.c \
200	lcode.c \
201	lcompat.c \
202	lcorolib.c \
203	lctype.c \
204	ldebug.c \
205	ldo.c \
206	lfunc.c \
207	lgc.c \
208	llex.c \
209	lmem.c \
210	lobject.c \
211	lopcodes.c \
212	lparser.c \
213	lstate.c \
214	lstring.c \
215	lstrlib.c \
216	ltable.c \
217	ltablib.c \
218	ltm.c \
219	lvm.c \
220	lzio.c
221
222UNICODE_C = u8_textprep.c uconv.c
223
224SRCS=		${USER_C} ${KERNEL_C} ${LUA_C} ${UNICODE_C} ${ARCH_C}
225
226WARNS?=		2
227CFLAGS+= \
228	-DIN_BASE \
229	-I${ZFSTOP}/include \
230	-I${ZFSTOP}/lib/libspl/include \
231	-I${ZFSTOP}/lib/libspl/include/os/freebsd \
232	-I${SRCTOP}/sys \
233	-I${ZFSTOP}/include/os/freebsd/zfs \
234	-I${SRCTOP}/cddl/compat/opensolaris/include \
235	-I${ZFSTOP}/module/icp/include \
236	-include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \
237	-DHAVE_ISSETUGID \
238	-include ${SRCTOP}/sys/modules/zfs/zfs_config.h \
239	-I${SRCTOP}/sys/modules/zfs \
240	-I${ZFSTOP}/include/os/freebsd/zfs \
241	-DLIB_ZPOOL_BUILD -DZFS_DEBUG \
242
243# XXX: pthread doesn't have mutex_owned() equivalent, so we need to look
244#      into libthr private structures. That's sooo evil, but it's only for
245#      ZFS debugging tools needs.
246CFLAGS+=	-DWANTS_MUTEX_OWNED
247CFLAGS+=	-I${SRCTOP}/lib/libpthread/thread
248CFLAGS+=	-I${SRCTOP}/lib/libpthread/sys
249CFLAGS+=	-I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include
250CFLAGS.gcc+=	-fms-extensions
251
252LIBADD=		md pthread z spl icp nvpair avl umem
253
254# atomic.S doesn't like profiling.
255MK_PROFILE=	no
256
257CSTD=	c99
258
259# Since there are many asserts in this library, it makes no sense to compile
260# it without debugging.
261
262CFLAGS+=	-g -DDEBUG=1
263
264CFLAGS.zfs_zstd.c=	-Wno-cast-qual -Wno-pointer-arith
265CFLAGS.zstd.c+=	-fno-tree-vectorize
266
267.include <bsd.lib.mk>
268