xref: /freebsd/sys/modules/zfs/Makefile (revision 1603881667360c015f6685131f2f25474fa67a72)
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+= -I${.CURDIR}
26
27CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS \
28	-DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \
29	-D_SYS_VMEM_H_ -DIN_FREEBSD_BASE -DHAVE_KSID
30
31.if ${MACHINE_ARCH} == "amd64"
32CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F -DHAVE_AVX512BW -DHAVE_SSSE3
33.endif
34
35.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
36	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
37CFLAGS+= -DBITS_PER_LONG=32
38.else
39CFLAGS+= -DBITS_PER_LONG=64
40.endif
41
42SRCS=	vnode_if.h device_if.h bus_if.h
43
44# avl
45SRCS+=	avl.c
46
47#lua
48SRCS+=	lapi.c \
49	lauxlib.c \
50	lbaselib.c \
51	lcode.c \
52	lcompat.c \
53	lcorolib.c \
54	lctype.c \
55	ldebug.c \
56	ldo.c \
57	lfunc.c \
58	lgc.c \
59	llex.c \
60	lmem.c \
61	lobject.c \
62	lopcodes.c \
63	lparser.c \
64	lstate.c \
65	lstring.c \
66	lstrlib.c \
67	ltable.c \
68	ltablib.c \
69	ltm.c \
70	lvm.c \
71	lzio.c
72
73#nvpair
74SRCS+=	nvpair.c \
75	fnvpair.c \
76	nvpair_alloc_spl.c \
77	nvpair_alloc_fixed.c
78
79#os/freebsd/spl
80SRCS+=	acl_common.c \
81	btree.c \
82	callb.c \
83	list.c \
84	spl_acl.c \
85	spl_cmn_err.c \
86	spl_dtrace.c \
87	spl_kmem.c \
88	spl_kstat.c \
89	spl_misc.c \
90	spl_policy.c \
91	spl_string.c \
92	spl_sunddi.c \
93	spl_sysevent.c \
94	spl_taskq.c \
95	spl_uio.c \
96	spl_vfs.c \
97	spl_vm.c \
98	spl_zone.c \
99	sha256c.c \
100	sha512c.c \
101	spl_procfs_list.c \
102	spl_zlib.c
103
104
105.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
106	${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm"
107SRCS+= spl_atomic.c
108.endif
109
110#os/freebsd/zfs
111SRCS+=	abd_os.c \
112	crypto_os.c \
113	dmu_os.c \
114	hkdf.c \
115	kmod_core.c \
116	spa_os.c \
117	sysctl_os.c \
118	vdev_file.c \
119	vdev_label_os.c \
120	vdev_geom.c \
121	zfs_acl.c \
122	zfs_ctldir.c \
123	zfs_dir.c \
124	zfs_ioctl_compat.c \
125	zfs_ioctl_os.c \
126	zfs_log.c \
127	zfs_racct.c \
128	zfs_replay.c \
129	zfs_vfsops.c \
130	zfs_vnops_os.c \
131	zfs_znode.c \
132	zio_crypt.c \
133	zvol_os.c
134
135#unicode
136SRCS+=	uconv.c \
137	u8_textprep.c
138
139#zcommon
140SRCS+=	zfeature_common.c \
141	zfs_comutil.c \
142	zfs_deleg.c \
143	zfs_fletcher.c \
144	zfs_fletcher_avx512.c \
145	zfs_fletcher_intel.c \
146	zfs_fletcher_sse.c \
147	zfs_fletcher_superscalar.c \
148	zfs_fletcher_superscalar4.c \
149	zfs_namecheck.c \
150	zfs_prop.c \
151	zpool_prop.c \
152	zprop_common.c
153
154#zfs
155SRCS+=	abd.c \
156	aggsum.c \
157	arc.c \
158	arc_os.c \
159	blkptr.c \
160	bplist.c \
161	bpobj.c \
162	cityhash.c \
163	dbuf.c \
164	dbuf_stats.c \
165	bptree.c \
166	bqueue.c \
167	dataset_kstats.c \
168	ddt.c \
169	ddt_zap.c \
170	dmu.c \
171	dmu_diff.c \
172	dmu_object.c \
173	dmu_objset.c \
174	dmu_recv.c \
175	dmu_redact.c \
176	dmu_send.c \
177	dmu_traverse.c \
178	dmu_tx.c \
179	dmu_zfetch.c \
180	dnode.c \
181	dnode_sync.c \
182	dsl_dataset.c \
183	dsl_deadlist.c \
184	dsl_deleg.c \
185	dsl_bookmark.c \
186	dsl_dir.c \
187	dsl_crypt.c \
188	dsl_destroy.c \
189	dsl_pool.c \
190	dsl_prop.c \
191	dsl_scan.c \
192	dsl_synctask.c \
193	dsl_userhold.c \
194	fm.c \
195	gzip.c \
196	lzjb.c \
197	lz4.c \
198	metaslab.c \
199	mmp.c \
200	multilist.c \
201	objlist.c \
202	pathname.c \
203	range_tree.c \
204	refcount.c \
205	rrwlock.c \
206	sa.c \
207	sha256.c \
208	skein_zfs.c \
209	spa.c \
210	spa_boot.c \
211	spa_checkpoint.c \
212	spa_config.c \
213	spa_errlog.c \
214	spa_history.c \
215	spa_log_spacemap.c \
216	spa_misc.c \
217	spa_stats.c \
218	space_map.c \
219	space_reftree.c \
220	txg.c \
221	uberblock.c \
222	unique.c \
223	vdev.c \
224	vdev_cache.c \
225	vdev_draid.c \
226	vdev_draid_rand.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	zfs_vnops.c \
269	zil.c \
270	zio.c \
271	zio_checksum.c \
272	zio_compress.c \
273	zio_inject.c \
274	zle.c \
275	zrlock.c \
276	zthr.c \
277	zvol.c
278
279SRCS+=	zfs_zstd.c \
280	zstd.c
281
282.include <bsd.kmod.mk>
283
284CFLAGS+= -include ${SRCTOP}/sys/cddl/compat/opensolaris/sys/debug_compat.h
285CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h
286CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.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