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