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