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