xref: /freebsd/sys/contrib/openzfs/module/Makefile.bsd (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1.if !defined(WITH_CTF)
2WITH_CTF=1
3.endif
4
5.include <bsd.sys.mk>
6
7SRCDIR=${.CURDIR}
8INCDIR=${.CURDIR:H}/include
9
10KMOD=	openzfs
11
12.PATH:	${SRCDIR}/avl \
13	${SRCDIR}/lua \
14	${SRCDIR}/nvpair \
15	${SRCDIR}/os/freebsd/spl \
16	${SRCDIR}/os/freebsd/zfs \
17	${SRCDIR}/unicode \
18	${SRCDIR}/zcommon \
19	${SRCDIR}/zfs \
20	${SRCDIR}/zstd \
21	${SRCDIR}/zstd/lib
22
23
24
25CFLAGS+= -I${.OBJDIR:H}/include
26CFLAGS+= -I${INCDIR}
27CFLAGS+= -I${INCDIR}/os/freebsd
28CFLAGS+= -I${INCDIR}/os/freebsd/spl
29CFLAGS+= -I${INCDIR}/os/freebsd/zfs
30CFLAGS+= -I${SRCDIR}/zstd/include
31CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h
32
33CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS  -D__BSD_VISIBLE=1 \
34	 -DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \
35	 -D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DSMP -DHAVE_KSID -DCOMPAT_FREEBSD11
36
37.if ${MACHINE_ARCH} == "amd64"
38CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F -DHAVE_SSSE3
39.endif
40
41.if defined(WITH_DEBUG) && ${WITH_DEBUG} == "true"
42CFLAGS+= -DZFS_DEBUG -g
43.if defined(WITH_INVARIANTS) && ${WITH_INVARIANTS} == "true"
44 CFLAGS+= -DINVARIANTS -DWITNESS -DOPENSOLARIS_WITNESS
45.endif
46.if defined(WITH_O0) && ${WITH_O0} == "true"
47 CFLAGS+= -O0
48.endif
49.else
50CFLAGS += -DNDEBUG
51.endif
52
53.if defined(WITH_VFS_DEBUG) && ${WITH_VFS_DEBUG} == "true"
54# kernel must also be built with this option for this to work
55CFLAGS+= -DDEBUG_VFS_LOCKS
56.endif
57
58.if defined(WITH_GCOV) && ${WITH_GCOV} == "true"
59CFLAGS+=	 -fprofile-arcs -ftest-coverage
60.endif
61
62DEBUG_FLAGS=-g
63
64.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
65	${MACHINE_ARCH} == "arm"
66CFLAGS+= -DBITS_PER_LONG=32
67.else
68CFLAGS+= -DBITS_PER_LONG=64
69.endif
70
71SRCS=	vnode_if.h device_if.h bus_if.h
72
73# avl
74SRCS+=	avl.c
75
76#lua
77SRCS+=	lapi.c \
78	lauxlib.c \
79	lbaselib.c \
80	lcode.c \
81	lcompat.c \
82	lcorolib.c \
83	lctype.c \
84	ldebug.c \
85	ldo.c \
86	lfunc.c \
87	lgc.c \
88	llex.c \
89	lmem.c \
90	lobject.c \
91	lopcodes.c \
92	lparser.c \
93	lstate.c \
94	lstring.c \
95	lstrlib.c \
96	ltable.c \
97	ltablib.c \
98	ltm.c \
99	lvm.c \
100	lzio.c
101
102#nvpair
103SRCS+=	nvpair.c \
104	fnvpair.c \
105	nvpair_alloc_spl.c \
106	nvpair_alloc_fixed.c
107
108#os/freebsd/spl
109SRCS+=	acl_common.c \
110	callb.c \
111	list.c \
112	sha256c.c \
113	sha512c.c \
114	spl_acl.c \
115	spl_cmn_err.c \
116	spl_dtrace.c \
117	spl_kmem.c \
118	spl_kstat.c \
119	spl_misc.c \
120	spl_policy.c \
121	spl_procfs_list.c \
122	spl_string.c \
123	spl_sunddi.c \
124	spl_sysevent.c \
125	spl_taskq.c \
126	spl_uio.c \
127	spl_vfs.c \
128	spl_vm.c \
129	spl_zlib.c \
130	spl_zone.c
131
132
133.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
134	${MACHINE_ARCH} == "arm"
135SRCS+= spl_atomic.c
136.endif
137
138#os/freebsd/zfs
139SRCS+=	abd_os.c \
140	arc_os.c \
141	crypto_os.c \
142	dmu_os.c \
143	hkdf.c \
144	kmod_core.c \
145	spa_os.c \
146	sysctl_os.c \
147	vdev_file.c \
148	vdev_geom.c \
149	vdev_label_os.c \
150	zfs_acl.c \
151	zfs_ctldir.c \
152	zfs_debug.c \
153	zfs_dir.c \
154	zfs_ioctl_compat.c \
155	zfs_ioctl_os.c \
156	zfs_racct.c \
157	zfs_vfsops.c \
158	zfs_vnops_os.c \
159	zfs_znode.c \
160	zio_crypt.c \
161	zvol_os.c
162
163#unicode
164SRCS+=	uconv.c \
165	u8_textprep.c
166
167#zcommon
168SRCS+=	zfeature_common.c \
169	zfs_comutil.c \
170	zfs_deleg.c \
171	zfs_fletcher.c \
172	zfs_fletcher_avx512.c \
173	zfs_fletcher_intel.c \
174	zfs_fletcher_sse.c \
175	zfs_fletcher_superscalar.c \
176	zfs_fletcher_superscalar4.c \
177	zfs_namecheck.c \
178	zfs_prop.c \
179	zpool_prop.c \
180	zprop_common.c
181
182#zfs
183SRCS+=	abd.c \
184	aggsum.c \
185	arc.c \
186	blkptr.c \
187	bplist.c \
188	bpobj.c \
189	btree.c \
190	cityhash.c \
191	dbuf.c \
192	dbuf_stats.c \
193	bptree.c \
194	bqueue.c \
195	dataset_kstats.c \
196	ddt.c \
197	ddt_zap.c \
198	dmu.c \
199	dmu_diff.c \
200	dmu_object.c \
201	dmu_objset.c \
202	dmu_recv.c \
203	dmu_redact.c \
204	dmu_send.c \
205	dmu_traverse.c \
206	dmu_tx.c \
207	dmu_zfetch.c \
208	dnode.c \
209	dnode_sync.c \
210	dsl_dataset.c \
211	dsl_deadlist.c \
212	dsl_deleg.c \
213	dsl_bookmark.c \
214	dsl_dir.c \
215	dsl_crypt.c \
216	dsl_destroy.c \
217	dsl_pool.c \
218	dsl_prop.c \
219	dsl_scan.c \
220	dsl_synctask.c \
221	dsl_userhold.c \
222	fm.c \
223	gzip.c \
224	lzjb.c \
225	lz4.c \
226	metaslab.c \
227	mmp.c \
228	multilist.c \
229	objlist.c \
230	pathname.c \
231	range_tree.c \
232	refcount.c \
233	rrwlock.c \
234	sa.c \
235	sha256.c \
236	skein_zfs.c \
237	spa.c \
238	spa_boot.c \
239	spa_checkpoint.c \
240	spa_config.c \
241	spa_errlog.c \
242	spa_history.c \
243	spa_log_spacemap.c \
244	spa_misc.c \
245	spa_stats.c \
246	space_map.c \
247	space_reftree.c \
248	txg.c \
249	uberblock.c \
250	unique.c \
251	vdev.c \
252	vdev_cache.c \
253	vdev_draid.c \
254	vdev_draid_rand.c \
255	vdev_indirect.c \
256	vdev_indirect_births.c \
257	vdev_indirect_mapping.c \
258	vdev_initialize.c \
259	vdev_label.c \
260	vdev_mirror.c \
261	vdev_missing.c \
262	vdev_queue.c \
263	vdev_raidz.c \
264	vdev_raidz_math.c \
265	vdev_raidz_math_scalar.c \
266	vdev_rebuild.c \
267	vdev_raidz_math_avx2.c \
268	vdev_raidz_math_avx512bw.c \
269	vdev_raidz_math_avx512f.c \
270	vdev_raidz_math_sse2.c \
271	vdev_raidz_math_ssse3.c \
272	vdev_removal.c \
273	vdev_root.c \
274	vdev_trim.c \
275	zap.c \
276	zap_leaf.c \
277	zap_micro.c \
278	zcp.c \
279	zcp_get.c \
280	zcp_global.c \
281	zcp_iter.c \
282	zcp_set.c \
283	zcp_synctask.c \
284	zfeature.c \
285	zfs_byteswap.c \
286	zfs_file_os.c \
287	zfs_fm.c \
288	zfs_fuid.c \
289	zfs_ioctl.c \
290	zfs_log.c \
291	zfs_onexit.c \
292	zfs_quota.c \
293	zfs_ratelimit.c \
294	zfs_replay.c \
295	zfs_rlock.c \
296	zfs_sa.c \
297	zfs_vnops.c \
298	zil.c \
299	zio.c \
300	zio_checksum.c \
301	zio_compress.c \
302	zio_inject.c \
303	zle.c \
304	zrlock.c \
305	zthr.c \
306	zvol.c
307
308#zstd
309SRCS+=	zfs_zstd.c \
310	zstd.c
311
312beforeinstall:
313.if ${MK_DEBUG_FILES} != "no"
314	mtree -eu \
315	    -f /etc/mtree/BSD.debug.dist \
316	    -p ${DESTDIR}/usr/lib
317.endif
318
319.include <bsd.kmod.mk>
320
321
322CFLAGS.gcc+= -Wno-pointer-to-int-cast
323
324CFLAGS.lapi.c= -Wno-cast-qual
325CFLAGS.lcompat.c= -Wno-cast-qual
326CFLAGS.lobject.c= -Wno-cast-qual
327CFLAGS.ltable.c= -Wno-cast-qual
328CFLAGS.lvm.c= -Wno-cast-qual
329CFLAGS.nvpair.c= -DHAVE_RPC_TYPES -Wno-cast-qual
330CFLAGS.spl_string.c= -Wno-cast-qual
331CFLAGS.spl_vm.c= -Wno-cast-qual
332CFLAGS.spl_zlib.c= -Wno-cast-qual
333CFLAGS.abd.c= -Wno-cast-qual
334CFLAGS.zfs_log.c= -Wno-cast-qual
335CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith
336CFLAGS.u8_textprep.c= -Wno-cast-qual
337CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith
338CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith
339CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith
340CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith
341CFLAGS.zprop_common.c= -Wno-cast-qual
342CFLAGS.ddt.c= -Wno-cast-qual
343CFLAGS.dmu.c= -Wno-cast-qual
344CFLAGS.dmu_traverse.c= -Wno-cast-qual
345CFLAGS.dsl_dir.c= -Wno-cast-qual
346CFLAGS.dsl_deadlist.c= -Wno-cast-qual
347CFLAGS.dsl_prop.c= -Wno-cast-qual
348CFLAGS.fm.c= -Wno-cast-qual
349CFLAGS.lz4.c= -Wno-cast-qual
350CFLAGS.spa.c= -Wno-cast-qual
351CFLAGS.spa_misc.c= -Wno-cast-qual
352CFLAGS.sysctl_os.c= -include ../zfs_config.h
353CFLAGS.vdev_draid.c= -Wno-cast-qual
354CFLAGS.vdev_raidz.c= -Wno-cast-qual
355CFLAGS.vdev_raidz_math.c= -Wno-cast-qual
356CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual
357CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
358CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
359CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
360CFLAGS.zap_leaf.c= -Wno-cast-qual
361CFLAGS.zap_micro.c= -Wno-cast-qual
362CFLAGS.zcp.c= -Wno-cast-qual
363CFLAGS.zfs_fm.c= -Wno-cast-qual
364CFLAGS.zfs_ioctl.c= -Wno-cast-qual
365CFLAGS.zil.c= -Wno-cast-qual
366CFLAGS.zio.c= -Wno-cast-qual
367CFLAGS.zrlock.c= -Wno-cast-qual
368CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
369CFLAGS.zstd.c= -fno-tree-vectorize -U__BMI__
370