xref: /freebsd/sys/modules/zfs/Makefile (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
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_racct.c \
130	zfs_replay.c \
131	zfs_vfsops.c \
132	zfs_vnops_os.c \
133	zfs_znode.c \
134	zio_crypt.c \
135	zvol_os.c
136
137#unicode
138SRCS+=	uconv.c \
139	u8_textprep.c
140
141#zcommon
142SRCS+=	zfeature_common.c \
143	zfs_comutil.c \
144	zfs_deleg.c \
145	zfs_fletcher.c \
146	zfs_fletcher_avx512.c \
147	zfs_fletcher_intel.c \
148	zfs_fletcher_sse.c \
149	zfs_fletcher_superscalar.c \
150	zfs_fletcher_superscalar4.c \
151	zfs_namecheck.c \
152	zfs_prop.c \
153	zpool_prop.c \
154	zprop_common.c
155
156#zfs
157SRCS+=	abd.c \
158	aggsum.c \
159	arc.c \
160	arc_os.c \
161	blkptr.c \
162	bplist.c \
163	bpobj.c \
164	cityhash.c \
165	dbuf.c \
166	dbuf_stats.c \
167	bptree.c \
168	bqueue.c \
169	dataset_kstats.c \
170	ddt.c \
171	ddt_zap.c \
172	dmu.c \
173	dmu_diff.c \
174	dmu_object.c \
175	dmu_objset.c \
176	dmu_recv.c \
177	dmu_redact.c \
178	dmu_send.c \
179	dmu_traverse.c \
180	dmu_tx.c \
181	dmu_zfetch.c \
182	dnode.c \
183	dnode_sync.c \
184	dsl_dataset.c \
185	dsl_deadlist.c \
186	dsl_deleg.c \
187	dsl_bookmark.c \
188	dsl_dir.c \
189	dsl_crypt.c \
190	dsl_destroy.c \
191	dsl_pool.c \
192	dsl_prop.c \
193	dsl_scan.c \
194	dsl_synctask.c \
195	dsl_userhold.c \
196	fm.c \
197	gzip.c \
198	lzjb.c \
199	lz4.c \
200	metaslab.c \
201	mmp.c \
202	multilist.c \
203	objlist.c \
204	pathname.c \
205	range_tree.c \
206	refcount.c \
207	rrwlock.c \
208	sa.c \
209	sha256.c \
210	skein_zfs.c \
211	spa.c \
212	spa_boot.c \
213	spa_checkpoint.c \
214	spa_config.c \
215	spa_errlog.c \
216	spa_history.c \
217	spa_log_spacemap.c \
218	spa_misc.c \
219	spa_stats.c \
220	space_map.c \
221	space_reftree.c \
222	txg.c \
223	uberblock.c \
224	unique.c \
225	vdev.c \
226	vdev_cache.c \
227	vdev_draid.c \
228	vdev_draid_rand.c \
229	vdev_indirect.c \
230	vdev_indirect_births.c \
231	vdev_indirect_mapping.c \
232	vdev_initialize.c \
233	vdev_label.c \
234	vdev_mirror.c \
235	vdev_missing.c \
236	vdev_queue.c \
237	vdev_raidz.c \
238	vdev_raidz_math.c \
239	vdev_raidz_math_scalar.c \
240	vdev_raidz_math_avx2.c \
241	vdev_raidz_math_avx512bw.c \
242	vdev_raidz_math_avx512f.c \
243	vdev_raidz_math_sse2.c \
244	vdev_raidz_math_ssse3.c \
245	vdev_rebuild.c \
246	vdev_removal.c \
247	vdev_root.c \
248	vdev_trim.c \
249	zap.c \
250	zap_leaf.c \
251	zap_micro.c \
252	zcp.c \
253	zcp_get.c \
254	zcp_global.c \
255	zcp_iter.c \
256	zcp_set.c \
257	zcp_synctask.c \
258	zfeature.c \
259	zfs_byteswap.c \
260	zfs_debug.c \
261	zfs_file_os.c \
262	zfs_fm.c \
263	zfs_fuid.c \
264	zfs_ioctl.c \
265	zfs_onexit.c \
266	zfs_quota.c \
267	zfs_ratelimit.c \
268	zfs_rlock.c \
269	zfs_sa.c \
270	zfs_vnops.c \
271	zil.c \
272	zio.c \
273	zio_checksum.c \
274	zio_compress.c \
275	zio_inject.c \
276	zle.c \
277	zrlock.c \
278	zthr.c \
279	zvol.c
280
281SRCS+=	zfs_zstd.c \
282	zstd.c
283
284.include <bsd.kmod.mk>
285
286CFLAGS+= -include ${SRCTOP}/sys/cddl/compat/opensolaris/sys/debug_compat.h
287
288CWARNFLAGS+=	${OPENZFS_CWARNFLAGS}
289
290CFLAGS.gcc+= -Wno-pointer-to-int-cast
291
292CFLAGS.lapi.c= -Wno-cast-qual
293CFLAGS.lcompat.c= -Wno-cast-qual
294CFLAGS.lobject.c= -Wno-cast-qual
295CFLAGS.ltable.c= -Wno-cast-qual
296CFLAGS.lvm.c= -Wno-cast-qual
297CFLAGS.nvpair.c= -Wno-cast-qual -DHAVE_RPC_TYPES
298CFLAGS.spl_string.c= -Wno-cast-qual
299CFLAGS.spl_vm.c= -Wno-cast-qual
300CFLAGS.spl_zlib.c= -Wno-cast-qual
301CFLAGS.abd.c= -Wno-cast-qual
302CFLAGS.zfs_log.c= -Wno-cast-qual
303CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith
304CFLAGS.u8_textprep.c= -Wno-cast-qual
305CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith
306CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith
307CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith
308CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith
309CFLAGS.zprop_common.c= -Wno-cast-qual
310CFLAGS.ddt.c= -Wno-cast-qual
311CFLAGS.dmu.c= -Wno-cast-qual
312CFLAGS.dmu_traverse.c= -Wno-cast-qual
313CFLAGS.dsl_dir.c= -Wno-cast-qual
314CFLAGS.dsl_deadlist.c= -Wno-cast-qual
315CFLAGS.dsl_prop.c= -Wno-cast-qual
316CFLAGS.fm.c= -Wno-cast-qual
317CFLAGS.lz4.c= -Wno-cast-qual
318CFLAGS.spa.c= -Wno-cast-qual
319CFLAGS.spa_misc.c= -Wno-cast-qual
320CFLAGS.sysctl_os.c= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
321CFLAGS.vdev_draid.c= -Wno-cast-qual
322CFLAGS.vdev_raidz.c= -Wno-cast-qual
323CFLAGS.vdev_raidz_math.c= -Wno-cast-qual
324CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual
325CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
326CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
327CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
328CFLAGS.zap_leaf.c= -Wno-cast-qual
329CFLAGS.zap_micro.c= -Wno-cast-qual
330CFLAGS.zcp.c= -Wno-cast-qual
331CFLAGS.zfs_fm.c= -Wno-cast-qual
332CFLAGS.zfs_ioctl.c= -Wno-cast-qual
333CFLAGS.zil.c= -Wno-cast-qual
334CFLAGS.zio.c= -Wno-cast-qual
335CFLAGS.zrlock.c= -Wno-cast-qual
336CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
337CFLAGS.zstd.c= -U__BMI__ -fno-tree-vectorize
338.if ${MACHINE_CPUARCH} == "aarch64"
339CFLAGS.zstd.c+= -include ${SRCDIR}/zstd/include/aarch64_compat.h
340.endif
341