xref: /freebsd/sys/modules/zfs/Makefile (revision 3cbb4cc200f8a0ad7ed08233425ea54524a21f1c)
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}/spl
22CFLAGS+= -I${INCDIR}/os/freebsd
23CFLAGS+= -I${INCDIR}/os/freebsd/spl
24CFLAGS+= -I${INCDIR}/os/freebsd/zfs
25CFLAGS+= -I${SRCDIR}/zstd/include
26CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h
27CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h
28CFLAGS+= -I${.CURDIR}
29
30CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS \
31	-DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \
32	-D_SYS_VMEM_H_ -DIN_FREEBSD_BASE -DHAVE_KSID
33
34.if ${MACHINE_ARCH} == "amd64"
35CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F -DHAVE_AVX512BW -DHAVE_SSSE3
36.endif
37
38.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
39	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
40CFLAGS+= -DBITS_PER_LONG=32
41.else
42CFLAGS+= -DBITS_PER_LONG=64
43.endif
44
45SRCS=	vnode_if.h device_if.h bus_if.h
46
47# avl
48SRCS+=	avl.c
49
50#lua
51SRCS+=	lapi.c \
52	lauxlib.c \
53	lbaselib.c \
54	lcode.c \
55	lcompat.c \
56	lcorolib.c \
57	lctype.c \
58	ldebug.c \
59	ldo.c \
60	lfunc.c \
61	lgc.c \
62	llex.c \
63	lmem.c \
64	lobject.c \
65	lopcodes.c \
66	lparser.c \
67	lstate.c \
68	lstring.c \
69	lstrlib.c \
70	ltable.c \
71	ltablib.c \
72	ltm.c \
73	lvm.c \
74	lzio.c
75
76#nvpair
77SRCS+=	nvpair.c \
78	fnvpair.c \
79	nvpair_alloc_spl.c \
80	nvpair_alloc_fixed.c
81
82#os/freebsd/spl
83SRCS+=	acl_common.c \
84	btree.c \
85	callb.c \
86	list.c \
87	spl_acl.c \
88	spl_cmn_err.c \
89	spl_dtrace.c \
90	spl_kmem.c \
91	spl_kstat.c \
92	spl_misc.c \
93	spl_policy.c \
94	spl_string.c \
95	spl_sunddi.c \
96	spl_sysevent.c \
97	spl_taskq.c \
98	spl_uio.c \
99	spl_vfs.c \
100	spl_vm.c \
101	spl_zone.c \
102	sha256c.c \
103	sha512c.c \
104	spl_procfs_list.c \
105	spl_zlib.c
106
107
108.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
109	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
110SRCS+= spl_atomic.c
111.endif
112
113#os/freebsd/zfs
114SRCS+=	abd_os.c \
115	crypto_os.c \
116	dmu_os.c \
117	hkdf.c \
118	kmod_core.c \
119	spa_os.c \
120	sysctl_os.c \
121	vdev_file.c \
122	vdev_label_os.c \
123	vdev_geom.c \
124	zfs_acl.c \
125	zfs_ctldir.c \
126	zfs_dir.c \
127	zfs_ioctl_compat.c \
128	zfs_ioctl_os.c \
129	zfs_log.c \
130	zfs_replay.c \
131	zfs_vfsops.c \
132	zfs_vnops.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_indirect.c \
228	vdev_indirect_births.c \
229	vdev_indirect_mapping.c \
230	vdev_initialize.c \
231	vdev_label.c \
232	vdev_mirror.c \
233	vdev_missing.c \
234	vdev_queue.c \
235	vdev_raidz.c \
236	vdev_raidz_math.c \
237	vdev_raidz_math_scalar.c \
238	vdev_raidz_math_avx2.c \
239	vdev_raidz_math_avx512bw.c \
240	vdev_raidz_math_avx512f.c \
241	vdev_raidz_math_sse2.c \
242	vdev_raidz_math_ssse3.c \
243	vdev_rebuild.c \
244	vdev_removal.c \
245	vdev_root.c \
246	vdev_trim.c \
247	zap.c \
248	zap_leaf.c \
249	zap_micro.c \
250	zcp.c \
251	zcp_get.c \
252	zcp_global.c \
253	zcp_iter.c \
254	zcp_set.c \
255	zcp_synctask.c \
256	zfeature.c \
257	zfs_byteswap.c \
258	zfs_debug.c \
259	zfs_file_os.c \
260	zfs_fm.c \
261	zfs_fuid.c \
262	zfs_ioctl.c \
263	zfs_onexit.c \
264	zfs_quota.c \
265	zfs_ratelimit.c \
266	zfs_rlock.c \
267	zfs_sa.c \
268	zil.c \
269	zio.c \
270	zio_checksum.c \
271	zio_compress.c \
272	zio_inject.c \
273	zle.c \
274	zrlock.c \
275	zthr.c \
276	zvol.c
277
278SRCS+=	zfs_zstd.c \
279	zstd.c
280
281.include <bsd.kmod.mk>
282
283
284CFLAGS.gcc+= -Wno-pointer-to-int-cast
285
286CFLAGS.lapi.c= -Wno-cast-qual
287CFLAGS.lcompat.c= -Wno-cast-qual
288CFLAGS.lobject.c= -Wno-cast-qual
289CFLAGS.ltable.c= -Wno-cast-qual
290CFLAGS.lvm.c= -Wno-cast-qual
291CFLAGS.nvpair.c= -Wno-cast-qual -DHAVE_RPC_TYPES
292CFLAGS.spl_string.c= -Wno-cast-qual
293CFLAGS.spl_vm.c= -Wno-cast-qual
294CFLAGS.spl_zlib.c= -Wno-cast-qual
295CFLAGS.abd.c= -Wno-cast-qual
296CFLAGS.zfs_log.c= -Wno-cast-qual
297CFLAGS.zfs_vnops.c= -Wno-pointer-arith
298CFLAGS.u8_textprep.c= -Wno-cast-qual
299CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith
300CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith
301CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith
302CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith
303CFLAGS.zprop_common.c= -Wno-cast-qual
304CFLAGS.ddt.c= -Wno-cast-qual
305CFLAGS.dmu.c= -Wno-cast-qual
306CFLAGS.dmu_traverse.c= -Wno-cast-qual
307CFLAGS.dsl_dir.c= -Wno-cast-qual
308CFLAGS.dsl_deadlist.c= -Wno-cast-qual
309CFLAGS.dsl_prop.c= -Wno-cast-qual
310CFLAGS.fm.c= -Wno-cast-qual
311CFLAGS.lz4.c= -Wno-cast-qual
312CFLAGS.spa.c= -Wno-cast-qual
313CFLAGS.spa_misc.c= -Wno-cast-qual
314CFLAGS.sysctl_os.c= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
315CFLAGS.vdev_raidz.c= -Wno-cast-qual
316CFLAGS.vdev_raidz_math.c= -Wno-cast-qual
317CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual
318CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
319CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
320CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
321CFLAGS.zap_leaf.c= -Wno-cast-qual
322CFLAGS.zap_micro.c= -Wno-cast-qual
323CFLAGS.zcp.c= -Wno-cast-qual
324CFLAGS.zfs_fm.c= -Wno-cast-qual
325CFLAGS.zfs_ioctl.c= -Wno-cast-qual
326CFLAGS.zil.c= -Wno-cast-qual
327CFLAGS.zio.c= -Wno-cast-qual
328CFLAGS.zrlock.c= -Wno-cast-qual
329CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
330CFLAGS.zstd.c= -U__BMI__ -fno-tree-vectorize
331.if ${MACHINE_CPUARCH} == "aarch64"
332CFLAGS.zstd.c+= -include ${SRCDIR}/zstd/include/aarch64_compat.h
333.endif
334