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