xref: /freebsd/sys/modules/zfs/Makefile (revision e9e8876a4d6afc1ad5315faaa191b25121a813d7)
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	metaslab.c \
204	mmp.c \
205	multilist.c \
206	objlist.c \
207	pathname.c \
208	range_tree.c \
209	refcount.c \
210	rrwlock.c \
211	sa.c \
212	sha256.c \
213	skein_zfs.c \
214	spa.c \
215	spa_boot.c \
216	spa_checkpoint.c \
217	spa_config.c \
218	spa_errlog.c \
219	spa_history.c \
220	spa_log_spacemap.c \
221	spa_misc.c \
222	spa_stats.c \
223	space_map.c \
224	space_reftree.c \
225	txg.c \
226	uberblock.c \
227	unique.c \
228	vdev.c \
229	vdev_cache.c \
230	vdev_draid.c \
231	vdev_draid_rand.c \
232	vdev_indirect.c \
233	vdev_indirect_births.c \
234	vdev_indirect_mapping.c \
235	vdev_initialize.c \
236	vdev_label.c \
237	vdev_mirror.c \
238	vdev_missing.c \
239	vdev_queue.c \
240	vdev_raidz.c \
241	vdev_raidz_math.c \
242	vdev_raidz_math_scalar.c \
243	vdev_raidz_math_avx2.c \
244	vdev_raidz_math_avx512bw.c \
245	vdev_raidz_math_avx512f.c \
246	vdev_raidz_math_sse2.c \
247	vdev_raidz_math_ssse3.c \
248	vdev_rebuild.c \
249	vdev_removal.c \
250	vdev_root.c \
251	vdev_trim.c \
252	zap.c \
253	zap_leaf.c \
254	zap_micro.c \
255	zcp.c \
256	zcp_get.c \
257	zcp_global.c \
258	zcp_iter.c \
259	zcp_set.c \
260	zcp_synctask.c \
261	zfeature.c \
262	zfs_byteswap.c \
263	zfs_debug.c \
264	zfs_file_os.c \
265	zfs_fm.c \
266	zfs_fuid.c \
267	zfs_ioctl.c \
268	zfs_onexit.c \
269	zfs_quota.c \
270	zfs_ratelimit.c \
271	zfs_rlock.c \
272	zfs_sa.c \
273	zfs_vnops.c \
274	zil.c \
275	zio.c \
276	zio_checksum.c \
277	zio_compress.c \
278	zio_inject.c \
279	zle.c \
280	zrlock.c \
281	zthr.c \
282	zvol.c
283
284SRCS+=	zfs_zstd.c \
285	zstd.c
286
287.include <bsd.kmod.mk>
288
289CFLAGS+= -include ${SRCTOP}/sys/cddl/compat/opensolaris/sys/debug_compat.h
290CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h
291CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h
292
293CWARNFLAGS+=	${OPENZFS_CWARNFLAGS}
294
295CFLAGS.gcc+= -Wno-pointer-to-int-cast
296
297CFLAGS.lapi.c= -Wno-cast-qual
298CFLAGS.lcompat.c= -Wno-cast-qual
299CFLAGS.lobject.c= -Wno-cast-qual
300CFLAGS.ltable.c= -Wno-cast-qual
301CFLAGS.lvm.c= -Wno-cast-qual
302CFLAGS.nvpair.c= -Wno-cast-qual -DHAVE_RPC_TYPES
303CFLAGS.spl_string.c= -Wno-cast-qual
304CFLAGS.spl_vm.c= -Wno-cast-qual
305CFLAGS.spl_zlib.c= -Wno-cast-qual
306CFLAGS.abd.c= -Wno-cast-qual
307CFLAGS.zfs_log.c= -Wno-cast-qual
308CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith
309CFLAGS.u8_textprep.c= -Wno-cast-qual
310CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith
311CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith
312CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith
313CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith
314CFLAGS.zprop_common.c= -Wno-cast-qual
315CFLAGS.ddt.c= -Wno-cast-qual
316CFLAGS.dmu.c= -Wno-cast-qual
317CFLAGS.dmu_traverse.c= -Wno-cast-qual
318CFLAGS.dsl_dir.c= -Wno-cast-qual
319CFLAGS.dsl_deadlist.c= -Wno-cast-qual
320CFLAGS.dsl_prop.c= -Wno-cast-qual
321CFLAGS.edonr.c= -Wno-cast-qual
322CFLAGS.fm.c= -Wno-cast-qual
323CFLAGS.lz4.c= -Wno-cast-qual
324CFLAGS.spa.c= -Wno-cast-qual
325CFLAGS.spa_misc.c= -Wno-cast-qual
326CFLAGS.sysctl_os.c= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
327CFLAGS.vdev_draid.c= -Wno-cast-qual
328CFLAGS.vdev_raidz.c= -Wno-cast-qual
329CFLAGS.vdev_raidz_math.c= -Wno-cast-qual
330CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual
331CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
332CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
333CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
334CFLAGS.zap_leaf.c= -Wno-cast-qual
335CFLAGS.zap_micro.c= -Wno-cast-qual
336CFLAGS.zcp.c= -Wno-cast-qual
337CFLAGS.zfs_fm.c= -Wno-cast-qual
338CFLAGS.zfs_ioctl.c= -Wno-cast-qual
339CFLAGS.zil.c= -Wno-cast-qual
340CFLAGS.zio.c= -Wno-cast-qual
341CFLAGS.zrlock.c= -Wno-cast-qual
342CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
343CFLAGS.zstd.c= -U__BMI__ -fno-tree-vectorize
344.if ${MACHINE_CPUARCH} == "aarch64"
345CFLAGS.zstd.c+= -include ${SRCDIR}/zstd/include/aarch64_compat.h
346.endif
347