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