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