xref: /freebsd/sys/conf/kmod.mk (revision d9a42747950146bf03cda7f6e25d219253f8a57a)
1#	From: @(#)bsd.prog.mk	5.26 (Berkeley) 6/25/91
2# $FreeBSD$
3#
4# The include file <bsd.kmod.mk> handles building and installing loadable
5# kernel modules.
6#
7#
8# +++ variables +++
9#
10# CLEANFILES	Additional files to remove for the clean and cleandir targets.
11#
12# EXPORT_SYMS	A list of symbols that should be exported from the module,
13#		or the name of a file containing a list of symbols, or YES
14#		to export all symbols.  If not defined, no symbols are
15#		exported.
16#
17# KMOD		The name of the kernel module to build.
18#
19# KMODDIR	Base path for kernel modules (see kld(4)). [/boot/kernel]
20#
21# KMODOWN	Module file owner. [${BINOWN}]
22#
23# KMODGRP	Module file group. [${BINGRP}]
24#
25# KMODMODE	Module file mode. [${BINMODE}]
26#
27# KMODLOAD	Command to load a kernel module [/sbin/kldload]
28#
29# KMODUNLOAD	Command to unload a kernel module [/sbin/kldunload]
30#
31# KMODISLOADED	Command to check whether a kernel module is
32#		loaded [/sbin/kldstat -q -n]
33#
34# PROG		The name of the kernel module to build.
35#		If not supplied, ${KMOD}.ko is used.
36#
37# SRCS		List of source files.
38#
39# FIRMWS	List of firmware images in format filename:shortname:version
40#
41# FIRMWARE_LICENSE
42#		Set to the name of the license the user has to agree on in
43#		order to use this firmware. See /usr/share/doc/legal
44#
45# DESTDIR	The tree where the module gets installed. [not set]
46#
47# KERNBUILDDIR	Set to the location of the kernel build directory where
48#		the opt_*.h files, .o's and kernel winds up.
49#
50# BLOB_OBJS	Prebuilt binary blobs .o's from the src tree to be linked into
51#		the module. These are precious and not removed in make clean.
52#
53# +++ targets +++
54#
55# 	install:
56#               install the kernel module; if the Makefile
57#               does not itself define the target install, the targets
58#               beforeinstall and afterinstall may also be used to cause
59#               actions immediately before and after the install target
60#		is executed.
61#
62# 	load:
63#		Load a module.
64#
65# 	unload:
66#		Unload a module.
67#
68#	reload:
69#		Unload if loaded, then load.
70#
71
72AWK?=		awk
73KMODLOAD?=	/sbin/kldload
74KMODUNLOAD?=	/sbin/kldunload
75KMODISLOADED?=	/sbin/kldstat -q -n
76OBJCOPY?=	objcopy
77
78.include "kmod.opts.mk"
79.include <bsd.sysdir.mk>
80
81.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S .m
82
83# amd64 uses direct linking for kmod, all others use shared binaries
84.if ${MACHINE_CPUARCH} != amd64
85__KLD_SHARED=yes
86.else
87__KLD_SHARED=no
88.endif
89
90.if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
91CFLAGS+=	-fno-strict-aliasing
92.endif
93WERROR?=	-Werror
94
95LINUXKPI_GENSRCS+= \
96	backlight_if.h \
97	bus_if.h \
98	device_if.h \
99	iicbus_if.h \
100	iicbb_if.h \
101	lkpi_iic_if.c \
102	lkpi_iic_if.h \
103	pci_if.h \
104	pci_iov_if.h \
105	pcib_if.h \
106	vnode_if.h \
107	usb_if.h \
108	opt_usb.h \
109	opt_stack.h
110
111LINUXKPI_INCLUDES+= \
112	-I${SYSDIR}/compat/linuxkpi/common/include \
113	-I${SYSDIR}/compat/linuxkpi/dummy/include
114
115CFLAGS+=	${WERROR}
116CFLAGS+=	-D_KERNEL
117CFLAGS+=	-DKLD_MODULE
118.if defined(MODULE_TIED)
119CFLAGS+=	-DKLD_TIED
120.endif
121
122# Don't use any standard or source-relative include directories.
123NOSTDINC=	-nostdinc
124CFLAGS:=	${CFLAGS:N-I*} ${NOSTDINC} ${INCLMAGIC} ${CFLAGS:M-I*}
125.if defined(KERNBUILDDIR)
126CFLAGS+=	-DHAVE_KERNEL_OPTION_HEADERS -include ${KERNBUILDDIR}/opt_global.h
127.else
128SRCS+=		opt_global.h
129CFLAGS+=	-include ${.OBJDIR}/opt_global.h
130.endif
131
132# Add -I paths for system headers.  Individual module makefiles don't
133# need any -I paths for this.  Similar defaults for .PATH can't be
134# set because there are no standard paths for non-headers.
135CFLAGS+=	-I. -I${SYSDIR} -I${SYSDIR}/contrib/ck/include
136
137CFLAGS.gcc+=	-finline-limit=${INLINE_LIMIT}
138CFLAGS.gcc+=	-fms-extensions
139CFLAGS.gcc+= --param inline-unit-growth=100
140CFLAGS.gcc+= --param large-function-growth=1000
141
142# Disallow common variables, and if we end up with commons from
143# somewhere unexpected, allocate storage for them in the module itself.
144#
145# -fno-common is the default for src builds, but this should be left in place
146# until at least we catch up to GCC10/LLVM11 or otherwise enable -fno-common
147# in <bsd.sys.mk> instead.  For now, we will have duplicate -fno-common in
148# CFLAGS for in-tree module builds as they will also pick it up from
149# share/mk/src.sys.mk, but the following is important for out-of-tree modules
150# (e.g. ports).
151CFLAGS+=	-fno-common
152.if ${LINKER_TYPE} != "lld" || ${LINKER_VERSION} < 140000
153# lld >= 14 warns that -d is deprecated, and will be removed.
154LDFLAGS+=	-d
155.endif
156LDFLAGS+=	-warn-common
157
158.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mbuild-id}
159LDFLAGS+=	--build-id=sha1
160.endif
161
162CFLAGS+=	${DEBUG_FLAGS}
163.if ${MACHINE_CPUARCH} == aarch64 || ${MACHINE_CPUARCH} == amd64 || \
164    ${MACHINE_CPUARCH} == riscv
165CFLAGS+=	-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
166.endif
167
168.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" || \
169    ${MACHINE_CPUARCH} == "powerpc"
170CFLAGS+=	-fPIC
171.endif
172
173# Temporary workaround for PR 196407, which contains the fascinating details.
174# Don't allow clang to use fpu instructions or registers in kernel modules.
175.if ${MACHINE_CPUARCH} == arm
176CFLAGS.clang+=	-mno-movt
177CFLAGS.clang+=	-mfpu=none
178CFLAGS+=	-funwind-tables
179.endif
180
181.if ${MACHINE_CPUARCH} == powerpc
182CFLAGS+=	-mlongcall -fno-omit-frame-pointer
183.if ${LINKER_TYPE} == "lld"
184# TOC optimization in LLD (9.0) currently breaks kernel modules, so disable it
185LDFLAGS+=	--no-toc-optimize
186.endif
187.endif
188
189.if defined(DEBUG) || defined(DEBUG_FLAGS)
190CTFFLAGS+=	-g
191.endif
192
193.if defined(FIRMWS)
194${KMOD:S/$/.c/}: ${SYSDIR}/tools/fw_stub.awk
195	${AWK} -f ${SYSDIR}/tools/fw_stub.awk ${FIRMWS} -m${KMOD} -c${KMOD:S/$/.c/g} \
196	    ${FIRMWARE_LICENSE:C/.+/-l/}${FIRMWARE_LICENSE}
197
198SRCS+=	${KMOD:S/$/.c/}
199CLEANFILES+=	${KMOD:S/$/.c/}
200
201.for _firmw in ${FIRMWS}
202${_firmw:C/\:.*$/.fwo/:T}:	${_firmw:C/\:.*$//} ${SYSDIR}/kern/firmw.S
203	@${ECHO} ${_firmw:C/\:.*$//} ${.ALLSRC:M*${_firmw:C/\:.*$//}}
204	${CC:N${CCACHE_BIN}} -c -x assembler-with-cpp -DLOCORE 	\
205	    ${CFLAGS} ${WERROR} 				\
206	    -DFIRMW_FILE="${.ALLSRC:M*${_firmw:C/\:.*$//}}" 	\
207	    -DFIRMW_SYMBOL="${_firmw:C/\:.*$//:C/[-.\/@]/_/g}"	\
208	    ${SYSDIR}/kern/firmw.S -o ${.TARGET}
209
210OBJS+=	${_firmw:C/\:.*$/.fwo/:T}
211.endfor
212.endif
213
214# Conditionally include SRCS based on kernel config options.
215.for _o in ${KERN_OPTS}
216SRCS+=${SRCS.${_o}}
217.endfor
218
219OBJS+=	${SRCS:N*.h:R:S/$/.o/g}
220
221.if !defined(PROG)
222PROG=	${KMOD}.ko
223.endif
224
225.if !defined(DEBUG_FLAGS) || ${MK_SPLIT_KERNEL_DEBUG} == "no"
226FULLPROG=	${PROG}
227.else
228FULLPROG=	${PROG}.full
229${PROG}: ${FULLPROG} ${PROG}.debug
230	${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROG}.debug \
231	    ${FULLPROG} ${.TARGET}
232${PROG}.debug: ${FULLPROG}
233	${OBJCOPY} --only-keep-debug ${FULLPROG} ${.TARGET}
234.endif
235
236.if ${__KLD_SHARED} == yes
237${FULLPROG}: ${KMOD}.kld
238	${LD} -m ${LD_EMULATION} -Bshareable -znotext -znorelro ${_LDFLAGS} \
239	    -o ${.TARGET} ${KMOD}.kld
240.if !defined(DEBUG_FLAGS)
241	${OBJCOPY} --strip-debug ${.TARGET}
242.endif
243.endif
244
245EXPORT_SYMS?=	NO
246.if ${EXPORT_SYMS} != YES
247CLEANFILES+=	export_syms
248.endif
249
250.if exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE})
251LDSCRIPT_FLAGS?= -T ${SYSDIR}/conf/ldscript.kmod.${MACHINE}
252.endif
253
254.if ${__KLD_SHARED} == yes
255${KMOD}.kld: ${OBJS} ${BLOB_OBJS}
256.else
257${FULLPROG}: ${OBJS} ${BLOB_OBJS}
258.endif
259	${LD} -m ${LD_EMULATION} ${_LDFLAGS} ${LDSCRIPT_FLAGS} -r \
260	    -o ${.TARGET} ${OBJS} ${BLOB_OBJS}
261.if ${MK_CTF} != "no"
262	${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} ${BLOB_OBJS}
263.endif
264.if defined(EXPORT_SYMS)
265.if ${EXPORT_SYMS} != YES
266.if ${EXPORT_SYMS} == NO
267	:> export_syms
268.elif !exists(${.CURDIR}/${EXPORT_SYMS})
269	echo -n "${EXPORT_SYMS:@s@$s${.newline}@}" > export_syms
270.else
271	grep -v '^#' < ${EXPORT_SYMS} > export_syms
272.endif
273	${AWK} -f ${SYSDIR}/conf/kmod_syms.awk ${.TARGET} \
274	    export_syms | xargs -J% ${OBJCOPY} % ${.TARGET}
275.endif
276.endif # defined(EXPORT_SYMS)
277.if defined(PREFIX_SYMS)
278	${AWK} -v prefix=${PREFIX_SYMS} -f ${SYSDIR}/conf/kmod_syms_prefix.awk \
279	    ${.TARGET} /dev/null | xargs -J% ${OBJCOPY} % ${.TARGET}
280.endif
281.if !defined(DEBUG_FLAGS) && ${__KLD_SHARED} == no
282	${OBJCOPY} --strip-debug ${.TARGET}
283.endif
284
285_ILINKS=machine
286.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
287_ILINKS+=x86
288.endif
289.if ${MACHINE_CPUARCH} == "amd64"
290_ILINKS+=i386
291.endif
292CLEANFILES+=${_ILINKS}
293
294all: ${PROG}
295
296beforedepend: ${_ILINKS}
297beforebuild: ${_ILINKS}
298
299# Ensure that the links exist without depending on it when it exists which
300# causes all the modules to be rebuilt when the directory pointed to changes.
301# Ensure that debug info references the path in the source tree.
302.for _link in ${_ILINKS}
303.if !exists(${.OBJDIR}/${_link})
304OBJS_DEPEND_GUESS+=	${_link}
305.endif
306.if ${_link} == "machine"
307CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include
308.else
309CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include
310.endif
311.endfor
312
313.NOPATH: ${_ILINKS}
314
315${_ILINKS}:
316	@case ${.TARGET} in \
317	machine) \
318		path=${SYSDIR}/${MACHINE}/include ;; \
319	*) \
320		path=${SYSDIR}/${.TARGET:T}/include ;; \
321	esac ; \
322	path=`realpath $$path`; \
323	${ECHO} ${.TARGET:T} "->" $$path ; \
324	ln -fns $$path ${.TARGET:T}
325
326CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS}
327
328.if defined(DEBUG_FLAGS) && ${MK_SPLIT_KERNEL_DEBUG} != "no"
329CLEANFILES+= ${FULLPROG} ${PROG}.debug
330.endif
331
332.if !target(install)
333
334_INSTALLFLAGS:=	${INSTALLFLAGS}
335.for ie in ${INSTALLFLAGS_EDIT}
336_INSTALLFLAGS:=	${_INSTALLFLAGS${ie}}
337.endfor
338
339.if !target(realinstall)
340KERN_DEBUGDIR?=	${DEBUGDIR}
341realinstall: _kmodinstall
342.ORDER: beforeinstall _kmodinstall
343_kmodinstall: .PHONY
344	${INSTALL} -T release -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
345	    ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/
346.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && ${MK_KERNEL_SYMBOLS} != "no"
347	${INSTALL} -T dbg -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
348	    ${_INSTALLFLAGS} ${PROG}.debug ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/
349.endif
350
351.include <bsd.links.mk>
352
353.if !defined(NO_XREF)
354afterinstall: _kldxref
355.ORDER: realinstall _kldxref
356.ORDER: _installlinks _kldxref
357_kldxref: .PHONY
358	@if type kldxref >/dev/null 2>&1; then \
359		${ECHO} ${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
360		${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
361	fi
362.endif
363.endif # !target(realinstall)
364
365.endif # !target(install)
366
367.if !target(load)
368load: ${PROG} .PHONY
369	${KMODLOAD} -v ${.OBJDIR}/${PROG}
370.endif
371
372.if !target(unload)
373unload: .PHONY
374	if ${KMODISLOADED} ${PROG} ; then ${KMODUNLOAD} -v ${PROG} ; fi
375.endif
376
377.if !target(reload)
378reload: unload load .PHONY
379.endif
380
381.if defined(KERNBUILDDIR)
382.PATH: ${KERNBUILDDIR}
383CFLAGS+=	-I${KERNBUILDDIR}
384.for _src in ${SRCS:Mopt_*.h}
385CLEANFILES+=	${_src}
386.if !target(${_src})
387${_src}:
388	ln -sf ${KERNBUILDDIR}/${_src} ${.TARGET}
389.endif
390.endfor
391.else
392.for _src in ${SRCS:Mopt_*.h}
393CLEANFILES+=	${_src}
394.if !target(${_src})
395${_src}:
396	:> ${.TARGET}
397.endif
398.endfor
399.endif
400
401# Add the sanitizer C flags
402CFLAGS+=	${SAN_CFLAGS}
403
404# Add the gcov flags
405CFLAGS+=	${GCOV_CFLAGS}
406
407# Respect configuration-specific C flags.
408CFLAGS+=	${ARCH_FLAGS} ${CONF_CFLAGS}
409
410.if !empty(SRCS:Mvnode_if.c)
411CLEANFILES+=	vnode_if.c
412vnode_if.c: ${SYSDIR}/tools/vnode_if.awk ${SYSDIR}/kern/vnode_if.src
413	${AWK} -f ${SYSDIR}/tools/vnode_if.awk ${SYSDIR}/kern/vnode_if.src -c
414.endif
415
416.if !empty(SRCS:Mvnode_if.h)
417CLEANFILES+=	vnode_if.h vnode_if_newproto.h vnode_if_typedef.h
418vnode_if.h vnode_if_newproto.h vnode_if_typedef.h: ${SYSDIR}/tools/vnode_if.awk \
419    ${SYSDIR}/kern/vnode_if.src
420vnode_if.h: vnode_if_newproto.h vnode_if_typedef.h
421	${AWK} -f ${SYSDIR}/tools/vnode_if.awk ${SYSDIR}/kern/vnode_if.src -h
422vnode_if_newproto.h:
423	${AWK} -f ${SYSDIR}/tools/vnode_if.awk ${SYSDIR}/kern/vnode_if.src -p
424vnode_if_typedef.h:
425	${AWK} -f ${SYSDIR}/tools/vnode_if.awk ${SYSDIR}/kern/vnode_if.src -q
426.endif
427
428# Build _if.[ch] from _if.m, and clean them when we're done.
429# __MPATH defined in config.mk
430_MFILES=${__MPATH:T:O}
431_MPATH=${__MPATH:H:O:u}
432.PATH.m: ${_MPATH}
433.for _i in ${SRCS:M*_if.[ch]}
434_MATCH=M${_i:R:S/$/.m/}
435_MATCHES=${_MFILES:${_MATCH}}
436.if !empty(_MATCHES)
437CLEANFILES+=	${_i}
438.endif
439.endfor # _i
440.m.c:	${SYSDIR}/tools/makeobjops.awk
441	${AWK} -f ${SYSDIR}/tools/makeobjops.awk ${.IMPSRC} -c
442
443.m.h:	${SYSDIR}/tools/makeobjops.awk
444	${AWK} -f ${SYSDIR}/tools/makeobjops.awk ${.IMPSRC} -h
445
446.for _i in mii pccard
447.if !empty(SRCS:M${_i}devs.h)
448CLEANFILES+=	${_i}devs.h
449${_i}devs.h: ${SYSDIR}/tools/${_i}devs2h.awk ${SYSDIR}/dev/${_i}/${_i}devs
450	${AWK} -f ${SYSDIR}/tools/${_i}devs2h.awk ${SYSDIR}/dev/${_i}/${_i}devs
451.endif
452.endfor # _i
453
454.if !empty(SRCS:Mbhnd_nvram_map.h)
455CLEANFILES+=	bhnd_nvram_map.h
456bhnd_nvram_map.h: ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.awk \
457    ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
458    ${SYSDIR}/dev/bhnd/nvram/nvram_map
459bhnd_nvram_map.h:
460	sh ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
461	    ${SYSDIR}/dev/bhnd/nvram/nvram_map -h
462.endif
463
464.if !empty(SRCS:Mbhnd_nvram_map_data.h)
465CLEANFILES+=	bhnd_nvram_map_data.h
466bhnd_nvram_map_data.h: ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.awk \
467    ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
468    ${SYSDIR}/dev/bhnd/nvram/nvram_map
469bhnd_nvram_map_data.h:
470	sh ${SYSDIR}/dev/bhnd/tools/nvram_map_gen.sh \
471	    ${SYSDIR}/dev/bhnd/nvram/nvram_map -d
472.endif
473
474.if !empty(SRCS:Musbdevs.h)
475CLEANFILES+=	usbdevs.h
476usbdevs.h: ${SYSDIR}/tools/usbdevs2h.awk ${SYSDIR}/dev/usb/usbdevs
477	${AWK} -f ${SYSDIR}/tools/usbdevs2h.awk ${SYSDIR}/dev/usb/usbdevs -h
478.endif
479
480.if !empty(SRCS:Musbdevs_data.h)
481CLEANFILES+=	usbdevs_data.h
482usbdevs_data.h: ${SYSDIR}/tools/usbdevs2h.awk ${SYSDIR}/dev/usb/usbdevs
483	${AWK} -f ${SYSDIR}/tools/usbdevs2h.awk ${SYSDIR}/dev/usb/usbdevs -d
484.endif
485
486.if !empty(SRCS:Msdiodevs.h)
487CLEANFILES+=	sdiodevs.h
488sdiodevs.h: ${SYSDIR}/tools/sdiodevs2h.awk ${SYSDIR}/dev/sdio/sdiodevs
489	${AWK} -f ${SYSDIR}/tools/sdiodevs2h.awk ${SYSDIR}/dev/sdio/sdiodevs -h
490.endif
491
492.if !empty(SRCS:Msdiodevs_data.h)
493CLEANFILES+=	sdiodevs_data.h
494sdiodevs_data.h: ${SYSDIR}/tools/sdiodevs2h.awk ${SYSDIR}/dev/sdio/sdiodevs
495	${AWK} -f ${SYSDIR}/tools/sdiodevs2h.awk ${SYSDIR}/dev/sdio/sdiodevs -d
496.endif
497
498.if !empty(SRCS:Macpi_quirks.h)
499CLEANFILES+=	acpi_quirks.h
500acpi_quirks.h: ${SYSDIR}/tools/acpi_quirks2h.awk ${SYSDIR}/dev/acpica/acpi_quirks
501	${AWK} -f ${SYSDIR}/tools/acpi_quirks2h.awk ${SYSDIR}/dev/acpica/acpi_quirks
502.endif
503
504.if !empty(SRCS:Massym.inc) || !empty(DPSRCS:Massym.inc)
505CLEANFILES+=	assym.inc genassym.o
506DEPENDOBJS+=	genassym.o
507DPSRCS+=	offset.inc
508.endif
509.if defined(MODULE_TIED)
510DPSRCS+=	offset.inc
511.endif
512.if !empty(SRCS:Moffset.inc) || !empty(DPSRCS:Moffset.inc)
513CLEANFILES+=	offset.inc genoffset.o
514DEPENDOBJS+=	genoffset.o
515.endif
516assym.inc: genassym.o
517offset.inc: genoffset.o
518assym.inc: ${SYSDIR}/kern/genassym.sh
519	sh ${SYSDIR}/kern/genassym.sh genassym.o > ${.TARGET}
520genassym.o: ${SYSDIR}/${MACHINE}/${MACHINE}/genassym.c offset.inc
521genassym.o: ${SRCS:Mopt_*.h}
522	${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon \
523	    ${SYSDIR}/${MACHINE}/${MACHINE}/genassym.c
524offset.inc: ${SYSDIR}/kern/genoffset.sh genoffset.o
525	sh ${SYSDIR}/kern/genoffset.sh genoffset.o > ${.TARGET}
526genoffset.o: ${SYSDIR}/kern/genoffset.c
527genoffset.o: ${SRCS:Mopt_*.h}
528	${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon \
529	    ${SYSDIR}/kern/genoffset.c
530
531CLEANDEPENDFILES+=	${_ILINKS}
532# .depend needs include links so we remove them only together.
533cleanilinks:
534	rm -f ${_ILINKS}
535
536OBJS_DEPEND_GUESS+= ${SRCS:M*.h}
537.if defined(KERNBUILDDIR)
538OBJS_DEPEND_GUESS+= opt_global.h
539.endif
540
541ZINCDIR=${SYSDIR}/contrib/openzfs/include
542OPENZFS_CFLAGS=     \
543	-D_SYS_VMEM_H_  \
544	-D__KERNEL__ \
545	-nostdinc \
546	-DSMP \
547	-I${ZINCDIR}  \
548	-I${ZINCDIR}/os/freebsd \
549	-I${ZINCDIR}/os/freebsd/spl \
550	-I${ZINCDIR}/os/freebsd/zfs \
551	-I${SYSDIR}/cddl/compat/opensolaris \
552	-I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
553	-include ${ZINCDIR}/os/freebsd/spl/sys/ccompile.h
554
555.include <bsd.dep.mk>
556.include <bsd.clang-analyze.mk>
557.include <bsd.obj.mk>
558.include "kern.mk"
559