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