xref: /freebsd/sys/modules/zfs/Makefile (revision 12af59c2cf8dbede2c1386c4744e725b1e1f8bd9)
1# $FreeBSD$
2
3SRCDIR=${SRCTOP}/sys/contrib/openzfs/module
4INCDIR=${SRCTOP}/sys/contrib/openzfs/include
5
6KMOD=	zfs
7
8.PATH:	${SRCDIR}/avl \
9	${SRCDIR}/lua \
10	${SRCDIR}/nvpair \
11	${SRCDIR}/icp/algs/edonr \
12	${SRCDIR}/os/freebsd/spl \
13	${SRCDIR}/os/freebsd/zfs \
14	${SRCDIR}/unicode \
15	${SRCDIR}/zcommon \
16	${SRCDIR}/zfs	\
17	${SRCDIR}/zstd	\
18	${SRCDIR}/zstd/lib
19
20
21CFLAGS+= -I${INCDIR}
22CFLAGS+= -I${INCDIR}/os/freebsd
23CFLAGS+= -I${INCDIR}/os/freebsd/spl
24CFLAGS+= -I${INCDIR}/os/freebsd/zfs
25CFLAGS+= -I${SRCDIR}/zstd/include
26CFLAGS+= -I${.CURDIR}
27
28CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS \
29	-DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \
30	-D_SYS_VMEM_H_ -DIN_FREEBSD_BASE -DHAVE_KSID
31
32.if ${MACHINE_ARCH} == "amd64"
33CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F -DHAVE_AVX512BW -DHAVE_SSSE3
34.endif
35
36.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
37	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
38CFLAGS+= -DBITS_PER_LONG=32
39.else
40CFLAGS+= -DBITS_PER_LONG=64
41.endif
42
43SRCS=	vnode_if.h device_if.h bus_if.h
44
45# avl
46SRCS+=	avl.c
47
48# icp
49SRCS+=	edonr.c
50
51#lua
52SRCS+=	lapi.c \
53	lauxlib.c \
54	lbaselib.c \
55	lcode.c \
56	lcompat.c \
57	lcorolib.c \
58	lctype.c \
59	ldebug.c \
60	ldo.c \
61	lfunc.c \
62	lgc.c \
63	llex.c \
64	lmem.c \
65	lobject.c \
66	lopcodes.c \
67	lparser.c \
68	lstate.c \
69	lstring.c \
70	lstrlib.c \
71	ltable.c \
72	ltablib.c \
73	ltm.c \
74	lvm.c \
75	lzio.c
76
77#nvpair
78SRCS+=	nvpair.c \
79	fnvpair.c \
80	nvpair_alloc_spl.c \
81	nvpair_alloc_fixed.c
82
83#os/freebsd/spl
84SRCS+=	acl_common.c \
85	btree.c \
86	callb.c \
87	list.c \
88	spl_acl.c \
89	spl_cmn_err.c \
90	spl_dtrace.c \
91	spl_kmem.c \
92	spl_kstat.c \
93	spl_misc.c \
94	spl_policy.c \
95	spl_string.c \
96	spl_sunddi.c \
97	spl_sysevent.c \
98	spl_taskq.c \
99	spl_uio.c \
100	spl_vfs.c \
101	spl_vm.c \
102	spl_zone.c \
103	sha256c.c \
104	sha512c.c \
105	spl_procfs_list.c \
106	spl_zlib.c
107
108
109.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
110	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
111SRCS+= spl_atomic.c
112.endif
113
114#os/freebsd/zfs
115SRCS+=	abd_os.c \
116	crypto_os.c \
117	dmu_os.c \
118	hkdf.c \
119	kmod_core.c \
120	spa_os.c \
121	sysctl_os.c \
122	vdev_file.c \
123	vdev_label_os.c \
124	vdev_geom.c \
125	zfs_acl.c \
126	zfs_ctldir.c \
127	zfs_dir.c \
128	zfs_ioctl_compat.c \
129	zfs_ioctl_os.c \
130	zfs_log.c \
131	zfs_racct.c \
132	zfs_replay.c \
133	zfs_vfsops.c \
134	zfs_vnops_os.c \
135	zfs_znode.c \
136	zio_crypt.c \
137	zvol_os.c
138
139#unicode
140SRCS+=	uconv.c \
141	u8_textprep.c
142
143#zcommon
144SRCS+=	zfeature_common.c \
145	zfs_comutil.c \
146	zfs_deleg.c \
147	zfs_fletcher.c \
148	zfs_fletcher_avx512.c \
149	zfs_fletcher_intel.c \
150	zfs_fletcher_sse.c \
151	zfs_fletcher_superscalar.c \
152	zfs_fletcher_superscalar4.c \
153	zfs_namecheck.c \
154	zfs_prop.c \
155	zpool_prop.c \
156	zprop_common.c
157
158#zfs
159SRCS+=	abd.c \
160	aggsum.c \
161	arc.c \
162	arc_os.c \
163	blkptr.c \
164	bplist.c \
165	bpobj.c \
166	cityhash.c \
167	dbuf.c \
168	dbuf_stats.c \
169	bptree.c \
170	bqueue.c \
171	dataset_kstats.c \
172	ddt.c \
173	ddt_zap.c \
174	dmu.c \
175	dmu_diff.c \
176	dmu_object.c \
177	dmu_objset.c \
178	dmu_recv.c \
179	dmu_redact.c \
180	dmu_send.c \
181	dmu_traverse.c \
182	dmu_tx.c \
183	dmu_zfetch.c \
184	dnode.c \
185	dnode_sync.c \
186	dsl_dataset.c \
187	dsl_deadlist.c \
188	dsl_deleg.c \
189	dsl_bookmark.c \
190	dsl_dir.c \
191	dsl_crypt.c \
192	dsl_destroy.c \
193	dsl_pool.c \
194	dsl_prop.c \
195	dsl_scan.c \
196	dsl_synctask.c \
197	dsl_userhold.c \
198	edonr_zfs.c \
199	fm.c \
200	gzip.c \
201	lzjb.c \
202	lz4.c \
203	lz4_zfs.c \
204	metaslab.c \
205	mmp.c \
206	multilist.c \
207	objlist.c \
208	pathname.c \
209	range_tree.c \
210	refcount.c \
211	rrwlock.c \
212	sa.c \
213	sha256.c \
214	skein_zfs.c \
215	spa.c \
216	spa_boot.c \
217	spa_checkpoint.c \
218	spa_config.c \
219	spa_errlog.c \
220	spa_history.c \
221	spa_log_spacemap.c \
222	spa_misc.c \
223	spa_stats.c \
224	space_map.c \
225	space_reftree.c \
226	txg.c \
227	uberblock.c \
228	unique.c \
229	vdev.c \
230	vdev_cache.c \
231	vdev_draid.c \
232	vdev_draid_rand.c \
233	vdev_indirect.c \
234	vdev_indirect_births.c \
235	vdev_indirect_mapping.c \
236	vdev_initialize.c \
237	vdev_label.c \
238	vdev_mirror.c \
239	vdev_missing.c \
240	vdev_queue.c \
241	vdev_raidz.c \
242	vdev_raidz_math.c \
243	vdev_raidz_math_scalar.c \
244	vdev_raidz_math_avx2.c \
245	vdev_raidz_math_avx512bw.c \
246	vdev_raidz_math_avx512f.c \
247	vdev_raidz_math_sse2.c \
248	vdev_raidz_math_ssse3.c \
249	vdev_rebuild.c \
250	vdev_removal.c \
251	vdev_root.c \
252	vdev_trim.c \
253	zap.c \
254	zap_leaf.c \
255	zap_micro.c \
256	zcp.c \
257	zcp_get.c \
258	zcp_global.c \
259	zcp_iter.c \
260	zcp_set.c \
261	zcp_synctask.c \
262	zfeature.c \
263	zfs_byteswap.c \
264	zfs_debug.c \
265	zfs_file_os.c \
266	zfs_fm.c \
267	zfs_fuid.c \
268	zfs_ioctl.c \
269	zfs_onexit.c \
270	zfs_quota.c \
271	zfs_ratelimit.c \
272	zfs_rlock.c \
273	zfs_sa.c \
274	zfs_vnops.c \
275	zil.c \
276	zio.c \
277	zio_checksum.c \
278	zio_compress.c \
279	zio_inject.c \
280	zle.c \
281	zrlock.c \
282	zthr.c \
283	zvol.c
284
285SRCS+=	zfs_zstd.c \
286	zstd.c
287
288.include <bsd.kmod.mk>
289
290CFLAGS+= -include ${SRCTOP}/sys/cddl/compat/opensolaris/sys/debug_compat.h
291CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h
292CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h
293
294CWARNFLAGS+=	${OPENZFS_CWARNFLAGS}
295
296CFLAGS.gcc+= -Wno-pointer-to-int-cast
297
298CFLAGS.lapi.c= -Wno-cast-qual
299CFLAGS.lcompat.c= -Wno-cast-qual
300CFLAGS.lobject.c= -Wno-cast-qual
301CFLAGS.ltable.c= -Wno-cast-qual
302CFLAGS.lvm.c= -Wno-cast-qual
303CFLAGS.nvpair.c= -Wno-cast-qual -DHAVE_RPC_TYPES
304CFLAGS.spl_string.c= -Wno-cast-qual
305CFLAGS.spl_vm.c= -Wno-cast-qual
306CFLAGS.spl_zlib.c= -Wno-cast-qual
307CFLAGS.abd.c= -Wno-cast-qual
308CFLAGS.zfs_log.c= -Wno-cast-qual
309CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith
310CFLAGS.u8_textprep.c= -Wno-cast-qual
311CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith
312CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith
313CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith
314CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith
315CFLAGS.zprop_common.c= -Wno-cast-qual
316CFLAGS.ddt.c= -Wno-cast-qual
317CFLAGS.dmu.c= -Wno-cast-qual
318CFLAGS.dmu_traverse.c= -Wno-cast-qual
319CFLAGS.dsl_dir.c= -Wno-cast-qual
320CFLAGS.dsl_deadlist.c= -Wno-cast-qual
321CFLAGS.dsl_prop.c= -Wno-cast-qual
322CFLAGS.edonr.c= -Wno-cast-qual
323CFLAGS.fm.c= -Wno-cast-qual
324CFLAGS.lz4.c= -Wno-cast-qual
325CFLAGS.lz4_zfs.c= -Wno-cast-qual
326CFLAGS.spa.c= -Wno-cast-qual
327CFLAGS.spa_misc.c= -Wno-cast-qual
328CFLAGS.sysctl_os.c= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
329CFLAGS.vdev_draid.c= -Wno-cast-qual
330CFLAGS.vdev_raidz.c= -Wno-cast-qual
331CFLAGS.vdev_raidz_math.c= -Wno-cast-qual
332CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual
333CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
334CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
335CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
336CFLAGS.zap_leaf.c= -Wno-cast-qual
337CFLAGS.zap_micro.c= -Wno-cast-qual
338CFLAGS.zcp.c= -Wno-cast-qual
339CFLAGS.zfs_fm.c= -Wno-cast-qual
340CFLAGS.zfs_ioctl.c= -Wno-cast-qual
341CFLAGS.zil.c= -Wno-cast-qual
342CFLAGS.zio.c= -Wno-cast-qual
343CFLAGS.zrlock.c= -Wno-cast-qual
344CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
345CFLAGS.zstd.c= -U__BMI__ -fno-tree-vectorize
346.if ${MACHINE_CPUARCH} == "aarch64"
347CFLAGS.zstd.c+= -include ${SRCDIR}/zstd/include/aarch64_compat.h
348.endif
349