Makefile.kern.inc revision 1.217       1 #	$NetBSD: Makefile.kern.inc,v 1.217 2015/09/01 16:04:04 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 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
    141 # NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
    142 NORMAL_C?=	@${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
    143 		${_MKSHECHO}\
    144 		${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< -o $@ && \
    145 		${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< -o $@ && \
    146 		${COMPILE_CTFCONVERT}
    147 NOPROF_C?=	@${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
    148 		${_MKSHECHO}\
    149 		${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ && \
    150 		${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ && \
    151 		${COMPILE_CTFCONVERT}
    152 NORMAL_S?=	@${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
    153 		${_MKSHECHO}\
    154 		${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@ && \
    155 		${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@
    156 
    157 # link rules:
    158 LINK_O?=	@${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}" && \
    159 		${_MKSHECHO}\
    160 		${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC} && \
    161 		${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC}
    162 
    163 .for _s in ${CFILES}
    164 .if !commands(${_s:T:R}.o)
    165 ${_s:T:R}.o: ${_s}
    166 	${NORMAL_C}
    167 .endif
    168 .endfor
    169 
    170 .for _s in ${SFILES}
    171 .if !commands(${_s:T:R}.o)
    172 ${_s:T:R}.o: ${_s}
    173 	${NORMAL_S}
    174 .endif
    175 .endfor
    176 
    177 .SUFFIXES: .c .o
    178 .c.o:
    179 	${NORMAL_C}
    180 
    181 .SUFFIXES: .S .o
    182 .S.o:
    183 	${NORMAL_S}
    184 
    185 ##
    186 ## (3) libkern and compat
    187 ##
    188 ## Set KERN_AS in the port Makefile to "obj" or "library".  The
    189 ## default is "library", as documented in $S/lib/libkern/Makefile.inc.
    190 ##
    191 
    192 ### find out what to use for libkern
    193 .include "$S/lib/libkern/Makefile.inc"
    194 .ifndef PROF
    195 LIBKERN?=	${KERNLIB}
    196 .else
    197 LIBKERN?=	${KERNLIB_PROF}
    198 .endif
    199 
    200 LIBKERNLN?=	${KERNLIBLN}
    201 
    202 ### find out what to use for libcompat
    203 .include "$S/compat/common/Makefile.inc"
    204 .ifndef PROF
    205 SYSLIBCOMPAT?=	${COMPATLIB}
    206 .else
    207 SYSLIBCOMPAT?=	${COMPATLIB_PROF}
    208 .endif
    209 
    210 SYSLIBCOMPATLN?=	${COMPATLIBLN}
    211 
    212 ##
    213 ## (4) local objects, compile rules, and dependencies
    214 ##
    215 ## Each port should have a corresponding section with settings for
    216 ## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
    217 ##
    218 
    219 MI_CFILES=	param.c
    220 .if !defined(___USE_SUFFIX_RULES___)
    221 MI_CFILES+=	devsw.c ioconf.c
    222 .endif
    223 
    224 # the need for a MI_SFILES variable is dubitable at best
    225 MI_OBJS=${MI_CFILES:S/.c/.o/}
    226 
    227 param.c: $S/conf/param.c
    228 	${_MKTARGET_CREATE}
    229 	rm -f param.c
    230 	cp $S/conf/param.c .
    231 
    232 ##
    233 ## (5) link settings
    234 ##
    235 ## TEXTADDR (or LOADADDRESS), LINKFORMAT, LINKSCRIPT, and any EXTRA_LINKFLAGS
    236 ## must be set in the port's Makefile.  The port specific definitions for
    237 ## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
    238 ## depending on the value of DEBUG.
    239 ##
    240 # load lines for config "xxx" will be emitted as:
    241 # xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel
    242 
    243 .if !empty(OBJS:Mnetbsd.ko)
    244 SYSTEM_OBJ?=	${MD_OBJS} ${MI_OBJS} ${OBJS} ${SYSLIBCOMPAT} ${LIBKERN}
    245 .else
    246 SYSTEM_OBJ?=	${MD_OBJS} ${MI_OBJS} ${OBJS:O} ${SYSLIBCOMPAT} ${LIBKERN}
    247 .endif
    248 SYSTEM_DEP+=	Makefile ${SYSTEM_OBJ} .gdbinit
    249 .if defined(CTFMERGE)
    250 SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
    251 .else
    252 SYSTEM_CTFMERGE= ${_MKSHECHO}
    253 .endif
    254 SYSTEM_LD_HEAD?=@rm -f $@
    255 SYSTEM_LD?=	@do_system_ld() { \
    256 		target=$$1; shift; \
    257 		${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}"; \
    258 		${_MKSHECHO}\
    259 		${LD} -Map $${target}.map --cref ${LINKFLAGS} -o $${target} '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o $$@; \
    260 		${LD} -Map $${target}.map --cref ${LINKFLAGS} -o $${target} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o $$@; \
    261 		}; \
    262 		do_system_ld
    263 
    264 # Give MD generated ldscript dependency on ${SYSTEM_OBJ}
    265 .if defined(KERNLDSCRIPT)
    266 .if target(${KERNLDSCRIPT})
    267 ${KERNLDSCRIPT}: ${SYSTEM_OBJ}
    268 .endif
    269 .endif
    270 
    271 .if defined(KERNLDSCRIPT)
    272 .for k in ${KERNELS}
    273 EXTRA_CLEAN+=	${k}.ldscript
    274 ${k}: ${k}.ldscript
    275 ${k}.ldscript: ${KERNLDSCRIPT} assym.h
    276 	${_MKTARGET_CREATE}
    277 	${CPP} -I. ${KERNLDSCRIPT} | grep -v '^#' | grep -v '^$$' >$@
    278 .endfor
    279 LINKSCRIPT=	-T ${.TARGET}.ldscript
    280 .endif
    281 
    282 TEXTADDR?=	${LOADADDRESS}			# backwards compatibility
    283 LINKTEXT?=	${TEXTADDR:C/.+/-Ttext &/}
    284 LINKDATA?=	${DATAADDR:C/.+/-Tdata &/}
    285 ENTRYPOINT?=	start
    286 LINKENTRY?=	${ENTRYPOINT:C/.+/-e &/}
    287 LINKFLAGS?=	${LINKFORMAT} ${LINKSCRIPT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
    288 		${EXTRA_LINKFLAGS}
    289 
    290 LINKFLAGS_DEBUG?=	-X
    291 
    292 SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c; \
    293 		${SIZE} $@; chmod 755 $@; \
    294 		${SYSTEM_CTFMERGE}
    295 SYSTEM_LD_TAIL_DEBUG?=; \
    296 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    297 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    298 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    299 LINKFLAGS_NORMAL?=	-S
    300 STRIPFLAGS?=	-g
    301 
    302 DEBUG?=
    303 .if !empty(DEBUG:M-g*)
    304 SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
    305 LINKFLAGS+=	${LINKFLAGS_DEBUG}
    306 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
    307 CTFFLAGS+=	-g
    308 TARGETSFX=	.gdb
    309 .elifndef PROF
    310 LINKFLAGS+=	${LINKFLAGS_NORMAL}
    311 .endif
    312 
    313 SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA}
    314 SYSTEM_LD_TAIL_STAGE1=	${SYSTEM_LD_TAIL}
    315 SYSTEM_LD_TAIL_STAGE2=	${SYSTEM_LD_TAIL}
    316 .if defined(COPY_SYMTAB)
    317 SYSTEM_LD_TAIL_STAGE2+=	; echo ${DBSYM} $@; ${DBSYM} $@
    318 .if !empty(DEBUG:M-g)
    319 SYSTEM_LD_TAIL_STAGE2+=	; echo ${DBSYM} $@.gdb; ${DBSYM} $@.gdb
    320 .endif
    321 .endif
    322 SYSTEM_LD_TAIL_STAGE2+=	${SYSTEM_LD_TAIL_EXTRA}
    323 
    324 ##
    325 ## (6) port independent targets and dependencies: assym.h, vers.o
    326 ##
    327 
    328 .SUFFIXES: .genassym .assym.h
    329 .genassym.assym.h:
    330 	${_MKTARGET_CREATE}
    331 	cat $< | \
    332 	    ${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
    333 	    ${GENASSYM_CPPFLAGS} > $@.tmp && \
    334 	mv -f $@.tmp $@
    335 
    336 assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} $S/conf/genassym.cf
    337 	${_MKTARGET_CREATE}
    338 	cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} $S/conf/genassym.cf | \
    339 	    ${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
    340 	    ${GENASSYM_CPPFLAGS} > assym.h.tmp && \
    341 	mv -f assym.h.tmp assym.h
    342 ${MD_SFILES:C/\.[Ss]/.o/} ${SFILES:C/\.[Ss]/.o/}: assym.h
    343 
    344 MKREPRO?=no
    345 
    346 .if ${MKREPRO} == "yes"
    347 _NVFLAGS=${NVFLAGS} -r
    348 .else
    349 _NVFLAGS=${NVFLAGS}
    350 .endif
    351 
    352 .if !target(vers.o)
    353 newvers: vers.o
    354 vers.o: ${SYSTEM_OBJ} Makefile $S/conf/newvers.sh \
    355 		$S/conf/osrelease.sh ${_NETBSD_VERSION_DEPENDS}
    356 	${_MKMSG_CREATE} vers.c
    357 	${HOST_SH} $S/conf/newvers.sh ${_NVFLAGS}
    358 	${_MKTARGET_COMPILE}
    359 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    360 	${COMPILE_CTFCONVERT}
    361 .endif
    362 
    363 ##
    364 ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
    365 ##                   cscope, mkid
    366 ##
    367 ## Any ports that have other stuff to be cleaned up should fill in
    368 ## EXTRA_CLEAN.  Some ports may want different settings for
    369 ## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
    370 ##
    371 
    372 ##
    373 ## clean
    374 ##
    375 
    376 .if !target(__CLEANKERNEL)
    377 __CLEANKERNEL: .USE
    378 	${_MKMSG} "${.TARGET}ing the kernel objects"
    379 	rm -f ${KERNELS} *.map eddep tags *.[io] *.ko *.ln [a-z]*.s vers.c \
    380 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
    381 	    ${EXTRA_KERNELS} ${EXTRA_CLEAN}
    382 .endif
    383 
    384 .if !target(kernelnames)
    385 kernelnames:
    386 	@echo "${KERNELS} ${EXTRA_KERNELS}"
    387 .endif
    388 
    389 .if !target(__CLEANDEPEND)
    390 __CLEANDEPEND: .USE
    391 	echo .depend ${DEPS} | xargs rm -f --
    392 .endif
    393 
    394 # do not !target these, the kern and compat Makefiles augment them
    395 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    396 clean: __CLEANKERNEL
    397 depend: .depend
    398 dependall: depend .WAIT all
    399 
    400 ##
    401 ## depend
    402 ##
    403 
    404 .if !target(.depend)
    405 MKDEP_AFLAGS?=	${AFLAGS}
    406 MKDEP_CFLAGS?=	${CFLAGS}
    407 SSRCS=${MD_SFILES} ${SFILES}
    408 CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES}
    409 SRCS=${SSRCS} ${CSRCS}
    410 DEPS=	${SRCS:T:u:R:S/$/.d/g}
    411 
    412 .SUFFIXES: .S .d
    413 .S.d:
    414 	${_MKTARGET_CREATE}
    415 	${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
    416 	    ${CPPFLAGS} ${CPPFLAGS.${_s:T}} $<
    417 
    418 .for _s in ${SSRCS}
    419 .if !target(${_s:T:R}.d)
    420 ${_s:T:R}.d: ${_s} assym.h
    421 	${_MKTARGET_CREATE}
    422 	${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
    423 	    ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
    424 .endif
    425 .endfor
    426 
    427 .SUFFIXES: .c .d
    428 .c.d:
    429 	${_MKTARGET_CREATE}
    430 	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
    431 	    ${CPPFLAGS} ${CPPFLAGS.${_s:T}} $<
    432 
    433 .for _s in ${CSRCS}
    434 .if !target(${_s:T:R}.d)
    435 ${_s:T:R}.d: ${_s}
    436 	${_MKTARGET_CREATE}
    437 	${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
    438 	    ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
    439 .endif
    440 .endfor
    441 
    442 assym.d: assym.h
    443 	${_MKTARGET_CREATE}
    444 	cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
    445 	    ${GENASSYM} -- ${MKDEP} -f assym.dep -- \
    446 	    ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${GENASSYM_CPPFLAGS}
    447 	${TOOL_SED} -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >${.TARGET}
    448 	rm -f assym.dep
    449 
    450 DEPS+=	assym.d
    451 
    452 .depend: ${DEPS}
    453 	${_MKTARGET_CREATE}
    454 	echo "${.ALLSRC}" | ${MKDEP} -D
    455 .endif
    456 
    457 ##
    458 ## install
    459 ##
    460 
    461 # List of kernel images that will be installed into the root file system.
    462 # Some platforms may need to install more than one (e.g. a netbsd.aout file
    463 # to be loaded directly by the firmware), so this can be overriden by them.
    464 KERNIMAGES?=	netbsd
    465 
    466 .if !target(install)
    467 # The install target can be redefined by putting a
    468 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    469 MACHINE_NAME!=  uname -n
    470 install: install-kernel-${MACHINE_NAME}
    471 .if !target(install-kernel-${MACHINE_NAME})
    472 install-kernel-${MACHINE_NAME}:
    473 .for _K in ${KERNIMAGES}
    474 	rm -f ${DESTDIR}/o${_K}
    475 	ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
    476 	cp ${_K} ${DESTDIR}/n${_K}
    477 	mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
    478 .endfor
    479 .endif
    480 .endif
    481 
    482 .include "${S}/conf/splash.mk"
    483 .include "${S}/conf/mdroot.mk"
    484 .include "${S}/conf/lint.mk"
    485 .include "${S}/conf/cscope.mk"
    486 .include "${S}/conf/gdbinit.mk"
    487 
    488 ##
    489 ## the kernel
    490 ##
    491 
    492 # The following files use alloca(3) or variable array allocations.
    493 # Their full name is noted as documentation.
    494 VARSTACK=kern/uipc_socket.c miscfs/genfs/genfs_vnops.c \
    495     nfs/nfs_bio.c uvm/uvm_bio.c \
    496     uvm/uvm_pager.c dev/ic/aic7xxx.c dev/ic/aic79xx.c arch/xen/i386/gdt.c \
    497     dev/ofw/ofw_subr.c
    498 
    499 .for __varstack in ${VARSTACK}
    500 COPTS.${__varstack:T} += -Wno-stack-protector
    501 .endfor
    502 
    503 AFLAGS+=	${AOPTS.${.IMPSRC:T}}
    504 CFLAGS+=	${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
    505 CPPFLAGS+=	${CPPFLAGS.${.IMPSRC:T}}
    506 CWARNFLAGS+=	${CWARNFLAGS.${.IMPSRC:T}}
    507 
    508 .if !defined(COPY_SYMTAB)
    509 build_kernel: .USE
    510 	${SYSTEM_LD_HEAD}
    511 .if !defined(___USE_SUFFIX_RULES___)
    512 	${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o
    513 .else
    514 	${SYSTEM_LD} ${.TARGET}
    515 .endif
    516 	${SYSTEM_LD_TAIL_STAGE2}
    517 .else
    518 .for k in ${KERNELS}
    519 ${k}: $S/kern/kern_ksyms_buf.c
    520 .endfor
    521 build_kernel: .USE
    522 	${CC} ${CFLAGS} ${CPPFLAGS} -DCOPY_SYMTAB \
    523 	    -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o
    524 	${SYSTEM_LD_HEAD}
    525 .if !defined(___USE_SUFFIX_RULES___)
    526 	${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o kern_ksyms_buf.o
    527 .else
    528 	${SYSTEM_LD} ${.TARGET} kern_ksyms_buf.o
    529 .endif
    530 	${SYSTEM_LD_TAIL_STAGE1}
    531 	${CC} ${CFLAGS} ${CPPFLAGS} -DCOPY_SYMTAB \
    532 	    -DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \
    533 	    -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o
    534 	${SYSTEM_LD_HEAD}
    535 .if !defined(___USE_SUFFIX_RULES___)
    536 	${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o kern_ksyms_buf_real.o
    537 .else
    538 	${SYSTEM_LD} ${.TARGET} kern_ksyms_buf_real.o
    539 .endif
    540 	${SYSTEM_LD_TAIL_STAGE2}
    541 .endif
    542 
    543 .include <bsd.files.mk>
    544 .include <bsd.clang-analyze.mk>
    545 
    546 ##
    547 ## the end
    548 ##
    549