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