Makefile.kern.inc revision 1.301.2.1 1 # $NetBSD: Makefile.kern.inc,v 1.301.2.1 2024/06/29 19:43:25 perseant Exp $
2 #
3 # This file contains common `MI' targets and definitions and it is included
4 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
5 #
6 # Each target in this file should be protected with `if !target(target)'
7 # or `if !commands(target)' and each variable should only be conditionally
8 # assigned `VAR ?= VALUE', so that everything can be overridden.
9 #
10 # DEBUG is set to -g if debugging.
11 # PROF is set to -pg if profiling.
12 #
13 # To specify debugging, add the config line: makeoptions DEBUG="-g"
14 # A better way is to specify -g only for a few files.
15 #
16 # makeoptions DEBUGLIST="uvm* trap if_*"
17 #
18 # all ports are expected to include bsd.own.mk for toolchain settings
19
20 # Default DEBUG to -g if kernel debug info is requested by MKDEBUGKERNEL=yes
21 .if ${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes"
22 DEBUG?=-g
23 .else
24 DEBUG?=
25 .endif
26
27 ##
28 ## (0) toolchain settings for things that aren't part of the standard
29 ## toolchain
30 ##
31 HOST_SH?= sh
32 DBSYM?= dbsym
33 MKDEP?= mkdep
34 STRIP?= strip
35 OBJCOPY?= objcopy
36 OBJDUMP?= objdump
37 CSCOPE?= cscope
38 MKID?= mkid
39 UUDECODE?= ${TOOL_UUDECODE:Uuudecode}
40 HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump}
41 GENASSYM?= ${TOOL_GENASSYM:Ugenassym}
42 .MAKEOVERRIDES+=USETOOLS # make sure proper value is propagated
43
44 _MKMSG?= @\#
45 _MKSHMSG?= echo
46 _MKSHECHO?= echo
47 _MKSHNOECHO= :
48 _MKMSG_CREATE?= :
49 _MKTARGET_COMPILE?= :
50 _MKTARGET_CREATE?= :
51
52 ##
53 ## (1) port independent source tree identification
54 ##
55 # source tree is located via $S relative to the compilation directory
56 .ifndef S
57 S!= cd ../../../.. && pwd
58 .endif
59
60 ##
61 ## (2) compile settings
62 ##
63 ## CPPFLAGS, CFLAGS, and AFLAGS must be set in the port's Makefile
64 ##
65 INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \
66 -I$S -nostdinc
67 CPPFLAGS+= ${INCLUDES} ${IDENT} -D_KERNEL -D_KERNEL_OPT
68 .if !defined(COVERITY_TOP_CONFIG)
69 CPPFLAGS+= -std=gnu99
70 .endif
71 .if ${KERNEL_DIR:Uno} == "yes"
72 CPPFLAGS+= -DKERNEL_DIR
73 .endif
74 DEFCOPTS?= -O2
75 COPTS?= ${DEFCOPTS}
76 DBG= # might contain unwanted -Ofoo
77 CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith
78 CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes
79 CWARNFLAGS+= -Wold-style-definition
80 CWARNFLAGS+= -Wswitch -Wshadow
81 CWARNFLAGS+= -Wcast-qual -Wwrite-strings
82 CWARNFLAGS+= -Wno-unreachable-code
83 #CWARNFLAGS+= -Wc++-compat -Wno-error=c++-compat
84 CWARNFLAGS+= -Wno-pointer-sign -Wno-attributes
85 CWARNFLAGS+= -Wno-type-limits
86 . if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
87 ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
88 CWARNFLAGS+= -Wextra -Wno-unused-parameter
89 . endif
90 . if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
91 CWARNFLAGS+= -Wold-style-definition
92 . endif
93 # Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3,
94 # but our sources aren't up for it yet.
95 CWARNFLAGS+= -Wno-sign-compare
96
97 CWARNFLAGS.clang+= -Wno-unknown-pragmas -Wno-conversion \
98 -Wno-self-assign \
99 -Wno-error=constant-conversion
100 CWARNFLAGS+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
101
102 CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \
103 -Wno-shift-count-negative -Wno-shift-count-overflow:}
104
105 CWARNFLAGS.ioconf.c= ${${ACTIVE_CC} == "clang":? -Wno-unused-const-variable :}
106
107 CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss
108 CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :}
109 CFLAGS+= ${DEBUG} ${COPTS}
110 AFLAGS+= -D_LOCORE -Wa,--fatal-warnings
111
112 # example usage to find largest stack users in kernel compile directory:
113 # find . -name \*.su | xargs awk '{ printf "%6d %s\n", $2, $1 }' | sort -n
114 .if ${MACHINE} != "vax"
115 # GCC/vax 8.4 does not support -fstack-usage.
116 CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fstack-usage -Wstack-usage=9999 :}
117 .endif
118 CWARNFLAGS+= -Walloca
119
120 # XXX
121 .if defined(HAVE_GCC) || defined(HAVE_LLVM)
122 CFLAGS+= -fno-strict-aliasing
123 CFLAGS+= -fno-common
124 .endif
125
126 # Use the per-source COPTS variables to add -g to just those
127 # files that match the shell patterns given in ${DEBUGLIST}
128 #
129 .for i in ${DEBUGLIST}
130 . for j in ${ALLFILES:M*.c:T:M$i.c}
131 COPTS.${j}+=-g
132 . endfor
133 .endfor
134
135 # Always compile debugsyms.c with debug information.
136 # This allows gdb to use type informations.
137 #
138 COPTS.debugsyms.c+= -g
139
140 # Add CTF sections for DTrace
141 .if defined(CTFCONVERT)
142 COMPILE_CTFCONVERT= ${_MKSHECHO}\
143 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
144 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
145 .else
146 COMPILE_CTFCONVERT= ${_MKSHNOECHO}
147 .endif
148
149 KCOMPILE.c= ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
150 KCOMPILE.s= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@
151 KLINK.o= ${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC}
152
153 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
154 # NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
155 NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
156 ${_MKSHECHO} ${KCOMPILE.c} ${PROF} && \
157 ${KCOMPILE.c} ${PROF} && \
158 ${COMPILE_CTFCONVERT}
159 NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
160 ${_MKSHECHO} ${KCOMPILE.c} && \
161 ${KCOMPILE.c} && \
162 ${COMPILE_CTFCONVERT}
163 NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
164 ${_MKSHECHO} ${KCOMPILE.s} && \
165 ${KCOMPILE.s}
166
167 # link rules:
168 LINK_O?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}" && \
169 ${_MKSHECHO} ${KLINK.o} && \
170 ${KLINK.o}
171
172 ##
173 ## (3) libkern
174 ##
175 ## Set OPT_MODULAR in the port Makefile if module(7) is enabled,
176 ## as documented in $S/lib/libkern/Makefile.inc.
177 ##
178
179 ### find out what to use for libkern
180 .include "$S/lib/libkern/Makefile.inc"
181 .ifndef PROF
182 LIBKERN?= ${KERNLIB}
183 .else
184 LIBKERN?= ${KERNLIB_PROF}
185 .endif
186
187 LIBKERNLN?= ${KERNLIBLN}
188
189 ##
190 ## (4) local objects, compile rules, and dependencies
191 ##
192 ## Each port should have a corresponding section with settings for
193 ## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
194 ##
195
196 .if !defined(___USE_SUFFIX_RULES___)
197 _MD_OBJS= ${MD_OBJS:T}
198 .else
199 _MD_OBJS= ${MD_OBJS}
200 .endif
201
202 ##
203 ## (5) link settings
204 ##
205 ## TEXTADDR (or LOADADDRESS), LINKFORMAT, LINKSCRIPT, and any EXTRA_LINKFLAGS
206 ## must be set in the port's Makefile. The port specific definitions for
207 ## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
208 ## depending on the value of DEBUG.
209 ##
210 # load lines for config "xxx" will be emitted as:
211 # xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel
212
213 SYSTEM_LIB= ${MD_LIBS} ${LIBKERN}
214 SYSTEM_OBJ?= ${_MD_OBJS} ${OBJS} ${SYSTEM_LIB}
215 SYSTEM_DEP+= Makefile ${SYSTEM_OBJ:O}
216 .if defined(CTFMERGE)
217 SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
218 .else
219 SYSTEM_CTFMERGE= ${_MKSHECHO}
220 .endif
221
222 REMOVE_SWAP= [@]
223 .for k in ${KERNELS}
224 REMOVE_SWAP:= ${REMOVE_SWAP}:Nswap${k}.o
225 .endfor
226
227 SYSTEM_LD_HEAD?=@rm -f $@
228 SYSTEM_LD?= ${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \
229 ${_MKSHECHO}\
230 ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
231 '$${SYSTEM_OBJ:${REMOVE_SWAP}}' '$${EXTRA_OBJ}' vers.o \
232 ${OBJS:M*swap${.TARGET}.o}; \
233 ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
234 ${SYSTEM_OBJ:${REMOVE_SWAP}} ${EXTRA_OBJ} vers.o \
235 ${OBJS:M*swap${.TARGET}.o}
236
237 TEXTADDR?= ${LOADADDRESS} # backwards compatibility
238 LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/}
239 LINKDATA?= ${DATAADDR:C/.+/-Tdata &/}
240 ENTRYPOINT?= start
241 LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/}
242 LINKFLAGS?= ${LINKFORMAT} ${LINKSCRIPT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
243 ${EXTRA_LINKFLAGS}
244
245 LINKFLAGS_DEBUG?= -X
246 KERNEL_CONFIG?= ${KERNEL_BUILD:T}
247
248 SYSTEM_LD_TAIL?= @${_MKSHECHO}
249 OBJCOPY_STRIPFLAGS?= -g
250
251 # Strip some architecture-defined symbols from kernel image, while
252 # keeping them in netbsd.gdb.
253 .if defined(ARCH_STRIP_SYMBOLS)
254 .if empty(DEBUG:M-g*)
255 SYSTEM_LD_TAIL+= && ${OBJCOPY} -w ${ARCH_STRIP_SYMBOLS} $@
256 .endif
257 OBJCOPY_STRIPFLAGS+= -w ${ARCH_STRIP_SYMBOLS}
258 .endif
259
260 SYSTEM_LD_TAIL+= && ${TOOL_SED} \
261 '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \
262 ${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@ && \
263 runit() { echo $$@; $$@; }
264
265 SYSTEM_LD_TAIL_DEBUG?=&& \
266 runit mv -f $@ $@.gdb && \
267 runit ${OBJCOPY} --only-keep-debug --compress-debug-sections \
268 $@.gdb $@-${KERNEL_CONFIG}.debug && \
269 runit ${OBJCOPY} ${OBJCOPY_STRIPFLAGS} -p -R .gnu_debuglink \
270 --add-gnu-debuglink=$@-${KERNEL_CONFIG}.debug $@.gdb $@ && \
271 runit chmod 755 $@ $@.gdb $@-${KERNEL_CONFIG}.debug
272
273 LINKFLAGS_NORMAL?= -S
274 STRIPFLAGS?= -g
275
276 .if !empty(DEBUG:M-g*)
277 SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
278 LINKFLAGS+= ${LINKFLAGS_DEBUG}
279 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
280 CTFFLAGS+= -g
281 TARGETSFX= .gdb
282 .elifndef PROF
283 LINKFLAGS+= ${LINKFLAGS_NORMAL}
284 .endif
285
286 .if ${MKDEBUG:Uno} == "yes"
287 # XXX: KERNEL_DIR?
288 debuginstall: install-kernel-debug
289 .for k in ${KERNELS}
290 install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug
291
292 ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug: ${k}-${KERNEL_CONFIG}.debug
293 ${_MKTARGET_INSTALL}
294 ${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET}
295 .endfor
296 .else
297 debuginstall:
298 .endif
299
300 SYSTEM_LD_HEAD+= ${SYSTEM_LD_HEAD_EXTRA}
301 SYSTEM_LD_TAIL_STAGE1= ${SYSTEM_LD_TAIL}
302 SYSTEM_LD_TAIL_STAGE2= ${SYSTEM_LD_TAIL}
303 .if defined(COPY_SYMTAB)
304 SYSTEM_LD_TAIL_STAGE2+= && runit ${DBSYM} $@
305 .if !empty(DEBUG:M-g)
306 SYSTEM_LD_TAIL_STAGE2+= && runit ${DBSYM} $@.gdb
307 .endif
308 .endif
309 SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL_EXTRA}
310
311 ##
312 ## (6) port independent targets and dependencies: assym.h, vers.o
313 ##
314
315 .if !defined(___USE_SUFFIX_RULES___)
316
317 # Generate list of *.o files to pass to ${LD}, preserving order.
318 # x/y/z/a.[csS] -> a.[csS]
319 # a.[csS] -> a.o
320 OBJS= ${ALLFILES:C|^.*/([^/]*\.[csS])$|\1|:C|^(.*)\.[csS]$|\1.o|}
321
322 CFILES= ${ALLFILES:M*.c}
323 SFILES= ${ALLFILES:M*.[sS]}
324 OFILES= ${ALLFILES:M*.o}
325 # absolute, generated (build directory), relative (under $S)
326 _CFILES=${CFILES:M/*} ${CFILES:N/*:N*/*} ${CFILES:N/*:M*/*:C|^|$S/|}
327 _SFILES=${SFILES:M/*} ${SFILES:N/*:N*/*} ${SFILES:N/*:M*/*:C|^|$S/|}
328 _MD_CFILES=${MD_CFILES}
329 _MD_SFILES=${MD_SFILES}
330 CSRCS= ${_MD_CFILES} ${_CFILES}
331 SSRCS= ${_MD_SFILES} ${_SFILES}
332 SRCS= ${CSRCS} ${SSRCS}
333
334 .else # ___USE_SUFFIX_RULES___
335 OBJS= ${ALLFILES:C|\.[csS]$|.o|}
336 SRCS= ${ALLFILES:M*.[csS]}
337 .endif # ___USE_SUFFIX_RULES___
338
339 .if !defined(___USE_SUFFIX_RULES___)
340 .for _s in ${_CFILES}
341 .if !commands(${_s:T:R}.o)
342 ${_s:T:R}.o: ${_s}
343 ${NORMAL_C}
344 .endif
345 .endfor
346
347 .for _s in ${_SFILES}
348 .if !commands(${_s:T:R}.o)
349 ${_s:T:R}.o: ${_s}
350 ${NORMAL_S}
351 .endif
352 .endfor
353 .endif # !___USE_SUFFIX_RULES___
354
355 .include "${S}/conf/ldscript.mk"
356 .include "${S}/conf/assym.mk"
357 .include "${S}/conf/newvers.mk"
358 .include "${S}/dev/splash/splash.mk"
359 .include "${S}/conf/mdroot.mk"
360 .include "${S}/conf/lint.mk"
361 .include "${S}/conf/cscope.mk"
362 .include "${S}/conf/gdbinit.mk"
363 .include "${S}/conf/ssp.mk"
364 .if "${_SKIP_DTS}" != "yes"
365 .include "${S}/conf/dts.mk"
366 .endif
367 .include "${S}/conf/copts.mk"
368
369 ##
370 ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
371 ## cscope, mkid
372 ##
373 ## Any ports that have other stuff to be cleaned up should fill in
374 ## EXTRA_CLEAN. Some ports may want different settings for
375 ## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
376 ##
377
378 ##
379 ## clean
380 ##
381
382 .if !target(__CLEANKERNEL)
383 __CLEANKERNEL: .USE
384 ${_MKMSG} "${.TARGET}ing the kernel objects"
385 rm -f ${KERNELS} *.map *.[io] *.ko *.ln [a-z]*.s *.su vers.c \
386 eddep tags [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
387 ${EXTRA_KERNELS} ${EXTRA_CLEAN}
388 .endif
389
390 .if !target(kernelnames)
391 kernelnames:
392 @echo "${KERNELS} ${EXTRA_KERNELS}"
393 .endif
394
395 .if !target(__CLEANDEPEND)
396 __CLEANDEPEND: .USE
397 echo .depend ${DEPS} | xargs rm -f --
398 .endif
399
400 # do not !target these, the kern and compat Makefiles augment them
401 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
402 clean: __CLEANKERNEL
403 depend: .depend
404 dependall: depend .WAIT all
405
406 ##
407 ## depend
408 ##
409
410 .if !target(.depend)
411 MKDEP_AFLAGS?= ${AFLAGS}
412 MKDEP_CFLAGS?= ${CFLAGS}
413 .if !defined(___USE_SUFFIX_RULES___)
414 DEPS+= ${SRCS:T:R:S/$/.d/g}
415 .else
416 DEPS+= ${SRCS:R:S/$/.d/g}
417 .endif
418
419 .if !defined(___USE_SUFFIX_RULES___)
420 .for _s in ${SSRCS}
421 .if !commands(${_s:T:R}.d)
422 ${_s:T:R}.d: ${_s}
423 ${_MKTARGET_CREATE}
424 ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_AFLAGS} \
425 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
426 mv -f ${.TARGET}.tmp ${.TARGET}
427 .endif
428 .endfor
429
430 .for _s in ${CSRCS}
431 .if !commands(${_s:T:R}.d)
432 ${_s:T:R}.d: ${_s}
433 ${_MKTARGET_CREATE}
434 ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_CFLAGS} \
435 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
436 mv -f ${.TARGET}.tmp ${.TARGET}
437 .endif
438 .endfor
439 .endif # !___USE_SUFFIX_RULES___
440
441 .depend: ${DEPS:O}
442 ${_MKTARGET_CREATE}
443 echo "${.ALLSRC}" | ${MKDEP} -D
444 .endif
445
446 ##
447 ## install
448 ##
449
450 # List of kernel images that will be installed into the root file system.
451 # Some platforms may need to install more than one (e.g. a netbsd.aout file
452 # to be loaded directly by the firmware), so this can be overridden by them.
453 KERNIMAGES?= netbsd
454
455 .if !target(install)
456 # The install target can be redefined by putting a
457 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
458 MACHINE_NAME!= uname -n
459 install: install-kernel-${MACHINE_NAME}
460 .if !target(install-kernel-${MACHINE_NAME})
461 install-kernel-${MACHINE_NAME}:
462 .for _K in ${KERNIMAGES}
463 .if ${KERNEL_DIR:Uno} == "yes"
464 rm -fr ${DESTDIR}/o${_K}
465 mv ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
466 mkdir -p ${DESTDIR}/${_K}
467 cp ${_K} ${DESTDIR}/${_K}/kernel
468 .else
469 rm -f ${DESTDIR}/o${_K}
470 ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
471 cp ${_K} ${DESTDIR}/n${_K}
472 mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
473 .endif
474 .endfor
475 .endif
476 .endif
477
478 ##
479 ## the kernel
480 ##
481
482 AFLAGS+= ${AOPTS.${.IMPSRC:T}}
483 CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
484 CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
485 CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}
486
487 .for _v in COPTS CPPFLAGS CWARNFLAGS
488 .for _c in ${CSRCS}
489 ${_v}.${_c:T}+=${OPT.${_c:T}:@.o.@${${_v}.${.o.}}@}
490 .endfor
491 .endfor
492
493 .MAIN: all
494 all: .gdbinit
495 .for k in ${KERNELS}
496 all: .WAIT ${k}
497 ${k}: ${SYSTEM_DEP:O} swap${k}.o vers.o build_kernel #${MKLINT:Myes:%=lint}
498 .endfor
499
500 .if !defined(COPY_SYMTAB)
501 build_kernel: .USE
502 ${SYSTEM_LD_HEAD}
503 ${SYSTEM_LD}
504 ${SYSTEM_LD_TAIL_STAGE2}
505 .else
506 .for k in ${KERNELS}
507 ${k}: $S/kern/kern_ksyms_buf.c
508 .endfor
509 build_kernel: .USE
510 ${CC} ${CFLAGS} ${CPPFLAGS} \
511 -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o
512 ${SYSTEM_LD_HEAD}
513 ${SYSTEM_LD} kern_ksyms_buf.o
514 ${SYSTEM_LD_TAIL_STAGE1}
515 ${CC} ${CFLAGS} ${CPPFLAGS} \
516 -DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \
517 -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o
518 ${SYSTEM_LD_HEAD}
519 ${SYSTEM_LD} kern_ksyms_buf_real.o
520 ${SYSTEM_LD_TAIL_STAGE2}
521 .endif
522
523 .include <bsd.files.mk>
524 .include <bsd.clang-analyze.mk>
525
526 ##
527 ## suffix rules
528 ##
529
530 .if defined(___USE_SUFFIX_RULES___)
531 .SUFFIXES: .s .d
532 .s.d:
533 ${_MKTARGET_CREATE}
534 ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
535 mv -f $@.tmp $@
536
537 .SUFFIXES: .S .d
538 .S.d:
539 ${_MKTARGET_CREATE}
540 ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
541 mv -f $@.tmp $@
542
543 .SUFFIXES: .c .d
544 .c.d:
545 ${_MKTARGET_CREATE}
546 ${MKDEP} -f $@.tmp -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
547 mv -f $@.tmp $@
548
549 .SUFFIXES: .c .o .go .po
550 .c.o:
551 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
552 @${_MKSHECHO} ${KCOMPILE.c}
553 @${KCOMPILE.c}
554 @${COMPILE_CTFCONVERT}
555 .c.go:
556 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
557 @${_MKSHECHO} ${KCOMPILE.c} -g
558 @${KCOMPILE.c} -g
559 @${COMPILE_CTFCONVERT}
560 .c.po:
561 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
562 @${_MKSHECHO} ${KCOMPILE.c} -pg
563 @${KCOMPILE.c} -pg
564 @${COMPILE_CTFCONVERT}
565
566 .SUFFIXES: .s .o .go .po
567 .s.o:
568 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
569 @${_MKSHECHO} ${KCOMPILE.s}
570 @${KCOMPILE.s}
571 .s.go:
572 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
573 @${_MKSHECHO} ${KCOMPILE.s} -g
574 @${KCOMPILE.s} -g
575 .s.po:
576 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
577 @${_MKSHECHO} ${KCOMPILE.s} -pg
578 @${KCOMPILE.s} -pg
579
580 .S.o:
581 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
582 @${_MKSHECHO} ${KCOMPILE.s}
583 @${KCOMPILE.s}
584 .S.go:
585 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
586 @${_MKSHECHO} ${KCOMPILE.s} -g
587 @${KCOMPILE.s} -g
588 .S.po:
589 @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"
590 @${_MKSHECHO} ${KCOMPILE.s} -pg
591 @${KCOMPILE.s} -pg
592 .endif # ___USE_SUFFIX_RULES___
593
594 ##
595 ## the end
596 ##
597